Static library cross-platform generation method and device, equipment and storage medium

By obtaining matrix calculation algorithm files and target platform parameters, and using controller conversion tools to generate cross-platform compatible build configuration files, the problems of cumbersome configuration and poor compatibility in cross-platform static library construction are solved, achieving efficient and reliable static library generation.

CN122308836APending Publication Date: 2026-06-30DONGFENG MOTOR GRP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DONGFENG MOTOR GRP
Filing Date
2026-02-10
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

The existing static library cross-platform building process suffers from problems such as cumbersome configuration, poor cross-platform compatibility, imperfect dependency management, and high technical threshold, resulting in low algorithm deployment efficiency and poor reliability.

Method used

By acquiring the matrix calculation algorithm file, project configuration information, and target platform parameters, the controller calls the matrix calculation code conversion tool to convert the initial code into target code, extracts dependency information, generates a cross-platform compatible build configuration file, and performs compilation and build operations to generate the target static library.

Benefits of technology

It enables automated generation of static libraries across platforms, simplifies the build process, improves cross-platform compatibility and build reliability, and reduces deployment difficulty.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122308836A_ABST
    Figure CN122308836A_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, device, and storage medium for cross-platform static library generation. It belongs to the technical field of cross-platform static library construction. The method includes: acquiring a matrix calculation algorithm file, project configuration information, and target platform parameters; constructing a controller, calling a matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code, and extracting the dependency information corresponding to the target code; generating a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information; and performing a compilation and build operation based on the build configuration file to generate the target static library. This achieves the technical effect of improving cross-platform adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of static library cross-platform construction technology, and in particular to a static library cross-platform generation method, apparatus, device and storage medium. Background Technology

[0002] In the fields of scientific computing and engineering simulation, Matrix Labs software, with its powerful mathematical computing capabilities and rich toolkit, is widely used for algorithm development and prototype verification. When these algorithms need to be deployed to a production environment, they typically need to be converted into C / C++ code and compiled into static libraries for integration into larger software systems. Currently, the mainstream conversion and deployment methods fall into two categories: one is to directly generate C / C++ code using the Matrix Labs code generation tool and then manually write build scripts to complete the compilation; the other is to utilize a cross-platform build system in conjunction with the interface of the Matrix Labs code generation tool to achieve a partially automated build process.

[0003] Existing conversion and deployment methods have several shortcomings. First, build configuration is cumbersome and difficult to maintain. Whether using manually written build scripts or partially automated solutions, developers need to manually maintain file lists, configure library paths, and manage dependencies. When the algorithm code structure changes, omissions or errors are likely to occur. Second, cross-platform compatibility is poor. The installation paths and library file formats of the Matrix Lab software differ across operating systems, requiring separate build configuration maintenance for each platform, resulting in a low cross-platform build success rate. Third, dependency management is inadequate. When the algorithm depends on external libraries, manually configuring linking options is prone to errors, becoming one of the main reasons for build failures. In addition, existing solutions also suffer from high technical barriers, a disconnect between development and deployment, or support for only generating specific files and a lack of code quality assurance mechanisms, severely impacting the efficiency and reliability of algorithm deployment. Summary of the Invention

[0004] This invention provides a method, apparatus, device, and storage medium for generating static libraries across platforms, thereby achieving automated generation of static libraries across platforms and solving the technical problems of cumbersome configuration, poor cross-platform compatibility, imperfect dependency management, and high technical threshold in traditional methods.

[0005] According to one aspect of the present invention, a method for generating static libraries across platforms is provided, characterized in that it includes:

[0006] Obtain matrix calculation algorithm files, project configuration information, and target platform parameters;

[0007] A controller is built, and a matrix calculation code conversion tool is called to convert the initial code in the matrix calculation algorithm file into target code, and the dependency information corresponding to the target code is extracted.

[0008] Based on the project configuration information, the target platform parameters, and the dependency information, a cross-platform compatible build configuration file is generated. Based on the build configuration file, a compilation and build operation is performed to generate the target static library.

[0009] According to another aspect of the present invention, a static library cross-platform generation apparatus is provided, characterized in that it comprises:

[0010] The data acquisition module is used to acquire matrix calculation algorithm files, project configuration information, and target platform parameters;

[0011] The information extraction module is used to build the controller, call the matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code, and extract the dependency information corresponding to the target code.

