CN111552480A - Cross-platform compiling method, device, equipment and readable storage medium - Google Patents

Cross-platform compiling method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN111552480A
CN111552480A CN202010379488.9A CN202010379488A CN111552480A CN 111552480 A CN111552480 A CN 111552480A CN 202010379488 A CN202010379488 A CN 202010379488A CN 111552480 A CN111552480 A CN 111552480A
Authority
CN
China
Prior art keywords
compiling
platform
cross
information
parameters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010379488.9A
Other languages
Chinese (zh)
Other versions
CN111552480B (en
Inventor
伍万华
魏科
毛军
伍文彬
刘小菲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Best Control Technology Co ltd
Original Assignee
Shenzhen Best Control Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Best Control Technology Co ltd filed Critical Shenzhen Best Control Technology Co ltd
Priority to CN202010379488.9A priority Critical patent/CN111552480B/en
Publication of CN111552480A publication Critical patent/CN111552480A/en
Application granted granted Critical
Publication of CN111552480B publication Critical patent/CN111552480B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Abstract

The application discloses a cross-platform compiling method, a device, equipment and a readable storage medium, wherein the method comprises the steps of connecting a compiling tool chain with a development tool of a target platform to obtain compiling parameters of the development tool; determining a compiling running environment of the compiling tool chain according to the compiling parameters; and compiling the file to be compiled into a corresponding target file according to the compiling running environment. The method comprises the steps of connecting the compiling tool chain to a target platform, obtaining relevant compiling parameters in the target platform, and determining a corresponding compiling operation environment according to the corresponding compiling parameters, so that a corresponding file to be edited is compiled into a target file which can be operated in the target platform, extra operation of programmers is not needed, the programming difficulty of the programmers is reduced, the programming efficiency is improved, and meanwhile compatibility of different platforms is improved.

Description

Cross-platform compiling method, device, equipment and readable storage medium
Technical Field
The invention relates to the technical field of software development, in particular to a cross-platform compiling method, a cross-platform compiling device, a cross-platform compiling equipment and a readable medium.
Background
Different operating systems and different processors exist, and due to different running environments and different compiling parameters, a software developer needs to compile corresponding codes for different operating systems and different processors during programming so that the codes can run correctly. A large amount of labor and time are consumed for independently developing corresponding codes for different platforms, and the efficiency is low.
Disclosure of Invention
The present application mainly aims to provide a cross-platform compiling method, device, apparatus and readable storage medium, and aims to solve the problem of low compiling efficiency during cross-platform compiling.
In order to achieve the above object, the present application provides a cross-platform compiling method, including the following steps:
connecting a compiling tool chain with a development tool of a target platform to obtain compiling parameters of the development tool;
determining a compiling running environment of a compiling tool chain according to the compiling parameters;
and compiling the file to be compiled into a corresponding target file according to the compiling running environment.
Optionally, the step of connecting the compiling tool chain with the development tool of the target platform comprises:
creating a comprehensive environment library according to the fusion of the operating environments of the plurality of platforms;
writing the integrated environment library into the compilation toolchain.
Optionally, the step of obtaining the compiling parameter of the development tool includes:
reading a top-level directory of a development tool of the target platform;
reading corresponding module information according to the file content in the top-level directory;
and acquiring the compiling parameters of the development tool through the module information.
Optionally, the step of obtaining the compiling parameter of the development tool through the module information includes:
judging whether the module information contains multi-level module information or not;
if the module information contains multi-level module information, determining the terminal module information of the bottommost layer in the module information;
and acquiring the compiling parameters of the development tool according to the terminal module information.
Optionally, the step of determining a compiling running environment of the compiling tool chain according to the compiling parameter includes:
acquiring byte information, interface information and semantic information in the compiling parameters;
determining an initial compiling running environment in the compiling tool chain according to the interface information and the semantic information;
and adjusting the initial compiling and running environment as a final compiling and running environment according to the byte information.
Optionally, the compiling the file to be compiled into the corresponding target file according to the compiling running environment includes:
inquiring the compiling tool chain, and determining a target compiling library corresponding to the compiling parameters in the comprehensive environment library;
compiling the file to be compiled into a target file according to the final compiling and running environment and the target compiling library.
Optionally, the compiling the file to be compiled into the corresponding target file according to the compiling running environment includes:
if the sending operation is detected, acquiring receiving platform information in the sending operation;
and adjusting the file format of the target file according to the receiving platform.
The present application further provides a cross-platform compiling device, including:
the acquisition module is used for connecting the compiling tool chain with a development tool of a target platform and acquiring compiling parameters of the development tool;
the determining module is used for determining a compiling running environment of the compiling tool chain according to the compiling parameters;
and the compiling module is used for compiling the file to be compiled into a corresponding target file according to the compiling running environment.
The present application further provides a cross-platform compiling device, including: a memory, a processor, and a cross-platform compiler stored on the memory and executable on the processor, the cross-platform compiler, when executed by the processor, implementing the steps of the cross-platform compilation method as described above.
The present application also provides a readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the cross-platform compilation method as described above.
The method comprises the steps that a compiling tool chain is connected with a development tool of a target platform, and compiling parameters of the development tool are obtained; determining a compiling running environment of the compiling tool chain according to the compiling parameters; and compiling the file to be compiled into a corresponding target file according to the compiling running environment. The method comprises the steps of connecting the compiling tool chain to a target platform, obtaining relevant compiling parameters in the target platform, and determining a corresponding compiling operation environment according to the corresponding compiling parameters, so that a corresponding file to be edited is compiled into a target file which can be operated in the target platform, extra operation of a programmer is not needed, the programming difficulty of the programmer is reduced, the programming efficiency is improved, and compatibility of different platforms is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
Fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a cross-platform compiling method according to a first embodiment of the present application;
FIG. 3 is a flowchart illustrating a detailed process of step S10 in FIG. 2 according to a third embodiment of the cross-platform compiling method of the present application;
FIG. 4 is a flowchart illustrating a detailed process of step S20 in FIG. 2 according to a fourth embodiment of the cross-platform compiling method of the present application;
FIG. 5 is a flowchart of a fifth embodiment of the cross-platform compilation method according to the present application, which is a detailed flowchart of step S30 in FIG. 2;
fig. 6 is a schematic system structure diagram of an embodiment of a cross-platform compiling device according to the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for facilitating the explanation of the present invention, and have no specific meaning in itself. Thus, "module", "component" or "unit" may be used mixedly.
As shown in fig. 1, fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present application.
The terminal in the embodiment of the application is cross-platform compiling equipment.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Optionally, the terminal may further include a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WiFi module, and the like. Such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display screen according to the brightness of ambient light, and a proximity sensor that turns off the display screen and/or the backlight when the terminal device is moved to the ear. Of course, the terminal device may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which are not described herein again.
Those skilled in the art will appreciate that the terminal structure shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, the memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a cross-platform compiler program.
In the terminal shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to invoke the cross-platform compiler stored in the memory 1005 and perform the following operations:
connecting a compiling tool chain with a development tool of a target platform to obtain compiling parameters of the development tool;
determining a compiling running environment of the compiling tool chain according to the compiling parameters;
and compiling the file to be compiled into a corresponding target file according to the compiling running environment.
Based on the above terminal hardware structure, various embodiments of the present application are provided.
The application provides a cross-platform compiling method.
Referring to fig. 2, in a first embodiment of a cross-platform compilation method, the method comprises:
step S10, connecting the compiling tool chain with a development tool of a target platform to obtain compiling parameters of the development tool;
different execution environments may be required for the same content in different platforms. Meanwhile, because resources which can be utilized in different platforms are relatively few, various resources in a target environment to be operated by a compiled program are relatively limited, so that direct local compilation is difficult to perform, and cross compilation needs to be performed by using a compiling tool chain. The program compiled by one platform is recompiled or obtained by other methods through a compiling tool chain, and the program which can normally run on the target platform is obtained. And connecting the compiling tool chain with the development tool of the target platform, and acquiring the compiling parameters in the corresponding development tool after connection.
Step S20, determining the compiling running environment of the compiling tool chain according to the compiling parameters;
the compiling parameters are stored in the development environment in the form of compiling files at corresponding positions, and by the corresponding compiling parameters, the user can know how to compile file programs compiled on other platforms into programs capable of running in the target platform, and thus the compiling running environment in the compiling tool chain can be determined to be correspondingly adjusted. And meanwhile, the compiling file also stores a list, the dependency relationship of each module in the running environment and variables required by compiling options corresponding to each compiling tool in the compiling tool chain which can be changed by the development tool. Through the compiling parameters and variables, the corresponding compiling running environment can be obtained. Furthermore, the compiling and running environment further comprises a platform component corresponding to the target platform and configuration parameters of the platform component, and the configuration parameters of the platform component and the platform component are stored in a directory file of a corresponding file in a form of a header file.
Step S30, compiling the files to be compiled into corresponding target files according to the compiling running environment;
according to byte information in different operating environments, such as 32 bytes or 64 bytes, relevant byte information of a file to be compiled is correspondingly adjusted, corresponding interface information and semantic information corresponding to the compiling operating environment are obtained at the same time, and according to the corresponding interface and semantic information, how to recompile the corresponding file to be compiled is judged, if necessary, all the file to be compiled is recompiled according to the semantic, or only corresponding interface files need to be added, or any recompiling is not needed. Sometimes, the codes corresponding to all the operating environments of different platforms can be written into corresponding files, but this results in a more complex code of the program, and increases the burden of hardware, and in many cases, the hardware cannot complete corresponding compiling work as expected, and the efficiency and feasibility are low. Meanwhile, in the present application, the compiling tool chain may use an existing compiling tool chain, or may be a new compiling tool chain developed by a programmer.
In this embodiment, a compiling tool chain is connected with a development tool of a target platform, and compiling parameters of the development tool are acquired; determining a compiling running environment of the compiling tool chain according to the compiling parameters; and compiling the file to be compiled into a corresponding target file according to the compiling running environment. The method comprises the steps of connecting the compiling tool chain to a target platform, obtaining relevant compiling parameters in the target platform, and determining a corresponding compiling operation environment according to the corresponding compiling parameters, so that a corresponding file to be edited is compiled into a target file which can be operated in the target platform, extra operation of a programmer is not needed, the programming difficulty of the programmer is reduced, the programming efficiency is improved, and compatibility of different platforms is improved.
Further, on the basis of the above-mentioned embodiments, there is provided a second embodiment of the cross-platform compiling method, in which,
step S10 is preceded by:
step A1, creating a comprehensive environment library according to the running environment characteristics of a plurality of platforms;
at present, common platforms comprise android platforms, windows platforms, Linux platforms and the like, different running environments exist in different platforms, and it is unlikely that all the running environments are written into a compiling tool chain, so that a new comprehensive environment library is created by fusing corresponding running environment libraries through the running environment characteristics of different platforms on the basis of the running environment library of one of the platforms according to the characteristics of the running environments of the different platforms. For example, based on the bionic library of the Android platform, the core characteristics in the Linux platform are used as an improvement direction, part of hierarchical structures in some original environment libraries are deleted, a part of frames in the operating environment are deleted, and meanwhile, according to the characteristics of the operating environments of different platforms, the existence of corresponding mechanisms, such as an anonymous shared memory mechanism and a corresponding communication mechanism in the platform, is ensured. Meanwhile, the final library obtained by establishing a corresponding comprehensive environment library based on different libraries of different platforms also has corresponding differences.
Step A2, writing the integrated environment library into the compiling tool chain
And establishing the conditions of the comprehensive environment library into the used compiling tool chain according to the required running environment characteristics of different platforms, so that the subsequent compiling tool chain can find corresponding components and file contents from the comprehensive environment library conveniently.
In this embodiment, the obtained integrated environment library is added to the compilation tool chain to further improve the compatibility of the compilation tool chain in different platforms.
Further, referring to fig. 2 and 3, on the basis of the above-mentioned embodiments of the present application, a third embodiment of a cross-platform compiling method is provided, in which,
step S10 includes:
step S11, reading a top-level directory of the development tool of the target platform;
the development tool comprises different directory information, wherein the top-level directory information comprises corresponding information of different modules in the running environment, and the module information is corresponding module content called by the program during running.
Step S12, reading corresponding module information according to the file content in the top-level directory;
the file content of the top directory includes module information, and the module information is further divided into different levels of module information, generally, the top directory is divided into a first-level module information directory and a second-level module information directory, and each second-level module directory belongs to one first-level module information directory, but the first-level module information directory does not necessarily have a corresponding second-level module information directory. Meanwhile, the name of the second-level module information directory can be stored in the first-level module information directory, so that the corresponding dependency relationship can be conveniently searched.
Step S13, obtaining the compiling parameters of the development tool through the module information;
in the compiling process, different modules correspond to different functions, for each module, the corresponding file to be compiled needs to be compiled again according to the corresponding compiling parameters in the module information, and meanwhile, the compiling parameters in each module need to be ensured to be acquired, namely, for the first-level module without the second-level module information, the compiling parameters of the corresponding first-level module are acquired, and for the first-level module with the second-level module, the compiling parameter information in each corresponding second-level module is acquired.
Wherein, step S13 includes:
step B1, judging whether the module information contains multi-layer module information;
different module information may correspond to different sub-level directory information, because different modules may correspond to different functions or mechanisms, and corresponding sub-functions or corresponding subordinate mechanisms may exist under different functions or different mechanisms, the module information may include multi-level module information, that is, there are a plurality of different sub-level module information under one module information. Generally, module information is divided into two different levels of module information structures, and one module may contain one or more lower levels of module information.
Step B2, if the module information contains multi-layer module information, determining the terminal module information of the bottom layer in the module information;
when a module contains module information of multiple levels, that is, when a primary module has a corresponding secondary module or more levels of modules. Generally, the directory name information of the module of the next hierarchy is stored in the corresponding file content of the previous hierarchy, so that whether the current module has the module of the next hierarchy can be judged according to the corresponding file content. Starting from a first-level module, whether module information of a next level exists or not is determined by a traversal method, if the module information exists, whether a third-level module exists or not is determined by one of the second-level modules, and the like until the information of the bottom-most end module in each first-level module is found, wherein the information of the end module is information which needs to be compiled according to compiling parameters in the final compiling.
Step B3, obtaining the compiling parameters of the development tool according to the terminal module information;
when compiling is carried out, compiling is correspondingly carried out according to corresponding information of a final module, the final module is the terminal module at the bottommost layer, the terminal module does not have a corresponding sub-module, meanwhile, the levels of the corresponding terminal modules in different first-level modules are possibly different, if the terminal module is a third-level module, the terminal module is a fourth-level module. When compiling is required to be carried out according to the information of the end module, compiling parameters of a corresponding development tool are required to be obtained according to the end module. And if the current module does not contain the hierarchical module information, namely when no secondary module exists, the current module is the final module, and the compiling parameters of the development tool are directly obtained according to the current module information.
In this embodiment, the corresponding terminal module information is found through the module information in the development tool, and meanwhile, the compiling parameter of the development tool is obtained according to the terminal module information, and is supported by the corresponding parameter for the following compiling. .
Further, referring to fig. 2 and 4, on the basis of the above-mentioned embodiments of the present application, a fourth embodiment of a cross-platform compiling method is provided, in which,
step S20 includes:
step S21, acquiring byte information, interface information and semantic information in the compiling parameters;
the supported bytes in different platforms or processors may have different lengths, for example, 32 bits or 64 bits may be supported, but when there is a difference in bytes of a byte program, it may cause a hint that the program runs on different platforms erroneously and cannot run accurately, and in general, there is a difference in interface information that can be called in different platforms, and a corresponding function module is called through an interface, but because some modules may be publicly available for corresponding code calling in different platforms, and some modules may not be called directly or may not be called at all, the interface information is very important, and similarly, because the specifications made in different platforms are different, semantics of the same content in different platforms may be different, and thus, corresponding semantic information of the current platform needs to be obtained in a compiling process.
Step S22, determining an initial compiling and running environment in the compiling tool chain according to the interface information and the semantic information;
step S23, according to the byte information, adjusting the initial compiling and running environment as a final compiling and running environment;
in the compiling tool chain, the compiling tool chain comprises a comprehensive environment library, the comprehensive environment library comprises libraries corresponding to different platforms or a library rewritten according to a basic library of one of the platforms, an initial compiling running environment which can be matched with the compiling information in the compiling tool chain is found according to the interface information and the semantic information, and then the initial compiling running environment is adjusted according to the byte information to obtain a final compiling running environment.
In this embodiment, the matched compiling running environment is determined through the byte information, the interface information and the semantic information, so that the program in the compiling process and after the compiling is completed can be normally used on the corresponding platform.
Further, referring to fig. 2 and 5, on the basis of the above-mentioned embodiments of the present application, a fifth embodiment of a cross-platform compiling method is provided, in which,
step S30 includes:
step S31, inquiring the compiling tool chain, and determining a target compiling library corresponding to the compiling parameters in the comprehensive environment library;
processing according to the difference and the difference of the interface information and the semantic information, wherein the interface and the semantic are consistent, and a corresponding library is directly called; secondly, if the interfaces are inconsistent, corresponding realization is required according to the contents of the library in the corresponding operating environment; thirdly, if the interfaces are consistent but the semantics are inconsistent, rewriting is performed according to the current operating environment correspondingly, and the corresponding replacement is performed on the content in the file to be compiled according to the corresponding semantic replacement mapping relation, so that the consistency of various functions of the program is ensured.
Step S32, compiling the file to be compiled into a target file according to the final compiling running environment and the target compiling library;
meanwhile, variables in the file to be compiled need to be correspondingly recompiled according to the byte information, so that the situation that a compiling error occurs or an error result is obtained due to the byte number of the variables when a corresponding program runs because the byte number does not correspond is avoided.
In this embodiment, the corresponding file to be compiled is recompiled according to the compiling information, so as to ensure that the file to be compiled can run correctly on the target platform.
Further, on the basis of the above embodiments of the present application, a sixth embodiment of the cross-platform compiling method is provided, in which,
step S30 is followed by:
step C1, if the sending operation is detected, obtaining the receiving platform information in the sending operation;
step C2, according to the receiving platform, adjusting the file format of the target file;
when the generated target file needs to be sent, after all files to be compiled are compiled and corresponding target files are generated, the target files are respectively processed according to the difference of the sent and received operating system platforms, and for the operating platform such as a Linux operating platform which does not need to be compiled and linked with the operating platform, the target files only need to be linked to generate a final executable application program; for the object files which need to be compiled and linked with the operation platform, the compiled object files are library files of all modules, and secondary development can be realized only by outputting the module library files to the corresponding object operation platform as external reference library files. Particularly, if the target operating platform of the project is open-source, the source code of the operating platform only needs to be existed in the development environment as one or more modules, and the finally generated target file, including the corresponding library file of the used operating platform, is compiled and linked together to generate the final executable image file.
In this embodiment, whether a new module library file needs to be added is determined according to different target platforms, and a real complete executable file is finally obtained.
In addition, referring to fig. 6, an embodiment of the present application further provides a cross-platform compiling apparatus, where the cross-platform compiling apparatus includes:
the acquisition module is used for connecting the compiling tool chain with a development tool of a target platform and acquiring compiling parameters of the development tool;
the determining module is used for determining a compiling running environment of the compiling tool chain according to the compiling parameters;
and the compiling module is used for compiling the file to be compiled into a corresponding target file according to the compiling running environment.
Optionally, the cross-platform compiling apparatus further includes:
the creating module is used for fusing the operating environment characteristics of the platforms to create a comprehensive environment library;
and the compiling module is used for compiling the comprehensive environment library into the compiling tool chain.
Optionally, the obtaining module is further configured to:
reading a top-level directory of a development tool of the target platform;
reading corresponding module information according to the file content in the top-level directory;
and acquiring the compiling parameters of the development tool through the module information.
Optionally, the obtaining module is further configured to:
judging whether the module information contains multi-level module information or not;
if the module information contains multi-level module information, determining the terminal module information of the bottommost layer in the module information;
and acquiring the compiling parameters of the development tool according to the terminal module information.
Optionally, the determining module is further configured to:
acquiring byte information, interface information and semantic information in the compiling parameters;
determining an initial compiling running environment in the compiling tool chain according to the interface information and the semantic information;
and adjusting the initial compiling and running environment as a final compiling and running environment according to the byte information.
Optionally, the compiling module is further configured to:
inquiring the compiling tool chain, and determining a target compiling library corresponding to the compiling parameters in the comprehensive environment library;
compiling the file to be compiled into a target file according to the final compiling and running environment and the target compiling library.
Optionally, the cross-platform compiling apparatus further includes:
the second acquisition module is used for acquiring receiving platform information in the sending operation if the sending operation is detected;
and the adjusting module is used for adjusting the file format of the target file according to the receiving platform.
The specific implementation of the apparatus and the readable storage medium (i.e., the computer readable storage medium) of the present application is basically the same as that of the foregoing embodiments of the cross-platform compiling method, and therefore, the details are not repeated here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A cross-platform compilation method, comprising the steps of:
connecting a compiling tool chain with a development tool of a target platform to obtain compiling parameters of the development tool;
determining a compiling running environment of the compiling tool chain according to the compiling parameters;
and compiling the file to be compiled into a corresponding target file according to the compiling running environment.
2. The cross-platform compilation method of claim 1 wherein the step of linking the compilation tool chain with a development tool of the target platform is preceded by:
creating a comprehensive environment library according to the fusion of the operating environment characteristics of a plurality of platforms;
writing the integrated environment library into the compilation toolchain.
3. The cross-platform compilation method of claim 2 wherein the step of obtaining compilation parameters for the development tool comprises:
reading a top-level directory of a development tool of the target platform;
reading corresponding module information according to the file content in the top-level directory;
and acquiring the compiling parameters of the development tool through the module information.
4. The cross-platform compiling method according to claim 3 wherein the step of obtaining the compiling parameters of the development tool through the module information comprises:
judging whether the module information contains multi-level module information or not;
if the module information contains multi-level module information, determining the terminal module information of the bottommost layer in the module information;
and acquiring the compiling parameters of the development tool according to the terminal module information.
5. The cross-platform compilation method of claim 4 wherein the step of determining a compilation runtime environment for the compilation toolchain based on the compilation parameters comprises:
acquiring byte information, interface information and semantic information in the compiling parameters;
determining an initial compiling running environment in the compiling tool chain according to the interface information and the semantic information;
and adjusting the initial compiling and running environment as a final compiling and running environment according to the byte information.
6. The cross-platform compilation method of claim 5, wherein compiling the file to be compiled into the corresponding target file according to the compilation runtime environment comprises:
inquiring the compiling tool chain, and determining a target compiling library corresponding to the compiling parameters in the comprehensive environment library;
compiling the file to be compiled into a target file according to the final compiling and running environment and the target compiling library.
7. The cross-platform compilation method of claim 6, wherein compiling the file to be compiled into the corresponding target file according to the compilation runtime environment is followed by:
if the sending operation is detected, acquiring receiving platform information in the sending operation;
and adjusting the file format of the target file according to the receiving platform.
8. A cross-platform compilation apparatus, comprising:
the acquisition module is used for connecting the compiling tool chain with a development tool of a target platform and acquiring compiling parameters of the development tool;
the determining module is used for determining a compiling running environment of the compiling tool chain according to the compiling parameters;
and the compiling module is used for compiling the file to be compiled into a corresponding target file according to the compiling running environment.
9. A cross-platform compilation device, the cross-platform compilation device comprising: a memory, a processor, and a cross-platform compiler stored on the memory and executable on the processor, the cross-platform compiler when executed by the processor implementing the steps of the cross-platform compilation method of any of claims 1 to 7.
10. A readable storage medium, having stored thereon a computer program which, when executed by a processor, implements the steps of a cross-platform compilation method according to any one of claims 1 to 7.
CN202010379488.9A 2020-05-07 2020-05-07 Cross-platform compiling method, device, equipment and readable storage medium Active CN111552480B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010379488.9A CN111552480B (en) 2020-05-07 2020-05-07 Cross-platform compiling method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010379488.9A CN111552480B (en) 2020-05-07 2020-05-07 Cross-platform compiling method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN111552480A true CN111552480A (en) 2020-08-18
CN111552480B CN111552480B (en) 2021-06-25

Family

ID=72004455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010379488.9A Active CN111552480B (en) 2020-05-07 2020-05-07 Cross-platform compiling method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111552480B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434146A (en) * 2021-06-22 2021-09-24 青岛海尔科技有限公司 Code compiling method, device, storage medium and electronic device
CN113485709A (en) * 2021-06-15 2021-10-08 荣耀终端有限公司 Application optimization method and device and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130339928A1 (en) * 2012-06-18 2013-12-19 Microsoft Corporation Adaptive portable libraries
CN109151609A (en) * 2018-09-25 2019-01-04 青岛海信电器股份有限公司 A kind of the subtitle methods of exhibiting and its device of compatible different platform
CN110727423A (en) * 2018-07-16 2020-01-24 声达资讯股份有限公司 Method and system for developing mobile application program across platforms
CN111061489A (en) * 2019-12-27 2020-04-24 上海米哈游天命科技有限公司 Multi-platform compiling detection method, device, equipment and medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130339928A1 (en) * 2012-06-18 2013-12-19 Microsoft Corporation Adaptive portable libraries
CN110727423A (en) * 2018-07-16 2020-01-24 声达资讯股份有限公司 Method and system for developing mobile application program across platforms
CN109151609A (en) * 2018-09-25 2019-01-04 青岛海信电器股份有限公司 A kind of the subtitle methods of exhibiting and its device of compatible different platform
CN111061489A (en) * 2019-12-27 2020-04-24 上海米哈游天命科技有限公司 Multi-platform compiling detection method, device, equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485709A (en) * 2021-06-15 2021-10-08 荣耀终端有限公司 Application optimization method and device and electronic equipment
CN113434146A (en) * 2021-06-22 2021-09-24 青岛海尔科技有限公司 Code compiling method, device, storage medium and electronic device

Also Published As

Publication number Publication date
CN111552480B (en) 2021-06-25

Similar Documents

Publication Publication Date Title
CN106775723B (en) Android platform-based system firmware customization method and Android device
US9608893B2 (en) Methods and systems for parsing data objects
US7155381B2 (en) Module for developing wireless device applications using an integrated emulator
US9086931B2 (en) System for translating diverse programming languages
US10331425B2 (en) Automated source code adaption to inject features between platform versions
US20090064196A1 (en) Model based device driver code generation
US8122440B1 (en) Method and apparatus for enumerating external program code dependencies
US20150242194A1 (en) System for Translating Diverse Programming Languages
US20030236657A1 (en) Method of developing wireless device applications using an integrated emulator and an IDE
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
US8881123B2 (en) Enabling symbol resolution of private symbols in legacy programs and optimizing access to the private symbols
CN111552480B (en) Cross-platform compiling method, device, equipment and readable storage medium
CN112612502A (en) Patch generation method, device, equipment and storage medium
CN112818176B (en) Data processing method, device, equipment and storage medium
RU2347269C2 (en) System and method of declarative definition and use of subclasses in marking
CN115794214B (en) Application module metadata management method, device, storage medium and apparatus
CN114721647B (en) Object-oriented programming method based on codeless application development
CN111880801A (en) Application program dynamic method and device and electronic equipment
US9747085B2 (en) Source code generation from prototype source
CN114816475A (en) Method, device, equipment and medium for updating embedded operating system
CN114489653A (en) Compiler-based data processing method, compiler-based data processing device and readable storage medium
CN116243971B (en) Static dependency bootstrapping-based kernel-independent module construction method
CN113656036B (en) Compiling method, device, terminal and medium based on Mybatis
CN116360779B (en) Method for constructing micro front end base based on qiankun in Vue CLI application
JPH11272475A (en) Automatic re-entrant method for non-re-entrant program and system therefor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant