@@ -2,25 +2,33 @@ cmake_minimum_required(VERSION 3.5)
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
@@ -54,13 +62,13 @@ set(${PROJECT_NAME}_sources
5462 src/rcl/lexer.c
5563 src/rcl/lexer_lookahead.c
5664 src/rcl/localhost.c
57- src/rcl/logging_rosout.c
58- src/rcl/logging.c
59- src/rcl/log_level.c
65+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src/rcl/logging_rosout.c>
66+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src/rcl/logging.c>
67+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src/rcl/log_level.c>
6068 src/rcl/network_flow_endpoints.c
6169 src/rcl/node.c
6270 src/rcl/node_options.c
63- src/rcl/node_type_cache.c
71+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src/rcl/node_type_cache.c>
6472 src/rcl/publisher.c
6573 src/rcl/remap.c
6674 src/rcl/node_resolve_name.c
@@ -72,7 +80,7 @@ set(${PROJECT_NAME}_sources
7280 src/rcl/time.c
7381 src/rcl/timer.c
7482 src/rcl/type_hash.c
75- src/rcl/type_description_conversions.c
83+ $<$< NOT :$< BOOL : ${RCL_MICROROS} >>: src/rcl/type_description_conversions.c>
7684 src/rcl/validate_enclave_name.c
7785 src/rcl/validate_topic_name.c
7886 src/rcl/wait.c
@@ -88,20 +96,44 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
8896 ${rcl_interfaces_TARGETS}
8997 # TODO(clalancette): rcl_logging_interface should be PRIVATE, but downstream depends on it for now
9098 rcl_logging_interface::rcl_logging_interface
91- rcl_yaml_param_parser::rcl_yaml_param_parser
9299 rcutils::rcutils
93100 rmw::rmw
94101 # TODO(clalancette): rmw_implementation should be PRIVATE, but downstream depends on it for now
95102 rmw_implementation::rmw_implementation
96103 rosidl_runtime_c::rosidl_runtime_c
97104 ${type_description_interfaces_TARGETS}
98105)
106+
107+ target_link_libraries (${PROJECT_NAME} PRIVATE
108+ tracetools::tracetools
109+ )
110+
111+ if (NOT RCL_MICROROS)
99112target_link_libraries (${PROJECT_NAME} PRIVATE
100113 ${RCL_LOGGING_IMPL} ::${RCL_LOGGING_IMPL}
101114 ${service_msgs_TARGETS}
102- tracetools::tracetools
103115 yaml
104116)
117+ endif ()
118+
119+ if (NOT RCL_MICROROS)
120+ ament_target_dependencies(${PROJECT_NAME}
121+ "rcl_yaml_param_parser"
122+ )
123+ endif ()
124+
125+ if (NOT RCL_MICROROS)
126+ ament_target_dependencies(${PROJECT_NAME}
127+ ${RCL_LOGGING_IMPL}
128+ )
129+ endif ()
130+
131+ if (NOT RCL_MICROROS)
132+ target_compile_definitions (${PROJECT_NAME}
133+ PUBLIC
134+ RCL_MICROROS_COMPLETE_IMPL
135+ )
136+ endif ()
105137
106138# Allow configuring the default discovery range
107139if (DEFINED RCL_DEFAULT_DISCOVERY_RANGE)
@@ -141,14 +173,21 @@ ament_export_dependencies(ament_cmake)
141173ament_export_dependencies(rcl_interfaces)
142174# TODO(clalancette): rcl_logging_interface shouldn't be exported, but downstream depends on it for now
143175ament_export_dependencies(rcl_logging_interface)
144- ament_export_dependencies(rcl_yaml_param_parser)
145176ament_export_dependencies(rcutils)
146177ament_export_dependencies(rmw)
147178# TODO(clalancette): rmw_implementation shouldn't be exported, but downstream depends on it for now
148179ament_export_dependencies(rmw_implementation)
149180ament_export_dependencies(rosidl_runtime_c)
150181ament_export_dependencies(type_description_interfaces)
151- ament_generate_version_header(${PROJECT_NAME} )
182+ ament_export_dependencies(tracetools)
183+
184+ if (NOT RCL_MICROROS)
185+ ament_export_dependencies(rcl_yaml_param_parser)
186+ endif ()
187+
188+ if (NOT RCL_MICROROS)
189+ ament_export_dependencies(${RCL_LOGGING_IMPL} )
190+ endif ()
152191
153192if (BUILD_TESTING)
154193 find_package (ament_lint_auto REQUIRED)
0 commit comments