@@ -2,25 +2,33 @@ cmake_minimum_required(VERSION 3.20)
22
33project (rcl)
44
5+ option (RCL_MICROROS "micro-ROS build mode" ON )
6+
57find_package (ament_cmake_ros REQUIRED )
68find_package (ament_cmake_gen_version_h REQUIRED )
79
8- find_package (libyaml_vendor REQUIRED )
910find_package (rcl_interfaces REQUIRED )
1011find_package (rcl_logging_interface REQUIRED )
11- find_package (rcl_yaml_param_parser REQUIRED )
1212find_package (rcutils REQUIRED )
1313find_package (rmw REQUIRED )
1414find_package (rmw_implementation REQUIRED )
1515find_package (rosidl_runtime_c REQUIRED )
1616find_package (service_msgs REQUIRED )
1717find_package (tracetools REQUIRED )
1818find_package (type_description_interfaces REQUIRED )
19- find_package (yaml REQUIRED )
19+
20+ if (NOT RCL_MICROROS)
21+ find_package (libyaml_vendor REQUIRED )
22+ find_package (yaml REQUIRED )
23+ find_package (rcl_yaml_param_parser REQUIRED )
24+ endif ()
2025
2126include (cmake/rcl_set_symbol_visibility_hidden.cmake )
22- include (cmake/get_default_rcl_logging_implementation.cmake )
23- get_default_rcl_logging_implementation (RCL_LOGGING_IMPL )
27+
28+ if (NOT RCL_MICROROS)
29+ include (cmake/get_default_rcl_logging_implementation.cmake )
30+ get_default_rcl_logging_implementation (RCL_LOGGING_IMPL )
31+ endif ()
2432
2533# Default to C11
2634if (NOT CMAKE_C_STANDARD )
@@ -38,7 +46,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
3846endif ()
3947
4048set (${PROJECT_NAME} _sources
41- src/rcl/arguments.c
49+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src /rcl /arguments .c >
4250 src/rcl/client.c
4351 src/rcl/common.c
4452 src/rcl/context.c
@@ -53,13 +61,13 @@ set(${PROJECT_NAME}_sources
5361 src/rcl/init_options.c
5462 src/rcl/lexer.c
5563 src/rcl/lexer_lookahead.c
56- src/rcl/logging_rosout.c
57- src/rcl/logging.c
58- src/rcl/log_level.c
64+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src /rcl /logging_rosout .c >
65+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src /rcl /logging .c >
66+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src /rcl /log_level .c >
5967 src/rcl/network_flow_endpoints.c
6068 src/rcl/node.c
6169 src/rcl/node_options.c
62- src/rcl/node_type_cache.c
70+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src /rcl /node_type_cache .c >
6371 src/rcl/publisher.c
6472 src/rcl/remap.c
6573 src/rcl/node_resolve_name.c
@@ -71,7 +79,7 @@ set(${PROJECT_NAME}_sources
7179 src/rcl/time.c
7280 src/rcl/timer.c
7381 src/rcl/type_hash.c
74- src/rcl/type_description_conversions.c
82+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src /rcl /type_description_conversions .c >
7583 src/rcl/validate_enclave_name.c
7684 src/rcl/validate_topic_name.c
7785 src/rcl/wait.c
@@ -87,20 +95,44 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
8795 ${rcl_interfaces_TARGETS}
8896 # TODO(clalancette): rcl_logging_interface should be PRIVATE, but downstream depends on it for now
8997 rcl_logging_interface::rcl_logging_interface
90- rcl_yaml_param_parser::rcl_yaml_param_parser
9198 rcutils::rcutils
9299 rmw::rmw
93100 # TODO(clalancette): rmw_implementation should be PRIVATE, but downstream depends on it for now
94101 rmw_implementation::rmw_implementation
95102 rosidl_runtime_c::rosidl_runtime_c
96103 ${type_description_interfaces_TARGETS}
97104)
105+
106+ target_link_libraries (${PROJECT_NAME} PRIVATE
107+ tracetools::tracetools
108+ )
109+
110+ if (NOT RCL_MICROROS)
98111target_link_libraries (${PROJECT_NAME} PRIVATE
99112 ${RCL_LOGGING_IMPL} ::${RCL_LOGGING_IMPL}
100113 ${service_msgs_TARGETS}
101- tracetools::tracetools
102114 yaml
103115)
116+ endif ()
117+
118+ if (NOT RCL_MICROROS)
119+ ament_target_dependencies (${PROJECT_NAME}
120+ "rcl_yaml_param_parser"
121+ )
122+ endif ()
123+
124+ if (NOT RCL_MICROROS)
125+ ament_target_dependencies (${PROJECT_NAME}
126+ ${RCL_LOGGING_IMPL}
127+ )
128+ endif ()
129+
130+ if (NOT RCL_MICROROS)
131+ target_compile_definitions (${PROJECT_NAME}
132+ PUBLIC
133+ RCL_MICROROS_COMPLETE_IMPL
134+ )
135+ endif ()
104136
105137# Allow configuring the default discovery range
106138if (DEFINED RCL_DEFAULT_DISCOVERY_RANGE)
@@ -140,14 +172,21 @@ ament_export_dependencies(ament_cmake)
140172ament_export_dependencies (rcl_interfaces )
141173# TODO(clalancette): rcl_logging_interface shouldn't be exported, but downstream depends on it for now
142174ament_export_dependencies (rcl_logging_interface )
143- ament_export_dependencies (rcl_yaml_param_parser )
144175ament_export_dependencies (rcutils )
145176ament_export_dependencies (rmw )
146177# TODO(clalancette): rmw_implementation shouldn't be exported, but downstream depends on it for now
147178ament_export_dependencies (rmw_implementation )
148179ament_export_dependencies (rosidl_runtime_c )
149180ament_export_dependencies (type_description_interfaces )
150- ament_generate_version_header (${PROJECT_NAME} )
181+ ament_export_dependencies (tracetools )
182+
183+ if (NOT RCL_MICROROS)
184+ ament_export_dependencies (rcl_yaml_param_parser )
185+ endif ()
186+
187+ if (NOT RCL_MICROROS)
188+ ament_export_dependencies (${RCL_LOGGING_IMPL} )
189+ endif ()
151190
152191if (BUILD_TESTING)
153192 find_package (ament_lint_auto REQUIRED )
0 commit comments