A cmake project building method and system based on cyberRT

By modifying the CyberRT repository source code and building its image, resolving dependencies, and using the um_lib macro for CMake compilation, multi-mode builds are supported, solving the problem of low development efficiency in CyberRT projects and achieving an efficient project building and debugging process.

CN123048020APending Publication Date: 2026-11-06UQI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611330310.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

In existing technologies, CyberRT only supports the Bazel build method, while the cmake build method is incomplete, resulting in high development and learning costs, unclear dependency management, limited compilation speed, and poor project iteration efficiency.

Method used

This paper provides a CMake project building method based on CyberRT. By preprocessing and modifying the CyberRT repository source code, it builds independent compilation and runtime images, parses project dependencies, uses the um_lib macro to convert them into native CMake compilation statements, supports single package and full package builds, realizes x86 simulation debugging and real vehicle debugging, and generates a release installation package.

Benefits of technology

It enables a generalized build of CyberRT projects, reduces the difficulty and learning cost of cross-compilation configuration, improves compilation efficiency, streamlines the entire process of compilation-debugging-deployment, and improves development iteration efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123048020A_ABST
    Figure CN123048020A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of robots, automatic driving and industrial Internet of Things, and in particular to a CMake project construction method and system based on CyberRT, which realizes environment isolation control by building mutually independent compilation images and running images, automatically parses project dependencies and intelligently arranges construction sequences based on configuration files, simplifies development configuration by encapsulating compilation statements through custom macros, supports flexible multi-mode project compilation jobs, breaks through the complete closed-loop process of simulation debugging and real vehicle debugging, and automatically completes product optimization and standardized installation package encapsulation and release. The present application effectively makes up for many defects of traditional construction schemes, reduces the project development and deployment threshold, improves the project compilation efficiency and general adaptation capability, adapts to various hardware architectures, and can be widely applied to the development iteration and landing deployment of various automatic driving and robot engineering projects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of robotics, autonomous driving, and industrial IoT, and in particular to a CMake project building method and system based on CyberRT. Background Technology

[0002] CyberRT is a high-performance communication middleware in Baidu's Apollo autonomous driving platform, which implements inter-component communication based on a publish-subscribe model. Existing technologies have the following shortcomings: (1) The official support is only for the bazel build method, while the cmake build method is more popular. The cmake build solution provided by the community is incomplete and cannot achieve general project build.

[0003] (2) It requires manual configuration of cross-toolchains, which has a high development and learning cost.

[0004] (3) The dependency management is unclear. Technical personnel need to read the build files one by one to sort out the dependency relationship of each component, resulting in low development efficiency.

[0005] (4) The existing construction method cannot adapt to the optimal compilation scheme according to the current host hardware environment, the compilation speed is limited, and the project iteration efficiency is poor.

[0006] Therefore, there is an urgent need for a CMake project build solution that is compatible with CyberRT and can solve the above-mentioned defects. Summary of the Invention

[0007] The purpose of this invention is to overcome the problems of the prior art and provide a CMake project building method and system based on CyberRT. This invention addresses the technical problems of CyberRT only supporting Bazel building, high threshold for cross-compilation configuration, unclear dependency management, high development and learning costs, and fragmented project building-debugging-release processes, and is suitable for robot and autonomous driving engineering project development.

[0008] The above objectives are achieved through the following technical solutions: This invention provides a CMake project building method based on CyberRT, comprising the following steps: Step S1: Perform preprocessing modifications on the CyberRT repository source code; Step S2: Based on the preprocessed and modified CyberRT repository source code, build independent compilation and runtime images; Step S3: Under the compiled image, resolve the project dependencies based on packages.yml, and determine the project build order according to the resolved dependencies; Step S4: During the project build phase, the encapsulated um_lib macro is called to convert the um_lib macro into native CMake compilation statements to participate in the build, supporting single-package builds and full-package builds; Step S5: Based on the constructed product, carry out debugging operations to achieve x86 simulation debugging and actual vehicle debugging; Step S6: Process the build artifacts to generate the release installation package.

[0009] Furthermore, the preprocessing modification of the CyberRT repository source code includes: removing the common_msgs folder and build content from the source code, with all data types provided by a directory specified by an external project; adding the cyber-channel pub command operation; adding CMake cross-compilation files; building a cross-compilation image and mounting it to the specified compilation directory; modifying the Install.py script to add ccache caching support and multi-core compilation support, and uniformly implementing x86 and ARM compilation through Install.py; and packaging the successfully compiled dynamic library, header files, and CMake call files into the compilation image and the runtime image.

