[go: up one dir, main page]

CN118838603A - Data processing method, device, equipment and medium applied to cross compiling - Google Patents

Data processing method, device, equipment and medium applied to cross compiling Download PDF

Info

Publication number
CN118838603A
CN118838603A CN202411312841.6A CN202411312841A CN118838603A CN 118838603 A CN118838603 A CN 118838603A CN 202411312841 A CN202411312841 A CN 202411312841A CN 118838603 A CN118838603 A CN 118838603A
Authority
CN
China
Prior art keywords
file
header
configuration
name
absolute path
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
CN202411312841.6A
Other languages
Chinese (zh)
Other versions
CN118838603B (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.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202411312841.6A priority Critical patent/CN118838603B/en
Publication of CN118838603A publication Critical patent/CN118838603A/en
Application granted granted Critical
Publication of CN118838603B publication Critical patent/CN118838603B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation
    • G06F16/166File name conversion
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

本申请公开了一种应用于交叉编译的数据处理方法、装置、设备及介质,用以解决目前交叉编译过程中存在的大小写不兼容问题,提高交叉编译成功率。所述方法,包括:获取配置文件,所述配置文件是在第一平台中基于第二平台的配置构建的;针对所述配置文件中待编译源文件所依赖的每个头文件,分别执行以下操作,得到更新后的配置文件:确定所述头文件的绝对路径,若在所述绝对路径中未搜索到所述头文件,则忽略所述头文件文件名称中字符的大小写格式重新搜索,在搜索到目标文件时,利用所述目标文件的文件名称替换所述配置文件中所述头文件的文件名称。

The present application discloses a data processing method, device, equipment and medium for cross-compilation, which is used to solve the case incompatibility problem existing in the current cross-compilation process and improve the success rate of cross-compilation. The method includes: obtaining a configuration file, which is constructed in a first platform based on the configuration of a second platform; for each header file in the configuration file that the source file to be compiled depends on, performing the following operations respectively to obtain an updated configuration file: determining the absolute path of the header file, if the header file is not searched in the absolute path, ignoring the case format of the characters in the file name of the header file and searching again, and when the target file is searched, using the file name of the target file to replace the file name of the header file in the configuration file.

Description

应用于交叉编译的数据处理方法、装置、设备及介质Data processing method, device, equipment and medium for cross-compilation

技术领域Technical Field

本申请涉及计算机技术领域,尤其涉及一种应用于交叉编译的数据处理方法、装置、设备及介质。The present application relates to the field of computer technology, and in particular to a data processing method, device, equipment and medium for cross-compilation.

背景技术Background Art

随着计算机行业的飞速发展,计算机上出现了各种不同的硬件平台,受限于硬件资源,某些硬件平台不能直接编译程序,所以就需要在其他平台进行交叉编译。With the rapid development of the computer industry, various hardware platforms have appeared on computers. Due to limited hardware resources, some hardware platforms cannot compile programs directly, so cross-compilation is required on other platforms.

交叉编译,就是在一个源平台上编译出能在另一源平台上运行的可执行文件或库。在交叉编译的过程中,需要查找对应依赖的头文件,如果依赖的头文件和命令行查找到的头文件,二者名称的大小写不同,那么编译就会报错,提示找不到对应头文件。举例来说,在Linux环境下编译Windows环境的库,因为Linux中的文件名称区分大小写,但是Windows中的文件名称不区分大小写,那么编译过程中就可能会出现上述编译报错的问题。Cross-compilation is to compile an executable file or library on one source platform that can run on another source platform. During the cross-compilation process, you need to find the corresponding dependent header file. If the name of the dependent header file and the header file found by the command line are different in capital letters, the compilation will report an error, indicating that the corresponding header file cannot be found. For example, when compiling a library for the Windows environment in a Linux environment, because file names in Linux are case-sensitive, but file names in Windows are not case-sensitive, the above compilation error may occur during the compilation process.

因此,跨平台交叉编译过程中出现的大小写兼容性问题,是目前亟待解决的问题。Therefore, the case compatibility issue that arises during cross-platform cross-compilation is an issue that needs to be solved urgently.

发明内容Summary of the invention

本申请实施例提供了一种应用于交叉编译的数据处理方法、装置、设备及介质,用以解决目前交叉编译过程中存在的大小写不兼容问题,提高交叉编译成功率。The embodiments of the present application provide a data processing method, apparatus, device and medium for cross-compilation, so as to solve the case incompatibility problem existing in the current cross-compilation process and improve the success rate of cross-compilation.

本申请实施例提供的一种应用于交叉编译的数据处理方法,包括:An embodiment of the present application provides a data processing method for cross-compilation, including:

获取配置文件,所述配置文件是在第一平台中基于第二平台的配置构建的;Obtaining a configuration file, where the configuration file is constructed in the first platform based on the configuration of the second platform;

针对所述配置文件中待编译源文件所依赖的每个头文件,分别执行以下操作,得到更新后的配置文件:确定所述头文件的绝对路径,若在所述绝对路径中未搜索到所述头文件,则忽略所述头文件文件名称中字符的大小写格式重新搜索,在搜索到目标文件时,利用所述目标文件的文件名称替换所述配置文件中所述头文件的文件名称。For each header file in the configuration file that the source file to be compiled depends on, the following operations are performed to obtain an updated configuration file: the absolute path of the header file is determined; if the header file is not found in the absolute path, the case of the characters in the header file name is ignored and the search is performed again; when the target file is found, the file name of the target file is used to replace the file name of the header file in the configuration file.

本申请实施例,在交叉编译过程中,获取配置文件之后,针对配置文件中待编译源文件所依赖的每个头文件,首先确定头文件的绝对路径,然后基于头文件的绝对路径搜索头文件,若在绝对路径中未搜索到头文件,则确定此头文件存在大小写不兼容的问题,此时忽略头文件文件名称中字符的大小写格式重新搜索,在搜索到目标文件时,利用目标文件的文件名称替换配置文件中头文件的文件名称,得到更新后的配置文件。In an embodiment of the present application, during the cross-compilation process, after obtaining the configuration file, for each header file in the configuration file that the source file to be compiled depends on, first determine the absolute path of the header file, and then search for the header file based on the absolute path of the header file. If the header file is not found in the absolute path, it is determined that there is a case incompatibility problem in this header file. At this time, ignore the case format of the characters in the header file name and search again. When the target file is searched, use the file name of the target file to replace the file name of the header file in the configuration file to obtain an updated configuration file.

通过利用目标文件的文件名称替换配置文件中头文件的文件名称,使得配置文件中存在大小写不兼容问题的头文件名称均被替换,相比现有技术,能够解决交叉编译过程中存在的大小写不兼容问题,避免交叉编译过程中因平台差异导致的头文件大小写不兼容,提高交叉编译成功率。By replacing the file name of the header file in the configuration file with the file name of the target file, all header file names with case incompatibility problems in the configuration file are replaced. Compared with the existing technology, this can solve the case incompatibility problem in the cross-compilation process, avoid the case incompatibility of header files caused by platform differences in the cross-compilation process, and improve the success rate of cross-compilation.

在一些实施例中,所述获取配置文件,包括:In some embodiments, obtaining the configuration file includes:

在第一平台中,获取待编译工程文件;In the first platform, obtain the project file to be compiled;

使用预设命令对所述待编译工程文件进行处理,基于所述第二平台的配置构建工程文件目录;Using a preset command to process the project file to be compiled, and constructing a project file directory based on the configuration of the second platform;

从所述工程文件目录中搜索所述配置文件。The configuration file is searched from the project file directory.

在一些实施例中,所述从所述工程文件目录中搜索所述配置文件,包括:In some embodiments, searching the configuration file from the project file directory includes:

在所述工程文件目录中搜索文件名称为第一预设名称的文件;Searching the project file directory for a file with a first preset name;

若搜索到文件名称为所述第一预设名称的文件,且文件内容不为空,则将文件名称为所述第一预设名称的文件确定为所述配置文件;或者If a file with the first preset name is found and the file content is not empty, the file with the first preset name is determined as the configuration file; or

若搜索到文件名称为所述第一预设名称的文件,且文件内容为空,则在所述工程文件目录中搜索文件名称为第二预设名称的文件,并将搜索到的文件名称为所述第二预设名称的文件确定为所述配置文件。If a file named with the first preset name is found and the file content is empty, a file named with the second preset name is searched in the project file directory, and the found file named with the second preset name is determined as the configuration file.

在一些实施例中,将文件名称为所述第一预设名称的文件确定为所述配置文件时,所述确定所述头文件的绝对路径,包括:In some embodiments, when a file named with the first preset name is determined as the configuration file, determining the absolute path of the header file includes:

对所述配置文件进行解析,从所述配置文件中分离出每个头文件的信息;Parsing the configuration file, and separating information of each header file from the configuration file;

依据预先获取的所述配置文件的绝对路径和所述每个头文件的信息,确定每个头文件的绝对路径。The absolute path of each header file is determined according to the pre-acquired absolute path of the configuration file and the information of each header file.

在一些实施例中,所述依据预先获取的所述配置文件的绝对路径和所述每个头文件的信息,确定每个头文件的绝对路径,包括:In some embodiments, determining the absolute path of each header file based on the pre-acquired absolute path of the configuration file and the information of each header file includes:

从所述每个头文件的地址信息中,获取每个头文件相对于所述配置文件所在文件夹的相对路径;Obtaining, from the address information of each header file, a relative path of each header file relative to the folder where the configuration file is located;

拼接所述配置文件的绝对路径和所述相对路径,得到所述头文件的绝对路径。The absolute path of the configuration file and the relative path are concatenated to obtain the absolute path of the header file.

在一些实施例中,将文件名称为所述第二预设名称的文件确定为所述配置文件时,所述确定所述头文件的绝对路径,包括:In some embodiments, when a file named as the second preset name is determined as the configuration file, determining the absolute path of the header file includes:

对所述配置文件进行解析,从所述配置文件中解析出依赖文件的相对路径,所述依赖文件包含待编译源文件依赖的头文件信息;Parsing the configuration file, parsing the relative path of the dependent file from the configuration file, the dependent file containing header file information that the source file to be compiled depends on;

依据预先获取的所述配置文件的绝对路径和所述依赖文件的相对路径,确定所述依赖文件的绝对路径;Determine the absolute path of the dependent file according to the pre-acquired absolute path of the configuration file and the relative path of the dependent file;

根据所述依赖文件的绝对路径,获取所述依赖文件,并从所述依赖文件包含的头文件信息中,获取每个头文件的绝对路径。According to the absolute path of the dependent file, the dependent file is obtained, and the absolute path of each header file is obtained from the header file information included in the dependent file.

在一些实施例中,所述方法还包括:In some embodiments, the method further comprises:

基于所述更新后的配置文件进行编译,生成可执行文件或者库。Compile based on the updated configuration file to generate an executable file or a library.

相应地,本申请实施例提供一种应用于交叉编译的数据处理装置,所述装置包括:Accordingly, an embodiment of the present application provides a data processing device for cross-compilation, the device comprising:

获取单元,用于获取配置文件,所述配置文件是在第一平台中基于第二平台的配置构建的;An acquisition unit, configured to acquire a configuration file, wherein the configuration file is constructed in the first platform based on the configuration of the second platform;

处理单元,用于针对所述配置文件中待编译源文件所依赖的每个头文件,分别执行以下操作,得到更新后的配置文件:确定所述头文件的绝对路径,若在所述绝对路径中未搜索到所述头文件,则忽略所述头文件文件名称中字符的大小写格式重新搜索,在搜索到目标文件时,利用所述目标文件的文件名称替换所述配置文件中所述头文件的文件名称。The processing unit is used to perform the following operations for each header file on which the source file to be compiled in the configuration file depends, so as to obtain an updated configuration file: determining the absolute path of the header file, and if the header file is not found in the absolute path, ignoring the case format of the characters in the file name of the header file and searching again, and when the target file is found, replacing the file name of the header file in the configuration file with the file name of the target file.

在一些实施例中,所述获取单元,具体用于:In some embodiments, the acquisition unit is specifically used to:

在第一平台中,获取待编译工程文件;In the first platform, obtain the project file to be compiled;

使用预设命令对所述待编译工程文件进行处理,基于所述第二平台的配置构建工程文件目录;Using a preset command to process the project file to be compiled, and constructing a project file directory based on the configuration of the second platform;

从所述工程文件目录中搜索所述配置文件。The configuration file is searched from the project file directory.

在一些实施例中,所述获取单元,具体用于:In some embodiments, the acquisition unit is specifically used to:

在所述工程文件目录中搜索文件名称为第一预设名称的文件;Searching the project file directory for a file with a first preset name;

若搜索到文件名称为所述第一预设名称的文件,且文件内容不为空,则将文件名称为所述第一预设名称的文件确定为所述配置文件;或者If a file with the first preset name is found and the file content is not empty, the file with the first preset name is determined as the configuration file; or

若搜索到文件名称为所述第一预设名称的文件,且文件内容为空,则在所述工程文件目录中搜索文件名称为第二预设名称的文件,并将搜索到的文件名称为所述第二预设名称的文件确定为所述配置文件。If a file named with the first preset name is found and the file content is empty, a file named with the second preset name is searched in the project file directory, and the found file named with the second preset name is determined as the configuration file.

在一些实施例中,所述处理单元,具体用于:In some embodiments, the processing unit is specifically configured to:

将文件名称为所述第一预设名称的文件确定为所述配置文件时,对所述配置文件进行解析,从所述配置文件中分离出每个头文件的信息;When a file named with the first preset name is determined as the configuration file, the configuration file is parsed to separate information of each header file from the configuration file;

依据预先获取的所述配置文件的绝对路径和所述每个头文件的信息,确定每个头文件的绝对路径。The absolute path of each header file is determined according to the pre-acquired absolute path of the configuration file and the information of each header file.

在一些实施例中,所述处理单元,具体用于:In some embodiments, the processing unit is specifically configured to:

从所述每个头文件的地址信息中,获取每个头文件相对于所述配置文件所在文件夹的相对路径;Obtaining, from the address information of each header file, a relative path of each header file relative to the folder where the configuration file is located;

拼接所述配置文件的绝对路径和所述相对路径,得到所述头文件的绝对路径。The absolute path of the configuration file and the relative path are concatenated to obtain the absolute path of the header file.

在一些实施例中,所述处理单元,具体用于:In some embodiments, the processing unit is specifically configured to:

将文件名称为所述第二预设名称的文件确定为所述配置文件时,对所述配置文件进行解析,从所述配置文件中解析出依赖文件的相对路径,所述依赖文件包含待编译源文件依赖的头文件信息;When a file named with the second preset name is determined as the configuration file, the configuration file is parsed to obtain a relative path of a dependent file from the configuration file, wherein the dependent file includes header file information on which the source file to be compiled depends;

依据预先获取的所述配置文件的绝对路径和所述依赖文件的相对路径,确定所述依赖文件的绝对路径;Determine the absolute path of the dependent file according to the pre-acquired absolute path of the configuration file and the relative path of the dependent file;

根据所述依赖文件的绝对路径,获取所述依赖文件,并从所述依赖文件包含的头文件信息中,获取每个头文件的绝对路径。According to the absolute path of the dependent file, the dependent file is obtained, and the absolute path of each header file is obtained from the header file information included in the dependent file.

在一些实施例中,所述装置还包括:In some embodiments, the apparatus further comprises:

编译单元,用于基于所述更新后的配置文件进行编译,生成可执行文件或者库。The compiling unit is used to compile based on the updated configuration file to generate an executable file or a library.

本申请另一实施例提供了一种电子设备,其包括存储器和处理器,其中,所述存储器用于存储程序指令,所述处理器用于调用所述存储器中存储的程序指令,按照获得的程序执行上述任一种方法。Another embodiment of the present application provides an electronic device, which includes a memory and a processor, wherein the memory is used to store program instructions, and the processor is used to call the program instructions stored in the memory and execute any of the above methods according to the obtained program.

本申请另一实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令用于使所述计算机执行上述任一种方法。Another embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute any of the above methods.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅是本申请的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

图1为本申请实施例提供的一种数据处理方法的流程示意图;FIG1 is a schematic diagram of a flow chart of a data processing method provided in an embodiment of the present application;

图2为本申请实施例提供的一种depend.make文件的文件内容示意图;FIG2 is a schematic diagram of the file contents of a depend.make file provided in an embodiment of the present application;

图3为本申请实施例提供的一种DependInfo.cmake文件的文件内容示意图;FIG3 is a schematic diagram of the file contents of a DependInfo.cmake file provided in an embodiment of the present application;

图4为本申请实施例提供的另一depend.make文件的文件内容示意图;FIG4 is a schematic diagram of the file contents of another depend.make file provided in an embodiment of the present application;

图5为本申请实施例提供的一种头文件信息的示意图;FIG5 is a schematic diagram of header file information provided in an embodiment of the present application;

图6为本申请实施例提供的一种配置文件为depend.make文件时具体数据处理过程的流程示意图;FIG6 is a flowchart of a specific data processing process when a configuration file provided by an embodiment of the present application is a depend.make file;

图7为本申请实施例提供的另一DependInfo.cmake文件的文件内容示意图;FIG7 is a schematic diagram of the file contents of another DependInfo.cmake file provided in an embodiment of the present application;

图8为本申请实施例提供的一种依赖文件信息的示意图;FIG8 is a schematic diagram of dependent file information provided in an embodiment of the present application;

图9为本申请实施例提供的一种依赖文件的文件内容的示意图;FIG9 is a schematic diagram of the file content of a dependent file provided in an embodiment of the present application;

图10为本申请实施例提供的一种配置文件为DependInfo.cmake文件时具体数据处理过程的流程示意图;10 is a flowchart of a specific data processing process when a configuration file provided in an embodiment of the present application is a DependInfo.cmake file;

图11为本申请实施例提供的一种交叉编译的具体实施过程的流程示意图;FIG11 is a flow chart of a specific implementation process of a cross-compilation provided in an embodiment of the present application;

图12为本申请实施例提供的一种数据处理装置的结构示意图;FIG12 is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application;

图13为本申请实施例提供的一种电子设备的结构示意图。FIG. 13 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,并不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

本申请实施例提供了一种应用于交叉编译的数据处理方法、装置、设备及介质,用以解决目前交叉编译过程中存在的大小写不兼容问题,提高交叉编译成功率。The embodiments of the present application provide a data processing method, apparatus, device and medium for cross-compilation, so as to solve the case incompatibility problem existing in the current cross-compilation process and improve the success rate of cross-compilation.

其中,方法和装置、设备、介质是基于同一申请构思的,由于方法和装置、设备、介质解决问题的原理相似,因此装置、设备、介质和方法的实施可以相互参见,重复之处不再赘述。Among them, the method and the device, equipment, and medium are based on the same application concept. Since the principles of solving problems by the method and the device, equipment, and medium are similar, the implementation of the device, equipment, medium, and method can refer to each other, and the repeated parts will not be repeated.

本申请实施例的说明书和权利要求书及上述附图中的术语“第一”、“第二”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括” 和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", etc. (if any) in the specification and claims of the embodiments of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

以下示例和实施例将只被理解为是说明性的示例。虽然本说明书可能在若干处提及“一”、 “一个”或“一些”示例或实施例,但这并非意味着每个这种提及都与相同的示例或实施例有关,也并非意味着该特征仅适用于单个示例或实施例。不同实施例的单个特征也可以被组合以提供其他实施例。此外,如“包括”和“包含”的术语应被理解为并不将所描述的实施例限制为仅由已提及的那些特征组成;这种示例和实施例还可以包含并未具体提及的特征、结构、单元、模块等。The following examples and embodiments are to be understood as illustrative examples only. Although this specification may refer to "one", "an" or "some" examples or embodiments in several places, this does not mean that each such reference relates to the same example or embodiment, nor does it mean that the feature applies only to a single example or embodiment. Individual features of different embodiments may also be combined to provide other embodiments. In addition, terms such as "including" and "comprising" should be understood as not limiting the described embodiments to consist only of those features that have been mentioned; such examples and embodiments may also include features, structures, units, modules, etc. that are not specifically mentioned.

下面结合说明书附图对本申请各个实施例进行详细描述。需要说明的是,本申请实施例的展示顺序仅代表实施例的先后顺序,并不代表实施例所提供的技术方案的优劣。The following is a detailed description of each embodiment of the present application in conjunction with the accompanying drawings. It should be noted that the display order of the embodiments of the present application only represents the order of the embodiments, and does not represent the advantages and disadvantages of the technical solutions provided by the embodiments.

随着计算机行业的飞速发展,计算机上出现了各种不同的硬件平台,受限于硬件资源,某些硬件平台不能直接编译程序,所以就需要在其他平台进行交叉编译。With the rapid development of the computer industry, various hardware platforms have appeared on computers. Due to limited hardware resources, some hardware platforms cannot compile programs directly, so cross-compilation is required on other platforms.

交叉编译,就是在一个源平台上编译出能在另一源平台上运行的可执行文件或库。在交叉编译的过程中,需要查找对应依赖的头文件,如果依赖的头文件和命令行查找到的头文件,二者名称的大小写不同,那么编译就会报错,提示找不到对应头文件。举例来说,在Linux环境下编译Windows环境的库,因为Linux中的文件名称区分大小写,但是Windows中的文件名称不区分大小写,那么编译过程中就可能会出现上述编译报错的问题。Cross-compilation is to compile an executable file or library on one source platform that can run on another source platform. During the cross-compilation process, you need to find the corresponding dependent header file. If the name of the dependent header file and the header file found by the command line are different in capital letters, the compilation will report an error, indicating that the corresponding header file cannot be found. For example, when compiling a library for the Windows environment in a Linux environment, because file names in Linux are case-sensitive, but file names in Windows are not case-sensitive, the above compilation error may occur during the compilation process.

因此,跨平台交叉编译过程中出现的大小写兼容性问题,是目前亟待解决的问题。Therefore, the case compatibility issue that arises during cross-platform cross-compilation is an issue that needs to be solved urgently.

本申请实施例,在交叉编译过程中,获取配置文件之后,针对配置文件中待编译源文件所依赖的每个头文件,首先确定头文件的绝对路径,然后基于头文件的绝对路径搜索头文件,若在绝对路径中未搜索到头文件,则确定此头文件存在大小写不兼容的问题,此时忽略头文件文件名称中字符的大小写格式重新搜索,在搜索到目标文件时,利用目标文件的文件名称替换配置文件中头文件的文件名称,得到更新后的配置文件。In an embodiment of the present application, during the cross-compilation process, after obtaining the configuration file, for each header file in the configuration file that the source file to be compiled depends on, first determine the absolute path of the header file, and then search for the header file based on the absolute path of the header file. If the header file is not found in the absolute path, it is determined that there is a case incompatibility problem in this header file. At this time, ignore the case format of the characters in the header file name and search again. When the target file is searched, use the file name of the target file to replace the file name of the header file in the configuration file to obtain an updated configuration file.

通过利用目标文件的文件名称替换配置文件中头文件的文件名称,使得配置文件中存在大小写不兼容问题的头文件名称均被替换,相比现有技术,能够解决交叉编译过程中存在的大小写不兼容问题,避免交叉编译过程中因平台差异导致的头文件大小写不兼容,提高交叉编译成功率。By replacing the file name of the header file in the configuration file with the file name of the target file, all header file names with case incompatibility problems in the configuration file are replaced. Compared with the existing technology, this can solve the case incompatibility problem in the cross-compilation process, avoid the case incompatibility of header files caused by platform differences in the cross-compilation process, and improve the success rate of cross-compilation.

在正式介绍本申请实施例之前,需要说明的是,本申请实施例提供的应用于交叉编译的数据处理方法,可以由执行交叉编译的终端设备执行,本申请实施例对此不做限定。Before formally introducing the embodiments of the present application, it should be noted that the data processing method for cross-compilation provided in the embodiments of the present application can be executed by a terminal device that performs cross-compilation, and the embodiments of the present application do not limit this.

clang和gcc 是常用的两款编译工具,且都支持交叉编译,本申请实施例下文描述中仅以clang来举例表述,当然,本申请实施例提供的数据处理方法在gcc等交叉编译工具上同样适用。clang and gcc are two commonly used compilation tools, and both support cross-compilation. In the following description of the embodiments of the present application, only clang is used as an example. Of course, the data processing method provided in the embodiments of the present application is also applicable to cross-compilation tools such as gcc.

参见图1,本申请实施例提供的应用于交叉编译的数据处理方法的实施流程,包括以下步骤S101-S102:Referring to FIG. 1 , the implementation process of the data processing method for cross-compilation provided in the embodiment of the present application includes the following steps S101-S102:

S101,获取配置文件,配置文件是在第一平台中基于第二平台的配置构建的。S101, obtaining a configuration file, where the configuration file is constructed in the first platform based on the configuration of the second platform.

具体实施时,在第一平台中,获取待编译工程文件,然后使用预设命令对待编译工程文件进行处理,基于第二平台的配置构建工程文件目录,并从工程文件目录中搜索配置文件。其中,待编译工程文件可以是用户编写或者用户上传的,本申请实施例对此不做限定,预设命令可以是cmake命令。In the specific implementation, in the first platform, the project file to be compiled is obtained, and then the preset command is used to process the project file to be compiled, a project file directory is constructed based on the configuration of the second platform, and the configuration file is searched from the project file directory. Among them, the project file to be compiled can be written or uploaded by the user, and the embodiment of the present application does not limit this. The preset command can be a cmake command.

实际应用中,在创建完工程文件目录之后,对应待编译源文件(.cpp或者.c)依赖的头文件已经设置在配置文件中,配置文件一般为depend.make或者DependInfo.cmake,文件名称是固定的,所以只需要找这两个文件名称的文件,就能够获取到配置文件,进而能够获得对应.cpp依赖的头文件。In actual applications, after creating the project file directory, the header file that the source file to be compiled (.cpp or .c) depends on has been set in the configuration file. The configuration file is generally depend.make or DependInfo.cmake. The file name is fixed, so you only need to find the files with these two file names to get the configuration file, and then you can get the header file that the corresponding .cpp depends on.

鉴于配置文件的文件名称是固定的,具体从工程文件目录中搜索配置文件时,可以首先在工程文件目录中搜索文件名称为第一预设名称的文件,若搜索到文件名称为第一预设名称的文件,且文件内容不为空,则将文件名称为第一预设名称的文件确定为配置文件;若搜索到文件名称为第一预设名称的文件,且文件内容为空,则在工程文件目录中搜索文件名称为第二预设名称的文件,并将搜索到的文件名称为第二预设名称的文件确定为配置文件。其中,第一预设名称为depend.make,第二预设名称为DependInfo.cmake。Since the file name of the configuration file is fixed, when searching for the configuration file in the project file directory, you can first search for a file with the first preset name in the project file directory. If a file with the first preset name is found and the file content is not empty, the file with the first preset name is determined as the configuration file; if a file with the first preset name is found and the file content is empty, search for a file with the second preset name in the project file directory, and determine the searched file with the second preset name as the configuration file. The first preset name is depend.make, and the second preset name is DependInfo.cmake.

在一个示例中,depend.make文件的内容格式,如图2所示,在depend.make文件内容中,冒号后面的*.h部分就是.cpp或者.c依赖的头文件,图2中示出的../include_path/example_inc1.h即为一个.cpp或者.c依赖的头文件。其中,*号代表任意字符。In an example, the content format of the depend.make file is shown in Figure 2. In the depend.make file content, the *.h part after the colon is the header file that .cpp or .c depends on. The ../include_path/example_inc1.h shown in Figure 2 is a header file that .cpp or .c depends on. The * represents any character.

在另一示例中,DependInfo.cmake文件的内容格式,如图3所示,在DependInfo.cmake文件内容中,*.cpp.obj.d是一个文件名称,该.cpp依赖的头文件信息就在*.cpp.obj.d中。In another example, the content format of the DependInfo.cmake file is shown in FIG. 3 . In the content of the DependInfo.cmake file, *.cpp.obj.d is a file name, and the header file information that the .cpp depends on is in *.cpp.obj.d.

S102,针对配置文件中待编译源文件所依赖的每个头文件,分别执行以下操作,得到更新后的配置文件:确定头文件的绝对路径,若在绝对路径中未搜索到头文件,则忽略头文件文件名称中字符的大小写格式重新搜索,在搜索到目标文件时,利用目标文件的文件名称替换配置文件中头文件的文件名称。S102, for each header file that the source file to be compiled in the configuration file depends on, perform the following operations to obtain an updated configuration file: determine the absolute path of the header file, if the header file is not found in the absolute path, ignore the case format of the characters in the header file name and search again, when the target file is found, use the file name of the target file to replace the file name of the header file in the configuration file.

需要说明的是,由于配置文件分为depend.make文件和DependInfo.cmake文件,二者的文件内容有所不同,因此,下面结合两种配置文件分别就确定头文件的绝对路径以及替换部分或全部头文件的文件名称的具体实施过程进行说明。It should be noted that since the configuration files are divided into depend.make file and DependInfo.cmake file, the contents of the two files are different. Therefore, the specific implementation process of determining the absolute path of the header file and replacing the file name of part or all of the header files is explained below in combination with the two configuration files.

一、配置文件为depend.make文件。1. The configuration file is depend.make file.

此种情况下,确定头文件的绝对路径时,对配置文件进行解析,从配置文件中分离出每个头文件的信息,然后依据预先获取的配置文件的绝对路径和每个头文件的信息,确定每个头文件的绝对路径。具体地,从每个头文件的地址信息中,获取每个头文件相对于配置文件所在文件夹的相对路径,拼接配置文件的绝对路径和相对路径,得到头文件的绝对路径。In this case, when determining the absolute path of the header file, the configuration file is parsed, the information of each header file is separated from the configuration file, and then the absolute path of each header file is determined based on the absolute path of the configuration file obtained in advance and the information of each header file. Specifically, from the address information of each header file, the relative path of each header file relative to the folder where the configuration file is located is obtained, and the absolute path and relative path of the configuration file are concatenated to obtain the absolute path of the header file.

具体来说,depend.make文件中通常以空行为分割,表示一个.cpp或者.c依赖的头文件,如图4所示,比如待编译源文件cpp_file2.c依赖三个头文件,文件名称分别为example_inc4.h、example_inc5.h、example_inc6.h,其中,example_inc6.h前面的../include_path2/dirname23表示相对于工程文件目录的相对路径,编译的目标产物就是cpp_file2.c.o,然后空行前后分别是其他待编译源文件cpp_file1.c和cpp_file3.c的目标产物和依赖头文件信息。Specifically, the depend.make file is usually separated by blank lines, indicating a header file that a .cpp or .c file depends on, as shown in Figure 4. For example, the source file cpp_file2.c to be compiled depends on three header files, whose names are example_inc4.h, example_inc5.h, and example_inc6.h, respectively. Among them, ../include_path2/dirname23 in front of example_inc6.h indicates the relative path relative to the project file directory, and the target product of the compilation is cpp_file2.c.o. The target products and dependent header file information of other source files cpp_file1.c and cpp_file3.c to be compiled are before and after the blank lines.

具体实施时,读取depend.make内容保存在变量cpp_depend_h_total中,以空行为分割,解析出每个待编译源文件对应的信息,存在列表变量cpp_depend_h_str_list中,依次遍历cpp_depend_h_str_list每个成员,成员变量为cpp_depend_h_per_str,然后对cpp_depend_h_per_str通过换行符分割出依赖的头文件信息,存在列表变量cpp_depend_h_per_list,cpp_depend_h_per_list成员格式如图5所示。In specific implementation, the content of depend.make is read and saved in the variable cpp_depend_h_total, which is separated by empty lines. The information corresponding to each source file to be compiled is parsed and stored in the list variable cpp_depend_h_str_list. Each member of cpp_depend_h_str_list is traversed in turn, and the member variable is cpp_depend_h_per_str. Then, cpp_depend_h_per_str is separated by newline characters to obtain the dependent header file information, which is stored in the list variable cpp_depend_h_per_list. The member format of cpp_depend_h_per_list is shown in Figure 5.

然后依次遍历cpp_depend_h_per_list元素,通过冒号解析出.o文件字符串和.h文件字符串,分别存在变量var_o_str和var_h_str中,例如图5中示例的字符串可解析出:Then, the cpp_depend_h_per_list elements are traversed in sequence, and the .o file string and the .h file string are parsed through the colon, and stored in the variables var_o_str and var_h_str respectively. For example, the string in the example in Figure 5 can be parsed as follows:

var_o_str=complier_result_path/cpp_file2.c.ovar_o_str=complier_result_path/cpp_file2.c.o

var_h_str=../include_path2/dirname23/example_inc6.hvar_h_str=../include_path2/dirname23/example_inc6.h

将头文件的原文件名称存放在变量var_h_old中,这里var_h_old= example_inc6.h,通过预先获取的depend.make文件的绝对路径和.h文件(上文提到的var_h_str变量)的相对路径进行拼接,可以得到头文件的绝对路径var_h_abspath。The original file name of the header file is stored in the variable var_h_old, where var_h_old = example_inc6.h. By concatenating the absolute path of the depend.make file obtained in advance and the relative path of the .h file (the var_h_str variable mentioned above), the absolute path of the header file var_h_abspath can be obtained.

获得头文件的绝对路径之后,使用预设函数,基于头文件的绝对路径,搜索头文件,例如,通过函数os.path.exist(var_h_abspath),判断在头文件的绝对路径下是否存在该头文件,如果存在,则表明此头文件的文件名称不存在大小写不兼容的问题,无需做替换操作,继续处理下一个头文件,如果头文件的绝对路径下不存在该头文件,则表明此头文件的文件名称存在大小写不兼容的问题,此时忽略文件名称的字符大小写格式继续搜索,在搜索到目标文件时,将目标文件的文件名称存在变量var_h_new中,进而可以将文件名称大小写不匹配的头文件的原文件名称和正确文件名称存在字典var_h_dict中,var_h_dict={var_h_old:var_h_new},直到遍历完一个cpp_depend_h_per_str。After obtaining the absolute path of the header file, use the preset function to search for the header file based on the absolute path of the header file. For example, through the function os.path.exist (var_h_abspath), determine whether the header file exists in the absolute path of the header file. If it exists, it means that the file name of this header file is not case-incompatible, and no replacement operation is required. Continue to process the next header file. If the header file does not exist in the absolute path of the header file, it means that the file name of this header file is case-incompatible. At this time, ignore the character case format of the file name and continue to search. When the target file is searched, the file name of the target file is stored in the variable var_h_new, and then the original file name and the correct file name of the header file whose file name does not match the case can be stored in the dictionary var_h_dict, var_h_dict={var_h_old:var_h_new}, until a cpp_depend_h_per_str is traversed.

对字符串变量cpp_depend_h_per_str中指定子字符串进行替换,指定的子字符串为var_h_old,替换为var_h_new,替换完成后存放在列表变量cpp_depend_h_str_new_list。对所有cpp_depend_h_str_list遍历完成后,得到最新的cpp_depend_h_str_new_list,用空行拼接cpp_depend_h_str_new_list得到字符串变量cpp_depend_h_total_new,然后清空depend.make文件内容,再将cpp_depend_h_total_new写入depend.make文件中,即实现了针对每个文件名称大小写不匹配的头文件的文件名称的替换,解决了交叉编译过程中存在的大小写不兼容问题,避免交叉编译过程中因平台差异导致的头文件大小写不兼容,提高交叉编译成功率。Replace the specified substring in the string variable cpp_depend_h_per_str. The specified substring is var_h_old, which is replaced with var_h_new. After the replacement is completed, it is stored in the list variable cpp_depend_h_str_new_list. After traversing all cpp_depend_h_str_list, the latest cpp_depend_h_str_new_list is obtained. The cpp_depend_h_str_new_list is concatenated with blank lines to obtain the string variable cpp_depend_h_total_new. Then the depend.make file content is cleared, and cpp_depend_h_total_new is written into the depend.make file. This means that the file name of each header file whose file name does not match the case is replaced, which solves the case incompatibility problem in the cross-compilation process, avoids the case incompatibility of header files caused by platform differences during the cross-compilation process, and improves the success rate of cross-compilation.

下面结合图6,对本申请实施例中配置文件为depend.make文件时,对文件名称大小写不匹配的头文件的文件名称进行替换的实施过程进行详细说明,如图6所示,具体替换过程,包括:6, the implementation process of replacing the file name of the header file whose file name does not match the case when the configuration file is the depend.make file in the embodiment of the present application is described in detail. As shown in FIG6, the specific replacement process includes:

步骤601,读取depend.make文件内容,保存在变量cpp_depend_h_total中,以空行为分割,切分cpp_depend_h_total,切分得到的块存在列表变量cpp_depend_h_str_list中。Step 601, read the contents of the depend.make file, save it in the variable cpp_depend_h_total, split it with empty lines, split cpp_depend_h_total, and store the resulting blocks in the list variable cpp_depend_h_str_list.

步骤602,对每个cpp_depend_h_str_list的成员cpp_depend_h_per_str通过换行符解析,解析结果存在列表变量cpp_depend_h_per_list中。Step 602, parse each member cpp_depend_h_per_str of cpp_depend_h_str_list by line break, and store the parsing result in the list variable cpp_depend_h_per_list.

步骤603,对每个cpp_depend_h_per_list,通过冒号解析出.o文件字符串和.h文件字符串,分别存在变量var_o_str和var_h_str中。Step 603: for each cpp_depend_h_per_list, parse the .o file string and the .h file string through the colon, and store them in variables var_o_str and var_h_str respectively.

步骤604,通过预先获取的depend.make文件的绝对路径和var_h_str中记录的头文件的相对路径,拼接获得头文件的绝对路径var_h_abspath。Step 604, the absolute path var_h_abspath of the header file is obtained by concatenating the absolute path of the depend.make file obtained in advance and the relative path of the header file recorded in var_h_str.

步骤605,判断var_h_abspath是否存在头文件,如果存在,在继续执行步骤603处理下一个cpp_depend_h_per_list,如果不存在,则执行步骤606。Step 605, determine whether there is a header file in var_h_abspath, if so, continue to execute step 603 to process the next cpp_depend_h_per_list, if not, execute step 606.

步骤606,忽略头文件的文件名称中的字符大小写格式继续搜索,将搜索到的目标文件的文件名称和头文件的原文件名称存储在var_h_dict字典中。Step 606, continue searching by ignoring the case format of characters in the file name of the header file, and store the searched file name of the target file and the original file name of the header file in the var_h_dict dictionary.

步骤607,判断cpp_depend_h_per_list中头文件是否处理完毕,如果未处理完毕,则继续执行步骤603处理下一个头文件,若处理完毕则执行步骤608。Step 607, determine whether the header files in cpp_depend_h_per_list have been processed. If not, continue to execute step 603 to process the next header file. If it has been processed, execute step 608.

步骤608,遍历完成一个cpp_depend_h_per_list后,使用字典var_h_dict对cpp_depend_h_per_str中文件名称大小写不匹配的头文件的文件名称进行替换,然后执行步骤602,处理下一个cpp_depend_h_str_list。Step 608, after traversing one cpp_depend_h_per_list, use the dictionary var_h_dict to replace the file names of the header files whose file names in cpp_depend_h_per_str do not match the case, and then execute step 602 to process the next cpp_depend_h_str_list.

需要说明的是,待所有的cpp_depend_h_str_list处理完成,即可得到更新后的depend.make文件,也即更新后的配置文件。It should be noted that after all cpp_depend_h_str_list processing is completed, the updated depend.make file, that is, the updated configuration file, can be obtained.

二、配置文件为DependInfo.cmake文件。2. The configuration file is DependInfo.cmake file.

此种情况下,确定头文件的绝对路径时,首先对配置文件进行解析,从配置文件中解析出依赖文件的相对路径,依赖文件包含待编译源文件依赖的头文件信息;然后依据预先获取的配置文件的绝对路径和依赖文件的相对路径,确定依赖文件的绝对路径;最后根据依赖文件的绝对路径,获取依赖文件,并从依赖文件包含的头文件信息中,获取每个头文件的绝对路径。In this case, when determining the absolute path of the header file, first parse the configuration file, and parse the relative path of the dependent file from the configuration file. The dependent file contains the header file information that the source file to be compiled depends on; then, based on the absolute path of the configuration file obtained in advance and the relative path of the dependent file, determine the absolute path of the dependent file; finally, based on the absolute path of the dependent file, obtain the dependent file, and obtain the absolute path of each header file from the header file information contained in the dependent file.

具体来说,获取DependInfo.cmake文件内容,如图7所示,通过解析获取set(CMAKE_DEPENDS_DEPENDENCY_FILES后面的内容,存在字符串变量dependInfo_str中。Specifically, the content of the DependInfo.cmake file is obtained, as shown in Figure 7, by parsing the content after set (CMAKE_DEPENDS_DEPENDENCY_FILES, which is stored in the string variable dependInfo_str.

然后对字符串变量dependInfo_str通过换行符分割以及去除空格,解析得到列表变量cpp_depend_list,cpp_depend_list存储着配置文件中所有.cpp或者.c的依赖信息,cpp_depend_list中元素格式,如图8所示。Then, the string variable dependInfo_str is split by line breaks and spaces are removed to parse the list variable cpp_depend_list. cpp_depend_list stores the dependency information of all .cpp or .c in the configuration file. The element format of cpp_depend_list is shown in Figure 8.

遍历cpp_depend_list中每个成员(cpp_depend_per_str),通过空格解析cpp_depend_per_str可获得*.obj.d(即本申请实施例提到的依赖文件)的相对路径,通过预先获取的DependInfo.cmake文件的绝对路径,可以确定*.obj.d的绝对路径per_obj_d_abspath。Traverse each member (cpp_depend_per_str) in cpp_depend_list, and obtain the relative path of *.obj.d (i.e., the dependent file mentioned in the embodiment of the present application) by parsing cpp_depend_per_str through spaces. The absolute path of the DependInfo.cmake file obtained in advance can be used to determine the absolute path per_obj_d_abspath of *.obj.d.

然后,读取per_obj_d_abspath文件,获取文件内容,如图9所示,文件内容存在字符串变量per_obj_d_info,通过换行符和反斜杠(\)切分字符串变量per_obj_d_info,所有元素存在列表变量cpp_depend_inc_list中,其中,cpp_depend_inc_list中含有两个元素是*.cpp和*.cpp.obj。Then, the per_obj_d_abspath file is read to obtain the file content. As shown in Figure 9, the file content is stored in the string variable per_obj_d_info. The string variable per_obj_d_info is split by newline characters and backslashes (\). All elements are stored in the list variable cpp_depend_inc_list, where cpp_depend_inc_list contains two elements, *.cpp and *.cpp.obj.

遍历cpp_depend_inc_list每个元素cpp_depend_inc_str,cpp_depend_inc_str为*.h头文件的绝对路径,*.h头文件的原文件名称使用变量var_h_old表示,遍历到*.cpp和*.cpp.obj就选择跳过,不作处理,遍历到.h时,通过函数os.path.exist(cpp_depend_inc_str)判断该头文件是否存在,如果存在,则表明此头文件的文件名称不存在大小写不兼容的问题,无需做替换操作,继续处理下一个头文件,如果头文件的绝对路径下不存在该头文件,则表明此头文件的文件名称存在大小写不兼容的问题,此时忽略文件名称的字符大小写格式继续搜索,在搜索到目标文件时,将目标文件的文件名称存在变量var_h_new中,进而可以将文件名称大小写不匹配的头文件的原文件名称和正确文件名称存在字典var_h_dict中,var_h_dict={var_h_old:var_h_new}。Traverse each element cpp_depend_inc_str of cpp_depend_inc_list, cpp_depend_inc_str is the absolute path of the *.h header file, the original file name of the *.h header file is represented by the variable var_h_old, and *.cpp and *.cpp.obj are skipped without processing. When traversing to .h, the function os.path.exist (cpp_depend_inc_str) is used to determine whether the header file exists. If it exists, it indicates that the file name of this header file does not exist. For the problem of lowercase incompatibility, no replacement operation is required, and the next header file can be processed. If the header file does not exist under the absolute path of the header file, it indicates that the file name of this header file is case incompatible. At this time, the character case format of the file name is ignored and the search is continued. When the target file is found, the file name of the target file is stored in the variable var_h_new, and then the original file name and the correct file name of the header file with case mismatch can be stored in the dictionary var_h_dict, var_h_dict={var_h_old:var_h_new}.

最后,将字典变量var_h_dict中var_h_old所在的子字符串全部替换为对应的var_h_new,也即替换掉 per_obj_d_info中文件名称大小写不匹配的头文件的文件名称,直到遍历完整个cpp_depend_list,即实现了针对每个文件名称大小写不匹配的头文件的文件名称的替换,解决了交叉编译过程中存在的大小写不兼容问题,避免交叉编译过程中因平台差异导致的头文件大小写不兼容,提高交叉编译成功率。Finally, replace all substrings of var_h_old in the dictionary variable var_h_dict with the corresponding var_h_new, that is, replace the file names of header files whose file names do not match the case in per_obj_d_info, until the entire cpp_depend_list is traversed, that is, the replacement of the file names of each header file whose file names do not match the case is realized, which solves the case incompatibility problem in the cross-compilation process, avoids the case incompatibility of header files caused by platform differences in the cross-compilation process, and improves the success rate of cross-compilation.

下面结合图10,对本申请实施例中配置文件为DependInfo.cmake文件时,对文件名称大小写不匹配的头文件的文件名称进行替换的实施过程进行详细说明,如图10所示,具体替换过程,包括:In conjunction with FIG. 10 , the implementation process of replacing the file name of the header file whose file name does not match the case when the configuration file is the DependInfo.cmake file in the embodiment of the present application is described in detail. As shown in FIG. 10 , the specific replacement process includes:

步骤1001,获取DependInfo.cmake文件内容,提取关键字符串,保存在变量dependInfo_str中。Step 1001, obtain the content of the DependInfo.cmake file, extract the key string, and save it in the variable dependInfo_str.

步骤1002,对字符串变量dependInfo_str通过换行符进行解析,解析结果保存在列表变量cpp_depend_list中。Step 1002, parse the string variable dependInfo_str through the line break, and save the parsing result in the list variable cpp_depend_list.

步骤1003,遍历cpp_depend_list中每个成员cpp_depend_per_str,解析cpp_depend_per_str得到*.obj.d的绝对路径per_obj_d_abspath。Step 1003, traverse each member cpp_depend_per_str in cpp_depend_list, parse cpp_depend_per_str to obtain the absolute path per_obj_d_abspath of *.obj.d.

步骤1004,读取per_obj_d_abspath文件,获取文件内容,文件内容存在字符串变量per_obj_d_info中。Step 1004, read the per_obj_d_abspath file, obtain the file content, and store the file content in the string variable per_obj_d_info.

步骤1005,通过换行符和反斜杠切分字符串变量per_obj_d_info,所有元素存在列表变量cpp_depend_inc_list中,遍历cpp_depend_inc_list中每个元素cpp_depend_inc_str,获取到*.h头文件的原文件名称使用变量var_h_old表示。Step 1005, split the string variable per_obj_d_info by line breaks and backslashes, store all elements in the list variable cpp_depend_inc_list, traverse each element cpp_depend_inc_str in cpp_depend_inc_list, obtain the original file name of the *.h header file and use the variable var_h_old to represent it.

步骤1006,判断cpp_depend_inc_str是否存在头文件,如果存在,则执行步骤1005,检查下一个头文件,如果不存在,则执行步骤1007。Step 1006, determine whether there is a header file for cpp_depend_inc_str, if so, execute step 1005, check the next header file, if not, execute step 1007.

步骤1007,忽略头文件的文件名称中的字符大小写格式继续搜索,将搜索到的目标文件的文件名称和头文件的原文件名称存储在var_h_dict字典中。Step 1007, continue searching by ignoring the case format of characters in the file name of the header file, and store the searched file name of the target file and the original file name of the header file in the var_h_dict dictionary.

步骤1008,判断cpp_depend_inc_list中头文件是否处理完毕,如果未处理完毕,则继续执行步骤1005处理下一个头文件,若处理完毕则执行步骤1009。Step 1008, determine whether the header files in cpp_depend_inc_list have been processed. If not, continue to execute step 1005 to process the next header file. If it has been processed, execute step 1009.

步骤1009,遍历完成一个cpp_depend_inc_list后,使用字典var_h_dict对per_obj_d_info中文件名称大小写不匹配的头文件的文件名称进行替换,然后执行步骤1003,处理下一个cpp_depend_per_str。Step 1009, after traversing a cpp_depend_inc_list, use the dictionary var_h_dict to replace the file names of the header files whose file names do not match the case in per_obj_d_info, and then execute step 1003 to process the next cpp_depend_per_str.

需要说明的是,待所有的cpp_depend_per_str处理完成,即可得到更新后的DependInfo.cmake文件,也即更新后的配置文件。It should be noted that after all cpp_depend_per_str processing is completed, the updated DependInfo.cmake file, that is, the updated configuration file, can be obtained.

具体实施时,在得到更新后的配置文件后,本申请实施例即可基于更新后的配置文件进行编译,生成可执行文件或者库。During specific implementation, after obtaining the updated configuration file, the embodiment of the present application can be compiled based on the updated configuration file to generate an executable file or library.

下面结合图11,对应用本申请实施例提供的数据处理方法的交叉编译过程进行详细说明,如图11所示,具体交叉编译过程,包括:In conjunction with FIG11 , the cross-compilation process of the data processing method provided by the embodiment of the present application is described in detail. As shown in FIG11 , the specific cross-compilation process includes:

步骤1101,使用cmake命令对待编译工程文件进行处理,生成工程文件目录。Step 1101, use the cmake command to process the project files to be compiled and generate a project file directory.

步骤1102,在工程文件目录中搜索depend.make文件。Step 1102, search for the depend.make file in the project file directory.

步骤1103,判断depend.make文件的文件内容是否为空,若depend.make文件的文件内容不为空,则执行步骤1104,否则,执行步骤1105。Step 1103, determine whether the file content of the depend.make file is empty. If the file content of the depend.make file is not empty, execute step 1104, otherwise, execute step 1105.

步骤1104,将depend.make文件作为配置文件,替换配置文件中文件名称大小写不兼容的头文件的文件名称,得到更新后的配置文件。Step 1104 , using the depend.make file as a configuration file, replacing the file names of header files whose file names are case incompatible in the configuration file, and obtaining an updated configuration file.

具体替换配置文件中文件名称大小写不兼容的头文件的文件名称的实施过程,如图6所示,此处不再赘述。The specific implementation process of replacing the file name of the header file whose file name is case incompatible in the configuration file is shown in FIG6 , and will not be described in detail here.

步骤1105,在工程文件目录中搜索DependInfo.cmake文件。Step 1105, search for the DependInfo.cmake file in the project file directory.

步骤1106,将DependInfo.cmake文件作为配置文件,替换配置文件中文件名称大小写不兼容的头文件的文件名称,得到更新后的配置文件。Step 1106, using the DependInfo.cmake file as a configuration file, replacing the file names of header files whose file names are case incompatible in the configuration file, and obtaining an updated configuration file.

具体替换配置文件中文件名称大小写不兼容的头文件的文件名称的实施过程,如图10所示,此处不再赘述。The specific implementation process of replacing the file name of the header file whose file name is case incompatible in the configuration file is shown in Figure 10 and will not be repeated here.

步骤1107,基于更新后的配置文件进行编译,生成可执行文件或者库。Step 1107, compile based on the updated configuration file to generate an executable file or library.

基于相同的发明构思,本申请实施例还提供一种应用于交叉编译的数据处理装置。如图12所示,其为数据处理装置1200的结构示意图,可以包括:Based on the same inventive concept, the embodiment of the present application also provides a data processing device for cross-compilation. As shown in FIG12 , it is a schematic diagram of the structure of a data processing device 1200, which may include:

获取单元1201,用于获取配置文件,配置文件是在第一平台中基于第二平台的配置构建的;An acquiring unit 1201 is used to acquire a configuration file, where the configuration file is constructed in the first platform based on the configuration of the second platform;

处理单元1202,用于针对配置文件中待编译源文件所依赖的每个头文件,分别执行以下操作,得到更新后的配置文件:确定头文件的绝对路径,若在绝对路径中未搜索到头文件,则忽略头文件文件名称中字符的大小写格式重新搜索,在搜索到目标文件时,利用目标文件的文件名称替换配置文件中头文件的文件名称。Processing unit 1202 is used to perform the following operations for each header file that the source file to be compiled in the configuration file depends on, to obtain an updated configuration file: determine the absolute path of the header file, if the header file is not found in the absolute path, ignore the case format of the characters in the header file name and search again, when the target file is found, use the file name of the target file to replace the file name of the header file in the configuration file.

在一些实施例中,获取单元1201,具体用于:In some embodiments, the acquisition unit 1201 is specifically configured to:

在第一平台中,获取待编译工程文件;In the first platform, obtain the project file to be compiled;

使用预设命令对待编译工程文件进行处理,基于第二平台的配置构建工程文件目录;Use preset commands to process the project files to be compiled, and build a project file directory based on the configuration of the second platform;

从工程文件目录中搜索配置文件。Search for the configuration file in the project file directory.

在一些实施例中,获取单元1201,具体用于:In some embodiments, the acquisition unit 1201 is specifically configured to:

在工程文件目录中搜索文件名称为第一预设名称的文件;Search the project file directory for a file named the first preset name;

若搜索到文件名称为第一预设名称的文件,且文件内容不为空,则将文件名称为第一预设名称的文件确定为配置文件;或者If a file with the first preset name is found and the file content is not empty, the file with the first preset name is determined as the configuration file; or

若搜索到文件名称为第一预设名称的文件,且文件内容为空,则在工程文件目录中搜索文件名称为第二预设名称的文件,并将搜索到的文件名称为第二预设名称的文件确定为配置文件。If a file with the first preset name is found and the file content is empty, a file with the second preset name is searched in the project file directory, and the found file with the second preset name is determined as the configuration file.

在一些实施例中,处理单元1202,具体用于:In some embodiments, the processing unit 1202 is specifically configured to:

将文件名称为第一预设名称的文件确定为配置文件时,对配置文件进行解析,从配置文件中分离出每个头文件的信息;When a file named with the first preset name is determined as a configuration file, the configuration file is parsed to separate information of each header file from the configuration file;

依据预先获取的配置文件的绝对路径和每个头文件的信息,确定每个头文件的绝对路径。The absolute path of each header file is determined according to the absolute path of the configuration file obtained in advance and the information of each header file.

在一些实施例中,处理单元1202,具体用于:In some embodiments, the processing unit 1202 is specifically configured to:

从每个头文件的地址信息中,获取每个头文件相对于配置文件所在文件夹的相对路径;From the address information of each header file, obtain the relative path of each header file relative to the folder where the configuration file is located;

拼接配置文件的绝对路径和相对路径,得到头文件的绝对路径。Concatenate the absolute path and relative path of the configuration file to get the absolute path of the header file.

在一些实施例中,处理单元1202,具体用于:In some embodiments, the processing unit 1202 is specifically configured to:

将文件名称为第二预设名称的文件确定为配置文件时,对配置文件进行解析,从配置文件中解析出依赖文件的相对路径,依赖文件包含待编译源文件依赖的头文件信息;When a file named with the second preset name is determined as a configuration file, the configuration file is parsed, and a relative path of a dependent file is parsed from the configuration file, where the dependent file includes header file information that the source file to be compiled depends on;

依据预先获取的配置文件的绝对路径和依赖文件的相对路径,确定依赖文件的绝对路径;Determine the absolute path of the dependent file based on the absolute path of the configuration file obtained in advance and the relative path of the dependent file;

根据依赖文件的绝对路径,获取依赖文件,并从依赖文件包含的头文件信息中,获取每个头文件的绝对路径。Get the dependent file according to the absolute path of the dependent file, and get the absolute path of each header file from the header file information contained in the dependent file.

在一些实施例中,装置还包括:In some embodiments, the apparatus further comprises:

编译单元1203,用于基于更新后的配置文件进行编译,生成可执行文件或者库。The compiling unit 1203 is used to compile based on the updated configuration file to generate an executable file or a library.

与上述方法实施例基于同一发明构思,本申请实施例中还提供了一种电子设备。该电子设备可以用于对交叉编译过程中生成的配置文件进行处理。在该实施例中,电子设备的结构可以如图13所示,包括存储器1301,通讯模块1303以及一个或多个处理器1302。Based on the same inventive concept as the above method embodiment, an electronic device is also provided in the embodiment of the present application. The electronic device can be used to process the configuration file generated in the cross-compilation process. In this embodiment, the structure of the electronic device can be as shown in Figure 13, including a memory 1301, a communication module 1303 and one or more processors 1302.

存储器1301,用于存储处理器1302执行的计算机程序。存储器1301可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统,以及运行即时通讯功能所需的程序等;存储数据区可存储各种即时通讯信息和操作指令集等。The memory 1301 is used to store computer programs executed by the processor 1302. The memory 1301 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

存储器1301可以是易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器1301也可以是非易失性存储器(non-volatilememory),例如只读存储器,快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD);或者存储器1301是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器1301可以是上述存储器的组合。The memory 1301 may be a volatile memory, such as a random-access memory (RAM); the memory 1301 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 1301 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1301 may be a combination of the above memories.

处理器1302,可以包括一个或多个中央处理单元(central processing unit,CPU)或者为数字处理单元等等。处理器1302,用于调用存储器1301中存储的计算机程序时实现上述应用于交叉编译的数据处理方法。The processor 1302 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 1302 is used to implement the above-mentioned data processing method for cross-compilation when calling the computer program stored in the memory 1301 .

通讯模块1303用于与终端设备和其他服务器进行通信。The communication module 1303 is used to communicate with terminal devices and other servers.

本申请实施例中不限定上述存储器1301、通讯模块1303和处理器1302之间的具体连接介质。本公开实施例在图13中以存储器1301和处理器1302之间通过总线13013连接,总线13013在图13中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。总线13013可以分为地址总线、数据总线、控制总线等。为便于表示,图13中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The specific connection medium between the above-mentioned memory 1301, the communication module 1303 and the processor 1302 is not limited in the embodiment of the present application. In FIG. 13 , the memory 1301 and the processor 1302 are connected via a bus 13013, and the bus 13013 is represented by a bold line in FIG. 13 . The connection mode between other components is only for schematic illustration and is not limited thereto. The bus 13013 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one bold line is used in FIG. 13 , but it does not mean that there is only one bus or one type of bus.

存储器1301中存储有计算机存储介质,计算机存储介质中存储有计算机可执行指令,计算机可执行指令用于实现本申请实施例的应用于交叉编译的数据处理方法。处理器1302用于执行上述的应用于交叉编译的数据处理方法,如图1所示。The memory 1301 stores a computer storage medium, which stores computer executable instructions, which are used to implement the data processing method for cross-compilation in the embodiment of the present application. The processor 1302 is used to execute the above-mentioned data processing method for cross-compilation, as shown in FIG1 .

在一些可能的实施方式中,本申请提供的应用于交叉编译的数据处理方法的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当程序产品在计算机设备上运行时,程序代码用于使计算机设备执行本说明书上述描述的根据本申请各种示例性实施方式的应用于交叉编译的数据处理方法中的步骤,例如,计算机设备可以执行如图1中所示的步骤。In some possible implementations, various aspects of the data processing method for cross-compilation provided by the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the data processing method for cross-compilation according to various exemplary embodiments of the present application described above in this specification. For example, the computer device may execute the steps shown in Figure 1.

程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以是但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

本申请的实施方式的程序产品可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在计算装置上运行。然而,本申请的程序产品不限于此,在本申请实施例中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被命令执行系统、装置或者器件使用或者与其结合使用。The program product of the embodiment of the present application may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a computing device. However, the program product of the present application is not limited thereto. In the embodiment of the present application, the readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with a command execution system, device or device.

可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由命令执行系统、装置或者器件使用或者与其结合使用的程序。The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.

可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等等,或者上述的任意合适的组合。The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

可以以一种或多种程序设计语言的任意组合来编写用于执行本申请操作的程序代码,程序设计语言包括面向对象的程序设计语言—诸如Java、C++等,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算装置上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算装置上部分在远程计算装置上执行、或者完全在远程计算装置或服务器上执行。在涉及远程计算装置的情形中,远程计算装置可以通过任意种类的网络包括局域网(LAN)或广域网(WAN)连接到用户计算装置,或者,可以连接到外部计算装置(例如利用因特网服务提供商来通过因特网连接)。Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect via the Internet).

本申请实施例中,术语“模块”或“单元”是指有预定功能的计算机程序或计算机程序的一部分,并与其他相关部分一起工作以实现预定目标,并且可以通过使用软件、硬件(如处理电路或存储器)或其组合来全部或部分实现。同样的,一个处理器(或多个处理器或存储器)可以用来实现一个或多个模块或单元。此外,每个模块或单元都可以是包含该模块或单元功能的整体模块或单元的一部分。In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

应当注意,尽管在上文详细描述中提及了装置的若干单元或子单元,但是这种划分仅仅是示例性的并非强制性的。实际上,根据本申请的实施方式,上文描述的两个或更多单元的特征和功能可以在一个单元中具体化。反之,上文描述的一个单元的特征和功能可以进一步划分为由多个单元来具体化。It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.

此外,尽管在附图中以特定顺序描述了本申请方法的操作,但是,这并非要求或者暗示必须按照该特定顺序来执行这些操作,或是必须执行全部所示的操作才能实现期望的结果。附加地或备选地,可以省略某些步骤,将多个步骤合并为一个步骤执行,和/或将一个步骤分解为多个步骤执行。In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and/or one step may be decomposed into multiple steps.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序命令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序命令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的命令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to the flowcharts and/or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and/or box in the flowchart and/or block diagram, as well as the combination of the processes and/or boxes in the flowchart and/or block diagram, can be implemented by computer program commands. These computer program commands can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the commands executed by the processor of the computer or other programmable data processing device generate a device for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

这些计算机程序命令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的命令产生包括命令装置的制造品,该命令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program commands may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the commands stored in the computer-readable memory produce a manufactured product including a command device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

这些计算机程序命令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的命令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program commands may also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the commands executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims (10)

1. A data processing method for cross-compilation, the method comprising:
Acquiring a configuration file, wherein the configuration file is built in a first platform based on the configuration of a second platform;
And respectively executing the following operations for each header file on which the source file to be compiled depends in the configuration file to obtain an updated configuration file: and determining an absolute path of the header file, if the header file is not searched in the absolute path, ignoring the case format of the characters in the header file name, and searching again, and when a target file is searched, replacing the file name of the header file in the configuration file by using the file name of the target file.
2. The method of claim 1, wherein the obtaining the configuration file comprises:
acquiring an engineering file to be compiled in a first platform;
Processing the engineering file to be compiled by using a preset command, and constructing an engineering file directory based on the configuration of the second platform;
searching the configuration file from the engineering file catalogue.
3. The method of claim 2, wherein searching the configuration file from the engineering file directory comprises:
searching a file with a file name of a first preset name in the engineering file catalogue;
if the file with the file name of the first preset name is searched and the file content is not empty, determining the file with the file name of the first preset name as the configuration file; or alternatively
If the file name is searched for the file with the first preset name and the file content is empty, searching the engineering file directory for the file with the second preset name, and determining the searched file with the second preset name as the configuration file.
4. A method according to claim 3, wherein determining the absolute path of the header file when determining a file with a file name of the first preset name as the configuration file comprises:
Analyzing the configuration file, and separating the information of each header file from the configuration file;
and determining the absolute path of each header file according to the absolute path of the configuration file and the information of each header file which are acquired in advance.
5. The method of claim 4, wherein determining the absolute path of each header file based on the absolute path of the configuration file and the information of each header file obtained in advance comprises:
Acquiring the relative path of each header file relative to the folder in which the configuration file is located from the address information of each header file;
And splicing the absolute path of the configuration file and the relative path to obtain the absolute path of the header file.
6. A method according to claim 3, wherein determining the absolute path of the header file when determining the file with the file name of the second preset name as the configuration file comprises:
Analyzing the configuration file, and analyzing the relative path of a dependent file from the configuration file, wherein the dependent file comprises header file information of a source file to be compiled;
Determining the absolute path of the dependent file according to the absolute path of the configuration file and the relative path of the dependent file which are acquired in advance;
And acquiring the dependent file according to the absolute path of the dependent file, and acquiring the absolute path of each head file from the head file information contained in the dependent file.
7. The method according to any one of claims 1-6, further comprising:
Compiling based on the updated configuration file to generate an executable file or library.
8. A data processing apparatus for cross-compilation, the apparatus comprising:
the system comprises an acquisition unit, a configuration file generation unit and a configuration unit, wherein the acquisition unit is used for acquiring a configuration file which is built in a first platform based on the configuration of a second platform;
The processing unit is used for respectively executing the following operations for each header file on which the source file to be compiled depends in the configuration file to obtain an updated configuration file: and determining an absolute path of the header file, if the header file is not searched in the absolute path, ignoring the case format of the characters in the header file name, and searching again, and when a target file is searched, replacing the file name of the header file in the configuration file by using the file name of the target file.
9. An electronic device, comprising:
a memory for storing program instructions;
A processor for invoking program instructions stored in said memory to perform the method of any of claims 1-7 in accordance with the obtained program.
10. A computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method of any one of claims 1 to 7.
CN202411312841.6A 2024-09-19 2024-09-19 Data processing method, device, equipment and medium for cross-compilation Active CN118838603B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411312841.6A CN118838603B (en) 2024-09-19 2024-09-19 Data processing method, device, equipment and medium for cross-compilation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411312841.6A CN118838603B (en) 2024-09-19 2024-09-19 Data processing method, device, equipment and medium for cross-compilation

Publications (2)

Publication Number Publication Date
CN118838603A true CN118838603A (en) 2024-10-25
CN118838603B CN118838603B (en) 2025-03-21

Family

ID=93149660

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411312841.6A Active CN118838603B (en) 2024-09-19 2024-09-19 Data processing method, device, equipment and medium for cross-compilation

Country Status (1)

Country Link
CN (1) CN118838603B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119127217A (en) * 2024-11-14 2024-12-13 联通在线信息科技有限公司 MailCore2 component integration configuration file generation method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030009747A1 (en) * 2001-06-25 2003-01-09 International Business Machines Corporation Apparatus and method for porting applications to different platforms
US20070011494A1 (en) * 2005-06-21 2007-01-11 International Business Machines Corporation System and method for building software package for embedded system
US10592215B1 (en) * 2017-08-17 2020-03-17 NanoVMs, Inc. Unikernel cross-compilation
CN115390846A (en) * 2022-08-11 2022-11-25 地平线(上海)人工智能技术有限公司 Compilation construction method, device, electronic device and storage medium
CN115437639A (en) * 2022-08-24 2022-12-06 深圳云豹智能有限公司 Automatic generation method and device of compiling configuration file, electronic equipment and storage medium
CN116257250A (en) * 2023-02-20 2023-06-13 重庆长安汽车股份有限公司 Cross-platform compiling method, device, electronic device and storage medium
CN116841635A (en) * 2023-05-24 2023-10-03 上海益世界信息技术集团有限公司 Parameter configuration method, device, equipment and storage medium
CN118444920A (en) * 2024-04-12 2024-08-06 浙江大华技术股份有限公司 Cross-platform compiling method, electronic device and computer readable storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030009747A1 (en) * 2001-06-25 2003-01-09 International Business Machines Corporation Apparatus and method for porting applications to different platforms
US20070011494A1 (en) * 2005-06-21 2007-01-11 International Business Machines Corporation System and method for building software package for embedded system
US10592215B1 (en) * 2017-08-17 2020-03-17 NanoVMs, Inc. Unikernel cross-compilation
CN115390846A (en) * 2022-08-11 2022-11-25 地平线(上海)人工智能技术有限公司 Compilation construction method, device, electronic device and storage medium
CN115437639A (en) * 2022-08-24 2022-12-06 深圳云豹智能有限公司 Automatic generation method and device of compiling configuration file, electronic equipment and storage medium
CN116257250A (en) * 2023-02-20 2023-06-13 重庆长安汽车股份有限公司 Cross-platform compiling method, device, electronic device and storage medium
CN116841635A (en) * 2023-05-24 2023-10-03 上海益世界信息技术集团有限公司 Parameter configuration method, device, equipment and storage medium
CN118444920A (en) * 2024-04-12 2024-08-06 浙江大华技术股份有限公司 Cross-platform compiling method, electronic device and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SIGNORINO 13: "头文件大小写问题的脚本解决方案", pages 1, Retrieved from the Internet <URL:https://www.cnblogs.com/sig3/p/3979668.html> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119127217A (en) * 2024-11-14 2024-12-13 联通在线信息科技有限公司 MailCore2 component integration configuration file generation method and device

Also Published As

Publication number Publication date
CN118838603B (en) 2025-03-21

Similar Documents

Publication Publication Date Title
CN111209004B (en) Code conversion method and device
CN106547527B (en) JavaScript file construction method and device
CN103744709A (en) Patch loading method and device
CN111522574B (en) Differential packet generation method and related equipment
CN109491661B (en) Universal cross-compiling method and device
CN118838603A (en) Data processing method, device, equipment and medium applied to cross compiling
CN114816816B (en) Crash stack information processing method, device, equipment and storage medium
CN113805930A (en) Incremental package method and device
CN117032685A (en) Method and device for generating configuration of applet asynchronous component
CN112732321B (en) Firmware modification method, device, computer readable storage medium and equipment
CN118192984A (en) Class loading method, device, equipment and storage medium in page compilation stage
CN107612919B (en) Protocol configuration method and device
CN112286706B (en) Application information remote and rapid acquisition method of Android application and related equipment
CN115390944A (en) Algorithm service calling method and device, electronic equipment and storage medium
CN118394368B (en) Basic input output system layout information generating method, updating method and product
CN112114870A (en) A method, device, terminal device and storage medium for packaging code
CN113821486B (en) Method and device for determining dependency relationship between pod libraries and electronic equipment
CN118193567A (en) Method, device, equipment and medium for generating query statements and querying business data
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
CN112925573B (en) Methods, devices, equipment and computer-readable media for loading web pages
CN116149715A (en) Software upgrading method, device, equipment and medium
CN118331624A (en) Software development kit tracing method, device, electronic device and storage medium
CN115951916A (en) A component processing method, device, electronic device and storage medium
CN113590088A (en) Method and device for automatically analyzing service condition of component and electronic equipment
CN114547038B (en) Data processing method and device of priority database

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