[0012] The static library generation module is used to generate a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information, and to perform a compilation and build operation based on the build configuration file to generate the target static library.

[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0014] At least one processor;

[0015] and memory that is communicatively connected to at least one processor;

[0016] The memory stores a computer program that can be executed by at least one processor, which enables the at least one processor to execute the static library cross-platform generation method of any embodiment of the present invention.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute and implement the static library cross-platform generation method of any embodiment of the present invention.

[0018] The technical solution of this invention involves acquiring a matrix calculation algorithm file, project configuration information, and target platform parameters; constructing a controller; calling a matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code; extracting the dependency information corresponding to the target code; generating a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information; and performing a compilation and build operation based on the build configuration file to generate a target static library. This solves the technical problems of cumbersome configuration, poor cross-platform compatibility, imperfect dependency management, and high technical barriers in traditional methods, achieving the technical effects of simplifying the build process, improving cross-platform adaptability, ensuring build reliability, and reducing deployment difficulty.

[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 A flowchart illustrating a method for generating a static library across platforms, as provided in an embodiment of the present invention;

[0022] Figure 2a A flowchart illustrating another method for generating a static library across platforms, as provided in this embodiment of the invention;

[0023] Figure 2b A flowchart illustrating the generation of a detection report for another method for cross-platform static library generation provided in this embodiment of the invention;

[0024] Figure 3 This is a schematic diagram of a static library cross-platform generation device provided in an embodiment of the present invention;

[0025] Figure 4 A schematic diagram of the structure of an electronic device for implementing a static library cross-platform generation method according to an embodiment of the present invention. Detailed Implementation

[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] Figure 1 This is a flowchart illustrating a method for generating a static library across platforms, provided by an embodiment of the present invention. This embodiment is applicable to the generation of static libraries across platforms. The method can be executed by a static library cross-platform generation device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method specifically includes the following steps:

[0029] S110: Obtain the matrix calculation algorithm file, project configuration information, and target platform parameters.

[0030] Among them, the matrix calculation algorithm file can be understood as a file that stores the algorithm logic related to matrix operations;

[0031] Project configuration information can be understood as the relevant settings data that support the generation of static libraries; target platform parameters can be understood as the operating system information that the static library will eventually run on, used to adapt to different operating environments;

[0032] Specifically, collect the core input data required for static library generation, including source files storing algorithm logic, configuration data defining project attributes, and platform information specifying the runtime environment.

[0033] In some optional embodiments, the project configuration information includes at least one of the following: project name, static library name, output directory, compilation options, and external dependency library list.

[0034] Here, the project name can be understood as the unique name that identifies the static library project; the static library name can be understood as the naming of the target static library; the output directory can be understood as the specified folder path for storing the target code, build configuration files, and the final static library; the compilation options can be understood as the parameter settings that control the compiler's compilation behavior; and the external dependency library list can be understood as the set of external libraries required for the target code to be compiled and run.

[0035] S120. Construct a controller, call the matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code, and extract the dependency information corresponding to the target code.

[0036] The controller can be understood as an automated control module that coordinates the entire static library generation process; the matrix calculation code conversion tool can be understood as a specialized tool that converts the initial code in the matrix calculation algorithm file into target code, such as the matrix lab code generation tool; the initial code can be understood as the original algorithm code written in the matrix calculation algorithm file, such as the code supported by the matrix lab software; the target code can be understood as the converted code that can be used to compile and generate a static library, such as C / C++ code; the dependency information can be understood as the association information of related files and libraries required for the compilation and operation of the target code, which may include header files, source files, and dependent libraries.

[0037] Specifically, an automated control module is created to coordinate the entire process. This module calls a dedicated conversion tool to convert the original matrix calculation algorithm code into compilable target code, while automatically identifying the associated files and library information required by the target code.

[0038] In some optional embodiments, the step of building the controller and invoking a matrix computation code conversion tool to convert the initial code in the matrix computation algorithm file into target code includes: building the controller based on a computer language, and issuing code conversion instructions to the matrix computation code conversion tool through the controller; wherein the instructions carry the static library name, output directory, and target operating system type in the target platform parameters of the project configuration information; the matrix computation code conversion tool converts the initial code into the target code according to the code conversion instructions.

[0039] Here, computer language can be understood as the programming language used to write the controller, such as Python; code conversion instructions can be understood as the operation commands issued by the controller to the conversion tool, which specify the specific requirements for code conversion; target operating system type can be understood as the operating system category explicitly stated in the target platform parameters, such as Windows.

[0040] Specifically, an automated controller is first built using a computer language. Then, the controller sends a conversion instruction containing the static library name, output directory, and target operating system type to the matrix calculation code conversion tool. The conversion tool converts the initial code in the matrix calculation algorithm file into the target code according to the instruction requirements.

[0041] In some optional embodiments, the step of extracting the dependency information corresponding to the target code includes: scanning the target code files in the output directory of the project configuration information using a file parsing algorithm, filtering out header files with a first preset suffix and source files with a second preset suffix, and forming a header file list and a source file list respectively; integrating the header file list, the source file list and the external dependency library list in the project configuration information to form structured dependency information.

[0042] Among them, the file parsing algorithm can be understood as an algorithm program used to scan and identify file types and extract file information; the first preset suffix can be understood as a fixed file extension identifier for header files; the second preset suffix can be understood as a fixed file extension identifier for source files; the header file list can be understood as a collection of all header file paths after being organized; the source file list can be understood as a collection of all source file paths after being organized; and the structured dependency information can be understood as dependency data organized in a unified format.

[0043] Specifically, the target code files in the output directory are scanned using a file parsing algorithm. Header files and source files are selected based on the first and second preset suffixes, respectively, forming corresponding header file lists and source file lists. The header file lists and source file lists are then integrated with the external dependency library lists in the project configuration information to form a structured dependency relationship information with a standardized format and clear association.

[0044] S130. Generate a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information. Perform a compilation and build operation based on the build configuration file to generate the target static library.

[0045] Among them, a cross-platform compatible build configuration file can be understood as a build rule file that can adapt to multiple operating systems; the compilation and build operation can be understood as the process of converting the target code into a static library according to the rules of the build configuration file; the target static library can be understood as the final generated library file that can be integrated and used on the target platform.

[0046] Specifically, based on the previously collected configuration, platform, and dependency information, a build configuration file adapted to multiple operating systems is generated. Then, the compilation process is executed according to the requirements of the build configuration file, converting the target code into a directly usable static library, enabling efficient cross-platform deployment. The configuration file generation automatically adapts to the library file formats of different platforms, eliminating the need for manual adjustments.

[0047] In some optional embodiments, generating a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information includes: calling a configuration template corresponding to the target operating system type according to the target operating system type in the target platform parameters; and dynamically writing the project configuration information and the dependency information into the configuration template.

[0048] Configure platform adaptation rules in the configuration template, adjust library file extensions, path separators, and compilation and linking parameters to generate a cross-platform compatible build configuration file.

[0049] Among them, configuration templates can be understood as the pre-defined basic framework of build configuration files; platform adaptation rules can be understood as configuration adjustment rules formulated according to the characteristics of different operating systems; library file extensions can be understood as suffixes that identify the type of library files; path separators can be understood as symbols that identify the file path hierarchy; and compilation and linking parameters can be understood as settings that control the compilation and linking process.

[0050] Specifically, based on the operating system type in the target platform parameters, the corresponding build configuration template is called, and the project configuration information and structured dependency information are dynamically filled into the template. According to the platform adaptation rules, the library file extensions, path separators and compilation and linking parameters in the template are adjusted to generate a build configuration file that can adapt to multiple operating systems, solving the problem of cumbersome cross-platform configuration in traditional methods.

[0051] The technical solution of this invention involves acquiring a matrix calculation algorithm file, project configuration information, and target platform parameters; constructing a controller; calling a matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code; extracting the dependency information corresponding to the target code; generating a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information; and performing a compilation and build operation based on the build configuration file to generate a target static library. This solves the technical problems of cumbersome configuration, poor cross-platform compatibility, imperfect dependency management, and high technical barriers in traditional methods, achieving the technical effects of simplifying the build process, improving cross-platform adaptability, ensuring build reliability, and reducing deployment difficulty.

[0052] Figure 2a This is a flowchart illustrating another method for generating a static library across platforms, provided by an embodiment of the present invention. Based on the above embodiments, this embodiment is a further refinement of the above embodiments, and its specific implementation can be found in the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here. Figure 2a As shown, the method specifically includes the following steps:

[0053] S210: Obtain the matrix calculation algorithm file, project configuration information, and target platform parameters.

[0054] S220. Construct a controller, call the matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code, and extract the dependency information corresponding to the target code.

[0055] S230. Generate a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information. Call the code quality detection tool through the controller to perform static analysis on the target code in the output directory of the project configuration information to obtain the target code detection results.

[0056] Among them, code quality inspection tools can be understood as specialized tools used to inspect the quality of target code, including performance and readability analysis tools and potential error detection tools; static analysis can be understood as a way to inspect the quality of target code without running it; target code inspection results can be understood as the quality assessment conclusions output by code quality inspection tools, including qualified and unqualified.

[0057] Specifically, the controller initiates a call to utilize code quality inspection tools to perform non-runtime inspections on the converted target code in the output directory. This comprehensively checks for potential syntax errors, performance vulnerabilities, compliance issues, and other problems, ultimately generating a clear quality assessment result. Preferably, multiple inspection tools can be enabled simultaneously to improve the coverage of problem identification.

[0058] S240. If the target code detection result is qualified, the controller calls the cross-platform build execution tool to load the build configuration file.

[0059] Cross-platform build execution tools can be understood as tools that can perform build operations on multiple operating systems.

[0060] Specifically, if the target code quality meets the requirements, the controller will further invoke the cross-platform build execution tool and load the previously generated cross-platform compatible build configuration file. This allows the build tool to clarify the build rules, dependencies, and platform adaptation requirements, preparing for the compilation and linking operations. Preferably, the integrity of the configuration file is verified during the loading process to avoid build failures due to file corruption.

[0061] S250. Based on the build configuration file and the target platform parameters, call the adapted compiler to perform compilation and linking operations to generate the target static library.

[0062] A compiler can be understood as a tool that converts target code into machine language.

[0063] Specifically, the cross-platform build execution tool automatically matches a compiler compatible with the target operating system according to the rules in the build configuration file and the target platform parameters. The compiler then compiles and links the target code and related dependency files into a target static library that can be directly used on the target platform, completing the conversion from code to a usable library file. Preferably, logs can be recorded during the compilation process to facilitate subsequent troubleshooting.

[0064] For example, when a code quality testing tool, through static analysis, does not find any potential errors in the target code that could cause runtime crashes, such as syntax errors, undefined behavior, array out-of-bounds errors, or null pointer references; when the code's nesting depth, function complexity, and percentage of redundant code all meet preset performance and readability standards; when the code naming conventions, comment completeness, and indentation format all meet preset code style requirements; and when external dependency libraries are referenced accurately, header files are included reasonably, and there are no dependency-related issues that affect compilation and building, the code quality testing result can be determined to be qualified.

[0065] The technical solution of this invention solves the technical problems of lacking code quality assurance mechanisms and difficulty in early detection of potential problems in the prior art by integrating a static code quality analysis step before compilation and building. At the same time, it solves the problems of cumbersome compiler adaptation and lack of unified scheduling in cross-platform building. It achieves the technical effects of avoiding code quality risks in advance, ensuring the stability and reliability of the target static library, and realizing automatic adaptation of compilation tools, improving the efficiency and success rate of cross-platform building. It significantly improves the code specification compliance rate of the generated static library and further reduces the build failure rate.

[0066] Figure 2b This is a flowchart illustrating the generation of a detection report for another method for cross-platform static library generation provided in this embodiment of the invention. Based on the above embodiments, this embodiment is a further optimization, and its specific implementation can be found in the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here. Figure 2b As shown, the method specifically includes the following steps:

[0067] S310: Obtain the matrix calculation algorithm file, project configuration information, and target platform parameters.

[0068] S320. Construct a controller, call the matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code, and extract the dependency information corresponding to the target code.

[0069] S330. Generate a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information. Call the code quality detection tool through the controller to perform static analysis on the target code in the output directory of the project configuration information to obtain the target code detection results.

[0070] Among them, code quality inspection tools can be understood as specialized tools used to inspect the quality of target code, including performance and readability analysis tools and potential error detection tools; static analysis can be understood as a way to inspect the quality of target code without running it; target code inspection results can be understood as the quality assessment conclusions output by code quality inspection tools, including qualified and unqualified.

[0071] Specifically, the controller initiates a call to utilize code quality inspection tools to perform non-runtime inspections on the converted target code in the output directory. This comprehensively checks for potential syntax errors, performance vulnerabilities, compliance issues, and other problems, ultimately generating a clear quality assessment result. Preferably, multiple inspection tools can be enabled simultaneously to improve the coverage of problem identification.

[0072] S340. If the target code detection result is unqualified, terminate the compilation and build operation, and generate a quality inspection report based on the target code detection result.

[0073] The quality inspection report can be understood as a document that records quality problems in the target code, including information such as the type of problem, location, and repair suggestions.

[0074] Specifically, if the code quality check result is unsatisfactory, it indicates that the target code has issues affecting the functionality or performance of the static library. In this case, the compilation and build operation should be terminated immediately to avoid wasting resources on ineffective builds. Simultaneously, based on the specific issues discovered during the check, a detailed quality check report should be generated to provide developers with clear directions for remediation. The build process can be restarted after the issues are fixed. Preferably, the quality check report will be sorted by the severity of the issues, allowing developers to prioritize and address critical problems.

[0075] For example, when a code quality testing tool detects potential errors that could cause runtime crashes, such as syntax errors, undefined behavior, array out-of-bounds errors, or null pointer references, during static analysis; or issues affecting code performance and readability, such as excessively deep nested loops, excessive redundant code, or excessive function complexity; or situations that do not conform to preset code standards (such as non-standard naming, missing comments, or chaotic code indentation); or dependency-related issues that affect compilation and building, such as incorrect references to external dependency libraries or duplicate inclusion of header files, the code quality testing result can be determined to be unqualified.

[0076] The technical solution of this invention solves the technical problems of delayed code quality problem detection, resource consumption of invalid builds, and difficulty for developers to locate code defects in the prior art by terminating the compilation and build operation in a timely manner and generating a quality inspection report when the target code detection result is unqualified. It achieves the technical effect of avoiding the waste of computing power and time in useless build processes, providing developers with clear directions for defect repair, reducing the rate of repeated builds caused by code quality problems, and improving development and debugging efficiency.

[0077] Figure 3 This is a schematic diagram of a static library cross-platform generation device provided in an embodiment of the present invention. Figure 3 As shown, the device includes: a data acquisition module 410, an information extraction module 420, and a static library generation module 430.

[0078] The data acquisition module 410 is used to acquire matrix calculation algorithm files, project configuration information, and target platform parameters; the information extraction module 420 is used to build a controller, call a matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code, and extract the dependency information corresponding to the target code; the static library generation module 430 is used to generate a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information, and perform a compilation and build operation based on the build configuration file to generate the target static library.

[0079] The technical solution of this invention involves acquiring a matrix calculation algorithm file, project configuration information, and target platform parameters; constructing a controller; calling a matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code; extracting the dependency information corresponding to the target code; generating a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information; and performing a compilation and build operation based on the build configuration file to generate a target static library. This solves the technical problems of cumbersome configuration, poor cross-platform compatibility, imperfect dependency management, and high technical barriers in traditional methods, achieving the technical effects of simplifying the build process, improving cross-platform adaptability, ensuring build reliability, and reducing deployment difficulty.

[0080] In some optional embodiments, the project configuration information includes at least one of the following: project name, static library name, output directory, compilation options, and external dependency library list.

[0081] In some optional embodiments, the information extraction module includes:

[0082] The controller construction unit is used to construct the controller based on a computer language, and to issue code conversion instructions to the matrix calculation code conversion tool through the controller; wherein, the instructions carry the static library name, output directory and target operating system type in the target platform parameters of the project configuration information;

[0083] A code conversion unit is used by the matrix calculation code conversion tool to convert the initial code into the target code according to the code conversion instructions.

[0084] In some optional embodiments, the information extraction module includes:

[0085] The file list generation unit is used to scan the target code files in the output directory of the project configuration information using a file parsing algorithm, filter out header files with a first preset suffix and source files with a second preset suffix, and form a header file list and a source file list respectively.

[0086] The dependency generation unit is used to integrate the header file list, the source file list, and the external dependency library list in the project configuration information to form structured dependency information.

[0087] In some optional embodiments, the static library generation module includes:

[0088] The configuration template invocation unit is used to invoke the configuration template corresponding to the target operating system type according to the target operating system type in the target platform parameters;

[0089] An information writing unit is used to dynamically write the project configuration information and the dependency information into the configuration template.

[0090] The configuration file generation unit is used to configure platform adaptation rules in the configuration template, adjust library file extensions, path separators and compilation and linking parameters, and generate a cross-platform compatible build configuration file.

[0091] In some optional embodiments, the static library generation module includes:

[0092] The detection result determination unit is used to call the code quality detection tool through the controller to perform static analysis on the target code in the output directory of the project configuration information to obtain the target code detection result;

[0093] The configuration file loading unit is used to load the build configuration file by calling the cross-platform build execution tool through the controller when the target code detection result is qualified.

[0094] The static library generation unit is used to call the adapted compiler to perform compilation and linking operations based on the build configuration file and the target platform parameters to generate the target static library.

[0095] In some alternative embodiments, the apparatus further includes:

[0096] The detection report generation module is used to terminate the compilation and build operation and generate a quality detection report based on the target code detection result if the target code detection result is unqualified.

[0097] The static library cross-platform generation apparatus provided in this embodiment of the invention can execute the static library cross-platform generation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0098] Figure 4 This is a schematic diagram of the structure of an electronic device for implementing the static library cross-platform generation method of this invention. The electronic device is intended to represent various forms of digital computers, such as laptops, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0099] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0100] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0101] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as cross-platform generation of static libraries.

[0102] In some embodiments, the cross-platform generation of the method static library can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the cross-platform generation of the method static library described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform cross-platform generation of the method static library by any other suitable means (e.g., by means of firmware).

[0103] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0104] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0105] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0106] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0107] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0108] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0109] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0110] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for generating static libraries across platforms, characterized in that, include: Obtain matrix calculation algorithm files, project configuration information, and target platform parameters; A controller is built, and a matrix calculation code conversion tool is called to convert the initial code in the matrix calculation algorithm file into target code, and the dependency information corresponding to the target code is extracted. Based on the project configuration information, the target platform parameters, and the dependency information, a cross-platform compatible build configuration file is generated. Based on the build configuration file, a compilation and build operation is performed to generate the target static library.

2. The method according to claim 1, characterized in that, The project configuration information includes at least one of the following: project name, static library name, output directory, compilation options, and external dependency library list.

3. The method according to claim 1, characterized in that, The controller construction process calls a matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code, including: The controller is built based on a computer language and issues code conversion instructions to the matrix calculation code conversion tool through the controller; wherein, the instructions carry the static library name, output directory and target operating system type in the target platform parameters from the project configuration information; The matrix calculation code conversion tool converts the initial code into the target code according to the code conversion instructions.

4. The method according to claim 1, characterized in that, The step of extracting the dependency information corresponding to the target code includes: The target code files in the output directory of the project configuration information are scanned by a file parsing algorithm, and header files with a first preset suffix and source files with a second preset suffix are selected to form a header file list and a source file list, respectively. The header file list, the source file list, and the external dependency library list in the project configuration information are integrated to form structured dependency information.