[0010] Furthermore, the construction of mutually independent compiled and runtime images includes a compiled image processing step and a runtime image processing step; The compilation image processing steps are as follows: copy the compiled cyber folder and cyber-dep folder, keeping all contents; integrate dependencies using a Docker image, install the required dependencies using apt in the Docker image, and place the CyberRT communication architecture content in the / opt fixed directory for easy import in CMake; write a one-click Docker script to map the project code to the Docker image; The steps for processing the runtime image are as follows: Copy the compiled cyber folder and cyber-dep folder, remove the header files and CMake files, keep only the runtime binary and dynamic libraries, and add the project's third-party dependency libraries; create the runtime image based on the manufacturer's original image, and add the source directive of setup.bash and the export directive of PYTHONPATH to bashrc.

[0011] Furthermore, the step of parsing project dependencies based on packages.yml and determining the project build order based on the parsed dependencies includes: reading packages.yml and parsing the dependencies between various software packages; identifying dependencies that have not been built, automatically adjusting the build order, and prioritizing the compilation of dependent components; and calling a dependency visualization command to output a dependency graph between libraries.

[0012] Furthermore, the project build phase calls the encapsulated um_lib macro, converting the um_lib macro into native CMake compilation statements to participate in the build process. This includes: the um_lib macro encapsulating the CMake statements for add_library, target_link_libraries, and install; reading the um_lib macro content in the CMake script, converting it into the corresponding native CMake statements, and then participating in the build process.

[0013] Furthermore, the support for single-package and full-package builds is achieved through preset make commands, which include the make pkg-arm-r command for single-package builds on ARM architecture, the make pkg-r command for single-package builds on x86 architecture, the make install-arm-r command for full-package builds on ARM architecture, and the make clean command for cleaning up the current build content.

[0014] Furthermore, the debugging operation based on the constructed artifacts to achieve x86 simulation debugging and real vehicle debugging includes: performing a visual dependency scan using the `make scan` command; transferring the currently specified library to the actual vehicle body using the `make rsync` command; using the x86 architecture single-package construction artifact for the x86 simulation debugging; using the construction artifact synchronously transferred to the vehicle body for the real vehicle debugging, supporting SSH terminal debugging; and performing a cleanup operation and rebuilding after an error occurs, forming a closed loop of build-error rollback-rebuild-debugging.

[0015] Furthermore, the process of processing the build artifacts to generate a release installation package includes: performing a strip operation on the compiled dynamic libraries and third-party libraries to reduce their space usage; assigning values ​​to the configuration files according to the robot's characteristics; placing the self-starting service, startup command, tools, and startup script into the release installation package; integrating Deb dependencies and pip dependencies; and compressing the output into a final tar package.

[0016] This invention also provides a CyberRT-based CMake project build system for implementing the aforementioned CyberRT-based CMake project build method, comprising: The source code preprocessing module is used to perform preprocessing and modification on the source code of the CyberRT repository; The image environment build module is used to build independent compile images and runtime images; The dependency management module is used to read packages.yml, parse project dependencies, and determine the project build order based on the dependencies. The compilation and packaging module provides the um_lib macro, converts the um_lib macro into native CMake compilation statements to participate in the build process, and supports single-package builds and full-package builds. The debugging module is used to perform debugging operations, enabling x86 simulation debugging and real vehicle debugging. The packaging and distribution module is used to process the build artifacts and generate a distribution installation package.

[0017] Furthermore, the dependency management module is also used to receive dependency visualization instructions and output a dependency graph between libraries; the debugging module integrates single package synchronization function and SSH terminal debugging function; the packaging and publishing module has the processing capabilities of strip operation, configuration file assignment, integration of Deb dependency and pip dependency, and compression output of tar package.

