forked from PickNikRobotics/generate_parameter_library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
83 lines (72 loc) · 2.94 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 3.16)
project(generate_parameter_library_example)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion -Wold-style-cast)
endif()
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(generate_parameter_library REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(rclpy REQUIRED)
generate_parameter_library(admittance_controller_parameters
src/parameters.yaml
include/generate_parameter_library_example/example_validators.hpp
)
add_library(minimal_publisher SHARED
src/minimal_publisher.cpp
)
target_include_directories(minimal_publisher PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/generate_parameter_library_example>
)
target_link_libraries(minimal_publisher
PUBLIC
admittance_controller_parameters
rclcpp::rclcpp
rclcpp_components::component
)
rclcpp_components_register_node(minimal_publisher
PLUGIN "admittance_controller::MinimalPublisher"
EXECUTABLE test_node
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt
set(ament_cmake_flake8_FOUND TRUE) # Conflicts with black
set(ament_cmake_uncrustify_FOUND TRUE) # Conflicts with clang-format
ament_lint_auto_find_test_dependencies()
find_package(ament_cmake_gtest REQUIRED)
# example_test_gtest
add_rostest_with_parameters_gtest(test_example_gtest test/example_test_gtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/example_params.yaml)
target_include_directories(test_example_gtest PRIVATE include)
target_link_libraries(test_example_gtest admittance_controller_parameters rclcpp::rclcpp)
# descriptor_test_gtest
add_rostest_with_parameters_gtest(test_descriptor_gtest test/descriptor_test_gtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/example_params.yaml)
target_include_directories(test_descriptor_gtest PRIVATE include)
target_link_libraries(test_descriptor_gtest admittance_controller_parameters rclcpp::rclcpp)
find_package(ament_cmake_gmock REQUIRED)
add_rostest_with_parameters_gmock(test_example_gmock test/example_test_gmock.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/example_params.yaml)
target_include_directories(test_example_gmock PRIVATE include)
target_link_libraries(test_example_gmock admittance_controller_parameters rclcpp::rclcpp)
endif()
install(
DIRECTORY include/
DESTINATION include/generate_parameter_library_example
)
install(TARGETS minimal_publisher admittance_controller_parameters
EXPORT export_generate_parameter_library_example
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(
TARGETS test_node
DESTINATION lib/generate_parameter_library_example
)
ament_export_targets(export_generate_parameter_library_example HAS_LIBRARY_TARGET)
ament_export_dependencies(rclcpp rclcpp_components)
ament_package()