From a5cea2c44d30ba626b94b287e97d9ed6d37af106 Mon Sep 17 00:00:00 2001 From: zhangyi1357 Date: Tue, 19 Nov 2024 20:42:11 +0800 Subject: [PATCH] build: exclude ROS2 specific files from the build if not using ROS2 Remove ROS2-related source files from the compilation when the project is configured without ROS2 support, helping to streamline the build process and avoid unnecessary dependencies. --- src/runtime/python_runtime/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/runtime/python_runtime/CMakeLists.txt b/src/runtime/python_runtime/CMakeLists.txt index 10589033..89ca7a13 100644 --- a/src/runtime/python_runtime/CMakeLists.txt +++ b/src/runtime/python_runtime/CMakeLists.txt @@ -15,6 +15,11 @@ set(CUR_TARGET_ALIAS_NAME ${CUR_SUPERIOR_NAMESPACE}::${CUR_DIR}) # Set file collection file(GLOB_RECURSE src CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) file(GLOB_RECURSE py_files CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.py) +file(GLOB_RECURSE ros2_files CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ros2_type_support_utils.cc) + +if (NOT AIMRT_BUILD_WITH_ROS2) + list(REMOVE_ITEM src ${ros2_files}) +endif() # Add target pybind11_add_module(${CUR_TARGET_NAME} SHARED)