@@ -7,8 +7,16 @@ project(spaceether LANGUAGES C CXX VERSION 1.0.0)
77option (SPACEE_BUILD_TOOLS "Build SpaceEther example tools" ON )
88option (SPACEE_BUILD_TESTS "Build SpaceEther test suite" ON )
99option (SPACEE_SANITIZE "Enable ASan/UBSan" OFF )
10- option (SPACEE_ENABLE_AUTH "Enable HMAC footer verification" OFF )
11- option (SPACEE_WITH_ROS2 "Build ROS 2 bridge and ROS 2 tests" OFF )
10+
11+ # Always compile with authentication enabled. If SPACEE_AUTH_KEY is
12+ # unset at runtime the HMAC will be omitted, but the code remains
13+ # available. This avoids surprise compile‑time omissions.
14+ set (SPACEE_ENABLE_AUTH ON CACHE BOOL "Enable HMAC footer verification" FORCE)
15+
16+ # Enable ROS 2 integration by default. The bridge and tests will be
17+ # built when a ROS 2 installation is present. On systems without
18+ # ROS 2 the CMake script will gracefully skip these targets.
19+ set (SPACEE_WITH_ROS2 ON CACHE BOOL "Build ROS 2 bridge and ROS 2 tests" FORCE)
1220
1321# -------------------------
1422# Toolchain / warnings
@@ -45,13 +53,12 @@ set(SPACEE_CORE_SOURCES
4553 src/raw_udp.cpp
4654)
4755
48- if (SPACEE_ENABLE_AUTH)
49- list (APPEND SPACEE_CORE_SOURCES
50- src/hmac_sha256.c
51- src/sha256.c
52- )
53- add_compile_definitions (SPACEE_ENABLE_AUTH)
54- endif ()
56+ # Always include HMAC support. The code itself will skip HMAC
57+ # generation when SPACEE_AUTH_KEY is unset at runtime.
58+ list (APPEND SPACEE_CORE_SOURCES
59+ src/hmac_sha256.c
60+ src/sha256.c
61+ )
5562
5663# -------------------------
5764# Library
@@ -75,29 +82,32 @@ if(SPACEE_BUILD_TOOLS)
7582 target_link_libraries (se_terminal PRIVATE space_ether Threads::Threads)
7683endif ()
7784
78- # # -------------------------
79- # # Optional ROS 2 bridge (no ament_target_dependencies; keyword linking only)
80- # # -------------------------
81- # if(SPACEE_WITH_ROS2)
82- # find_package(rclcpp QUIET)
83- # find_package(std_msgs QUIET)
84- # if(rclcpp_FOUND AND std_msgs_FOUND)
85- # if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/ros2_shim.cpp")
86- # target_sources(space_ether PRIVATE src/ros2_shim.cpp)
87- # endif()
88-
89- # add_executable(spaceether_ros2_bridge bridges/spaceether_ros2_bridge.cpp)
90- # target_link_libraries(spaceether_ros2_bridge
91- # PRIVATE
92- # space_ether
93- # Threads::Threads
94- # rclcpp::rclcpp
95- # std_msgs::std_msgs
96- # )
97- # else()
98- # message(STATUS "ROS 2 (rclcpp/std_msgs) not found — skipping spaceether_ros2_bridge.")
99- # endif()
100- # endif()
85+ # -------------------------
86+ # Optional ROS 2 bridge (no ament_target_dependencies; keyword linking only)
87+ # -------------------------
88+ if (SPACEE_WITH_ROS2)
89+ find_package (rclcpp QUIET )
90+ find_package (std_msgs QUIET )
91+ if (rclcpp_FOUND AND std_msgs_FOUND)
92+ # Build the RTPS shim into the core library if available
93+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR} /src/ros2_shim.cpp" )
94+ target_sources (space_ether PRIVATE src/ros2_shim.cpp)
95+ endif ()
96+ # Build the example ROS 2 bridge. This executable bridges
97+ # SpaceEther frames to ROS 2 std_msgs/String messages for
98+ # demonstration purposes.
99+ add_executable (spaceether_ros2_bridge bridges/spaceether_ros2_bridge.cpp)
100+ target_link_libraries (spaceether_ros2_bridge
101+ PRIVATE
102+ space_ether
103+ Threads::Threads
104+ rclcpp::rclcpp
105+ std_msgs::std_msgs
106+ )
107+ else ()
108+ message (STATUS "ROS 2 (rclcpp/std_msgs) not found — skipping spaceether_ros2_bridge." )
109+ endif ()
110+ endif ()
101111
102112# tests/CMakeLists.txt
103113
0 commit comments