[0018] This invention provides a CMake project building method and system based on CyberRT. By preprocessing and modifying the CyberRT repository source code, it achieves compatibility between the CyberRT architecture and the general CMake build system, breaking free from the limitations of traditional dedicated build tools and effectively expanding the applicable scenarios of projects. By building independent compilation and runtime images, it achieves isolated management of the compilation and runtime environments, significantly reducing the configuration difficulty and learning cost of cross-compilation. It automatically parses project dependencies and intelligently arranges the compilation order through configuration files, realizing a visual display of dependency relationships and eliminating the tedious operation of manually sorting dependencies. By encapsulating various commonly used CMake compilation statements through a custom um_lib macro, it simplifies project compilation configuration operations and lowers the development threshold. It supports flexible building of single packages and full packages through multi-mode compilation instructions. Combined with hardware adaptation compilation optimization mechanisms, it effectively improves compilation efficiency. By connecting the entire process of compilation, cleanup, simulation, and real vehicle debugging, it forms a complete development and debugging closed loop, solving the problem of fragmented traditional processes. Through automated product optimization and packaging and release processing, it achieves standardized project output and convenient deployment, significantly improving the development iteration efficiency and versatility of CyberRT projects, and adapting to the development and deployment of various autonomous driving and robotic equipment. Attached Figure Description

[0019] Figure 1 This is a flowchart of a CMake project building method based on CyberRT as described in this invention. Detailed Implementation

[0020] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. The described embodiments are merely some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] like Figure 1 As shown, this solution provides a CMake project building method based on CyberRT. The process starts with the CyberRT repository source code. The CyberRT repository source code is executed to remove common_msgs and cross-compiled into a dynamic library, resulting in the CyberRT communication architecture. The CyberRT communication architecture is divided into two branches: one branch flows to the runtime image, which outputs the release runtime image; the other branch flows to the build image. The build image enters the developer source code and dependency management stage. The developer source code and dependency management stage outputs four branches: compiling single packages and full packages, vehicle debugging, visual dependencies, and x86 simulation debugging. The vehicle debugging stage outputs the release installation package.

[0022] This embodiment describes a CMake project build method based on CyberRT. The complete execution steps are as follows: Step S1: Perform preprocessing modifications on the CyberRT repository source code. This step is performed as follows: Step S101: Remove the common_msgs folder and build contents from the source code. All subsequent data types will be provided by the project's specified directory. Step S102: Add command operations for cyber-channel pub; Step S103: Add the CMake cross-compilation files; Step S104: Build the cross-compilation image and mount it to the directory specified by the compilation files; Step S105: Add ccache caching support and multi-core compilation support to Install.py, and integrate all compilation commands into Install.py to achieve unified compilation for x86 and ARM architectures; Step S106: Package the compiled dynamic library, header files, and CMake call files into the compilation image and runtime image.

[0023] Step S2: Based on the preprocessed and modified CyberRT repository source code, build independent compilation and runtime images. The steps for compiling and processing the image are as follows: 1) Copy the generated cyber folder and cyber-dep folder, keeping all contents; 2) Integrate the project's required dependencies through a Docker image, complete the dependency installation within Docker, and deploy the CyberRT communication architecture to a fixed directory for easy import and invocation by CMake; 3) Write a Docker one-click run script to achieve rapid mapping between project code and Docker image.

[0024] Image processing steps: 1) Copy the compiled cyber folder and cyber-dep folder, remove redundant compilation files such as header files and cmake files, keep only the runtime binary and dynamic library, and add the project's third-party dependency libraries; 2) Create a dedicated runtime image based on the original device image, and configure the source directive in setup.bash and the PYTHONPATH environment variable export directive in the bashrc configuration file.

[0025] Step S3: Under the compiled image, the project dependencies are parsed based on packages.yml, and the project build order is determined according to the parsed dependencies.

[0026] It reads the packages.yml configuration file to obtain the associated dependency information of each package, identifies dependent components that have not been compiled, automatically adjusts the project build order, prioritizes the compilation of dependent components, and can execute the make scan command to visualize project dependencies and intuitively display the dependency relationships between various function libraries.

[0027] Step S4: During the project build phase, the encapsulated um_lib macro is called to convert the um_lib macro into native CMake compilation statements to participate in the build, supporting single-package builds and full-package builds.

[0028] It reads the contents of the um_lib macro configured in the CMake script, converts the encapsulated macro instructions into native CMake compilation statements to participate in the project build, and the um_lib macro encapsulates the complete set of CMake configuration instructions for library creation, linking, and installation.

[0029] During the project build process, ccache caching and multi-core compilation mechanisms are enabled to match the optimal compilation scheme based on the current host hardware configuration, thereby improving compilation efficiency.

