Add some test cmake script code related to ROS2.

This commit is contained in:
Marcel Pi 2024-09-12 16:41:40 +02:00
parent abdff1716f
commit f41c5c89c9
4 changed files with 139 additions and 4 deletions

View File

@ -249,4 +249,59 @@ if (BUILD_CARLA_UNREAL)
)
endif ()
if (ENABLE_ROS2)
carla_dependency_option (
FOONATHAN_MEMORY_FORCE_VENDORED_BUILD
ON
)
carla_git_dependency_add (
foonathan_memory
${CARLA_FOONATHAN_MEMORY_TAG}
https://github.com/eProsima/foonathan_memory_vendor/archive/refs/tags/${CARLA_FOONATHAN_MEMORY_TAG}.zip
https://github.com/eProsima/foonathan_memory_vendor.git
)
include_directories (
${foonathan_memory_SOURCE_DIR}
${foonathan_memory_BINARY_DIR}
)
carla_git_dependency_add (
fastcdr
${CARLA_FAST_CDR_TAG}
https://github.com/eProsima/Fast-CDR/archive/refs/tags/${CARLA_FAST_CDR_TAG}.zip
https://github.com/eProsima/Fast-CDR.git
)
include_directories (
${fastcdr_SOURCE_DIR}
${fastcdr_BINARY_DIR}
)
carla_dependency_option (
THIRDPARTY_Asio
ON
)
carla_dependency_option (
THIRDPARTY_TinyXML2
ON
)
carla_dependency_option (
COMPILE_TOOLS
ON
)
# We currently git clone fast-dds to handle submodules:
carla_git_dependency_add (
fastdds
${CARLA_FAST_DDS_TAG}
https://github.com/eProsima/Fast-DDS/archive/refs/tags/${CARLA_FAST_DDS_TAG}.zip
https://github.com/eProsima/Fast-DDS.git
)
endif ()
carla_dependencies_make_available ()

View File

@ -394,3 +394,45 @@ carla_string_option (
"Target StreetMap git tag."
${CARLA_STREETMAP_VERSION}
)
# ==== FOONATHAN MEMORY ====
carla_string_option (
CARLA_FOONATHAN_MEMORY_VERSION
"Target foonathan_memory version."
1.3.1
)
carla_string_option (
CARLA_FOONATHAN_MEMORY_TAG
"Target foonathan_memory git tag."
v${CARLA_FOONATHAN_MEMORY_VERSION}
)
# ==== FAST-CDR ====
carla_string_option (
CARLA_FAST_CDR_VERSION
"Target Fast-CDR version."
2.2.4
)
carla_string_option (
CARLA_FAST_CDR_TAG
"Target Fast-CDR git tag."
v${CARLA_FAST_CDR_VERSION}
)
# ==== FAST-DDS ====
carla_string_option (
CARLA_FAST_DDS_VERSION
"Target Fast-DDS version."
3.0.0
)
carla_string_option (
CARLA_FAST_DDS_TAG
"Target Fast-DDS git tag."
v${CARLA_FAST_DDS_VERSION}
)

View File

@ -82,10 +82,6 @@ if (BUILD_OSM_WORLD_RENDERER)
add_subdirectory (osm-world-renderer)
endif ()
if (ENABLE_ROS2)
add_subdirectory (Ros2Native)
endif()
if (BUILD_PYTHON_API)
add_subdirectory (PythonAPI)
endif ()

View File

@ -306,3 +306,45 @@ if (BUILD_CARLA_CLIENT)
)
endif ()
if (ENABLE_ROS2)
file (
GLOB
LIBCARLA_ROS2_HEADERS
${LIBCARLA_SOURCE_PATH}/carla/ros2/publishers/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/subscribers/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/listeners/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/types/*.h
)
file (
GLOB
LIBCARLA_ROS2_SOURCES
${LIBCARLA_SOURCE_PATH}/carla/ros2/publishers/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/subscribers/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/listeners/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/types/*.cpp
)
carla_add_library (
carla-ros2-native
${LIBCARLA_ROS2_HEADERS}
${LIBCARLA_ROS2_SOURCES}
)
target_compile_definitions (
carla-ros2-native PUBLIC
BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
)
install (
TARGETS
carla-ros2-native
DESTINATION
lib
)
endif ()