Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update cmake and package files #22

Merged
merged 4 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/build-verification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function install_prerequisites () {
echo "[${FUNCNAME[0]}]: update and install dependent packages."
apt update && apt upgrade -y
apt install -y ros-${ROS_DISTRO}-desktop ros-${ROS_DISTRO}-rmw-cyclonedds-cpp --no-install-recommends
apt install -y libyaml-cpp-dev libboost-program-options-dev libboost-filesystem-dev
cd $there
}

Expand Down
41 changes: 31 additions & 10 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,56 @@
cmake_minimum_required(VERSION 3.5)
project(parameter_server VERSION 1.0.0)
project(parameter_server VERSION 1.0.1)

# Default to C++14
# Set Release build if no build type was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Build type for the build. Possible values are: Debug, Release, RelWithDebInfo, MinSizeRel"
FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif()

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

# Enable additional warnings and warnings as errors
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)

find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(rcutils)
find_package(rcutils REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rmw REQUIRED)

find_package(Boost REQUIRED COMPONENTS program_options filesystem)
find_package(yaml_cpp_vendor REQUIRED)

include_directories(include)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${yaml_cpp_vendor_INCLUDE_DIRS})
find_package(yaml-cpp REQUIRED)

add_executable(server
src/parameter_server.cpp
src/main.cpp
)
ament_target_dependencies(server rclcpp rclcpp_components std_msgs)
target_link_libraries(server ${Boost_LIBRARIES} ${yaml_cpp_vendor_LIBRARIES})

target_link_libraries(server
rclcpp::rclcpp
rcutils::rcutils
${Boost_LIBRARIES}
yaml-cpp::yaml-cpp
)

target_include_directories(server
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

ament_target_dependencies(server rclcpp rclcpp_components std_msgs rcutils)

install(TARGETS server DESTINATION lib/${PROJECT_NAME})

Expand Down
23 changes: 8 additions & 15 deletions server/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>parameter_server</name>
<version>1.0.0</version>
<version>1.0.1</version>
<description>
ros2 parameter server that other nodes can write/read parameters including persistent parameters.
</description>
Expand All @@ -12,22 +12,15 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>rclcpp</build_depend>
<build_depend>rclcpp_components</build_depend>
<build_depend>rcutils</build_depend>
<build_depend>rmw</build_depend>
<build_depend>rmw_implementation_cmake</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>yaml_cpp_vendor</build_depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>rcutils</depend>
<depend>rmw</depend>
<depend>rmw_implementation_cmake</depend>
<depend>std_msgs</depend>
<depend>yaml_cpp_vendor</depend>

<exec_depend>launch_ros</exec_depend>
<exec_depend>rclcpp</exec_depend> <exec_depend>yaml_cpp_vendor</exec_depend>

<exec_depend>rclcpp_components</exec_depend>
<exec_depend>rcutils</exec_depend>
<exec_depend>rmw</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>yaml_cpp_vendor</exec_depend>

<test_depend>ament_cmake_pytest</test_depend>
<test_depend>ament_lint_auto</test_depend>
Expand Down
35 changes: 28 additions & 7 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,50 @@
cmake_minimum_required(VERSION 3.5)
project(ros2_persistent_parameter_server_test)
project(ros2_persistent_parameter_server_test VERSION 1.0.1)

# Set Release build if no build type was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Build type for the build. Possible values are: Debug, Release, RelWithDebInfo, MinSizeRel"
FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif()

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

# Enable additional warnings and warnings as errors
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp_components REQUIRED)

find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(rcutils REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rmw REQUIRED)

include_directories(include)

add_executable(client
src/test.cpp
src/persist_parameter_client.cpp
)

ament_target_dependencies(client rclcpp rclcpp_components)
target_link_libraries(client
rclcpp::rclcpp
rcutils::rcutils
)

target_include_directories(client
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

ament_target_dependencies(client rclcpp rclcpp_components std_msgs rcutils)

install(TARGETS client DESTINATION lib/${PROJECT_NAME})

Expand Down
27 changes: 13 additions & 14 deletions test/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>ros2_persistent_parameter_server_test</name>
<version>1.0.0</version>
<description>Client test demo for persistent parameter server</description>
<maintainer email="Bingtao.Du@sony.com">dbt</maintainer>
<version>1.0.1</version>
<description>
Client test demo for persistent parameter server
</description>
<maintainer email="Tomoya.Fujita@sony.com">dbt</maintainer>
<license>Apache License 2.0</license>
<author email="Tomoya.Fujita@sony.com">Tomoya Fujita></author>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>rclcpp</build_depend>
<build_depend>rclcpp_components</build_depend>
<build_depend>rcutils</build_depend>
<build_depend>rmw</build_depend>
<build_depend>rmw_implementation_cmake</build_depend>
<build_depend>std_msgs</build_depend>

<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>rcutils</depend>
<depend>rmw</depend>
<depend>rmw_implementation_cmake</depend>
<depend>std_msgs</depend>

<exec_depend>launch_ros</exec_depend>
<exec_depend>rclcpp</exec_depend>
<exec_depend>rclcpp_components</exec_depend>
<exec_depend>rcutils</exec_depend>
<exec_depend>rmw</exec_depend>
<exec_depend>std_msgs</exec_depend>

<test_depend>launch</test_depend>
<test_depend>ament_lint_auto</test_depend>
Expand Down
Loading