[0030] This invention configures multiple sets of dedicated make one-click compilation commands, including the make pkg-arm-r command for building single packages for ARM architecture, the make pkg-r command for building single packages for x86 architecture, the make install-arm-r command for building full projects for ARM architecture, and the make clean command for cleaning up compilation artifacts.

[0031] Step S5: Based on the constructed product, carry out debugging operations to achieve x86 simulation debugging and real vehicle debugging.

[0032] x86 architecture compilation artifacts can be directly used for device simulation and debugging. The make rsync command can synchronously transfer the specified compilation library to the vehicle device to complete the real vehicle deployment and SSH terminal debugging. When the project build encounters an error, the abnormal compilation artifacts can be cleared by the cleanup command and then rebuilt, forming a complete closed-loop process of compilation, error rollback, refactoring, and debugging.

[0033] Step S6: Process the build artifacts to generate the release installation package.

[0034] The specific packaging and release process is as follows: the compiled dynamic libraries and third-party libraries are stripped to reduce file size; configuration file parameters are assigned according to the characteristics of the robot equipment; self-starting services, running commands, tools and startup scripts are integrated; Deb system dependencies and pip software dependencies are integrated; and finally, a standardized tar format installation package is compressed.

[0035] This embodiment also provides a CMake project build system based on CyberRT for executing the above method, including: The source code preprocessing module is used to perform step S1 above, and to perform preprocessing and modification on the CyberRT repository source code; The image environment building module is used to execute step S2 above and build independent compilation and runtime images; The dependency management module is used to perform step S3 above, read packages.yml to parse project dependencies, determine the project build order based on the dependencies, and output the dependency graph in response to dependency visualization commands; The compilation and packaging module is used to perform the above step S4, provides the um_lib macro and completes macro instruction conversion, supports multi-mode project building, and enables caching and multi-core compilation acceleration mechanisms. The debugging module is used to execute the above step S5, realize simulation debugging and real vehicle debugging, support file synchronization and terminal debugging functions, and complete compilation exception rollback and reconstruction. The packaging and distribution module is used to execute step S6 above, completing the optimization of compilation artifacts, parameter configuration, dependency integration, and installation package generation.

[0036] This system adapts and modifies the CyberRT repository source code through a source code preprocessing module, providing foundational support for subsequent standardized compilation and building. The image environment building module builds independent compilation and runtime images based on the modified source code, achieving isolated management of the compilation and runtime environments. The dependency management module automatically parses project dependencies and intelligently arranges the build order based on configuration files, avoiding the tediousness and errors of manual dependency management. The compilation and packaging module simplifies CMake compilation configuration, adapts to multi-mode project building, and optimizes compilation efficiency through a custom um_lib macro. The debugging module uses multi-command tools to create a closed loop between simulation debugging and real-vehicle debugging, ensuring the stability of project iterations. The packaging and release module optimizes and standardizes the output of compliant build artifacts. These modules work in an orderly and progressive manner, fully implementing the full-process CMake project building method of this invention, achieving integrated automated operation of CyberRT projects from source code modification, environment setup, compilation and building, debugging and verification to packaging and release.

[0037] The above description is merely illustrative of the embodiments of the present invention and is not intended to limit the present invention. For those skilled in the art, any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A CMake project building method based on CyberRT, characterized in that, Includes the following steps: Step S1: Perform preprocessing modifications on the CyberRT repository source code; Step S2: Based on the preprocessed and modified CyberRT repository source code, build independent compilation and runtime images; Step S3: Under the compiled image, resolve the project dependencies based on packages.yml, and determine the project build order according to the resolved dependencies; Step S4: During the project build phase, the encapsulated um_lib macro is called to convert the um_lib macro into native CMake compilation statements to participate in the build, supporting single-package builds and full-package builds; Step S5: Based on the constructed product, carry out debugging operations to achieve x86 simulation debugging and real vehicle debugging; Step S6: Process the build artifacts to generate the release installation package.

2. The CMake project building method based on CyberRT according to claim 1, characterized in that, The preprocessing modification of the CyberRT repository source code described in step S1 includes: removing the common_msgs folder and build content from the source code, with all data types provided by a directory specified by an external project; adding the cyber-channel pub command operation; adding CMake cross-compilation files; building a cross-compilation image and mounting it to the specified compilation directory; modifying the Install.py script to add ccache caching support and multi-core compilation support, and uniformly implementing x86 and ARM compilation through Install.py; and packaging the successfully compiled dynamic library, header files, and CMake call files into the compilation image and the runtime image.