5. The method according to claim 1, characterized in that, The step of generating a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information includes: Based on the target operating system type in the target platform parameters, call the configuration template corresponding to the target operating system type; The project configuration information and the dependency information are dynamically written into the configuration template; Configure platform adaptation rules in the configuration template, adjust library file extensions, path separators, and compilation and linking parameters to generate a cross-platform compatible build configuration file.

6. The method according to claim 1, characterized in that, The process of performing a compilation and build operation based on the build configuration file to generate the target static library includes: The controller invokes a code quality inspection tool to perform static analysis on the target code in the output directory of the project configuration information to obtain the target code inspection results. If the target code detection result is qualified, the controller calls the cross-platform build execution tool to load the build configuration file; Based on the build configuration file and the target platform parameters, the appropriate compiler is invoked to perform the compilation and linking operation to generate the target static library.

7. The method according to claim 6, characterized in that, Also includes: If the target code detection result is unqualified, the compilation and build operation is terminated, and a quality inspection report is generated based on the target code detection result.

8. A static library cross-platform generation device, characterized in that, include: The data acquisition module is used to acquire matrix calculation algorithm files, project configuration information, and target platform parameters; The information extraction module is used to build the controller, call the matrix calculation code conversion tool to convert the initial code in the matrix calculation algorithm file into target code, and extract the dependency information corresponding to the target code. The static library generation module is used to generate a cross-platform compatible build configuration file based on the project configuration information, the target platform parameters, and the dependency information, and to perform a compilation and build operation based on the build configuration file to generate the target static library.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to the at least one processor; The memory stores a computer program that can be executed by the at least one processor, which is then executed by the at least one processor to enable the at least one processor to perform the static library cross-platform generation method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the static library cross-platform generation method according to any one of claims 1-7.