3. The CMake project building method based on CyberRT according to claim 1, characterized in that, The construction of independent compiled and running images in step S2 includes a compiled image processing step and a running image processing step. The specific steps for processing the compiled image are as follows: copy the compiled cyber folder and cyber-dep folder, keeping all contents; integrate dependencies using a Docker image, install the required dependencies using apt in the Docker image, and place the CyberRT communication architecture content in the / opt fixed directory for easy import in CMake; write a one-click Docker script to map the project code to the Docker image; The specific steps for processing the runtime image are as follows: copy the compiled cyber folder and cyber-dep folder, remove the header files and CMake files, keep only the runtime binary and dynamic libraries, and add the project's third-party dependency libraries; create the runtime image based on the manufacturer's original image, and add the source directive of setup.bash and the export directive of PYTHONPATH to bashrc.

4. The CMake project building method based on CyberRT according to claim 1, characterized in that, The step S3, which involves parsing the project dependencies based on packages.yml and determining the project build order according to the parsed dependencies, includes: reading packages.yml and parsing the dependencies between various software packages; identifying dependencies that have not been built and automatically adjusting the build order, prioritizing the compilation of dependent components; and calling a dependency visualization command to output a dependency graph between libraries.

5. A CMake project building method based on CyberRT according to claim 1, characterized in that, In step S4, the project build phase calls the encapsulated um_lib macro, converting the um_lib macro into native CMake compilation statements to participate in the build process. Specifically, the um_lib macro encapsulates the CMake statements for add_library, target_link_libraries, and install; the content of the um_lib macro in the CMake script is read, converted into the corresponding native CMake statements, and then used in the build process.

6. A CMake project building method based on CyberRT according to claim 5, characterized in that, The support for single-package and full-package builds mentioned in step S4 is achieved through preset make commands. The preset make commands include the make pkg-arm-r command for single-package builds on ARM architecture, the make pkg-r command for single-package builds on x86 architecture, the make install-arm-r command for full-package builds on ARM architecture, and the make clean command for cleaning up the current build content.

7. A CMake project building method based on CyberRT according to claim 1, characterized in that, The debugging operation described in step S5, based on the built artifacts, to achieve x86 simulation debugging and real vehicle debugging, specifically involves: performing a dependency visualization scan using the `make scan` command; transferring the currently specified library to the actual vehicle body using the `make rsync` command; using the x86 architecture single-package build artifact for x86 simulation debugging; using the build artifact synchronously transferred to the vehicle body for real vehicle debugging, supporting SSH terminal debugging; and performing a cleanup operation and rebuilding after an error occurs, forming a closed loop of build-error rollback-rebuild-debugging.

8. A CMake project building method based on CyberRT according to claim 1, characterized in that, Step S6 describes processing the build artifacts to generate a release installation package, specifically: performing a strip operation on the compiled dynamic libraries and third-party libraries to reduce their space usage; assigning values ​​to the configuration files according to the robot's characteristics; placing the self-starting service, startup command, tools, and startup script into the release installation package; and integrating Deb dependencies and pip dependencies. The final output is a compressed tar archive.

9. A CMake project build system based on CyberRT, used to implement the CMake project build method based on CyberRT as described in any one of claims 1-8, characterized in that, include: The source code preprocessing module is used to perform preprocessing and modification on the source code of the CyberRT repository; The image environment build module is used to build independent compile images and runtime images; The dependency management module is used to read packages.yml, parse project dependencies, and determine the project build order based on the dependencies. The compilation and packaging module provides the um_lib macro, which is converted into native CMake compilation statements to participate in the build process, supporting both single-package and full-package builds. The debugging module is used to perform debugging operations, enabling x86 simulation debugging and real vehicle debugging. The packaging and distribution module is used to process the build artifacts and generate a distribution installation package.

10. A CMake project build system based on CyberRT according to claim 9, characterized in that, The dependency management module is also used to receive dependency visualization instructions and output a dependency graph between libraries; the debugging module integrates single package synchronization function and SSH terminal debugging function; the packaging and publishing module has the ability to perform strip operations, assign values ​​to configuration files, integrate Deb dependencies and pip dependencies, and compress and output tar packages.