-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathCMakeLists.txt
96 lines (80 loc) · 3.13 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
84
85
86
87
88
89
90
91
92
93
94
95
96
cmake_minimum_required(VERSION 3.10)
project(drake_ros)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wno-error=deprecated-declarations)
endif()
find_package(ament_cmake_ros REQUIRED)
find_package(drake REQUIRED)
# Must use Drake's fork of Pybind11
find_package(pybind11 REQUIRED HINTS "${drake_DIR}/../pybind11" NO_DEFAULT_PATH)
find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3)
find_package(rclcpp REQUIRED)
find_package(rosidl_runtime_c REQUIRED)
find_package(rosidl_typesupport_cpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_eigen REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(VTK REQUIRED)
add_subdirectory(core)
add_subdirectory(tf2)
add_subdirectory(viz)
# Python bindings
add_subdirectory(drake_ros)
# Ament installation must happen in top-level, including Python package
# installation.
# TODO(sloretz) exclude drake_ros/test folder
ament_python_install_package(drake_ros)
# Generate same python package in build directory for use in tests to allow
# for non-install-space testing of this package. For more information, see
#https://github.com/ros2/ros2_documentation/issues/3373
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/py/")
file(COPY "drake_ros"
DESTINATION "${PROJECT_BINARY_DIR}/py/"
PATTERN "drake_ros/test" EXCLUDE)
if(BUILD_TESTING)
find_package(ament_cmake_clang_format REQUIRED)
find_package(ament_cmake_cpplint REQUIRED)
find_package(ament_cmake_pycodestyle REQUIRED)
ament_clang_format(CONFIG_FILE .clang-format)
ament_cpplint()
# TODO(Aditya) : Remove the --exclude once https://github.com/ament/ament_lint/pull/435
# is released into ROS Humble.
ament_pycodestyle(--config pycodestyle.ini --exclude
"${CMAKE_CURRENT_SOURCE_DIR}/drake_ros/test")
endif()
### Drake library path environment hook
get_target_property(DRAKE_LIBRARY drake::drake LOCATION)
get_filename_component(DRAKE_LIBRARY_DIR ${DRAKE_LIBRARY} DIRECTORY)
if(APPLE)
set(LIBRARY_PATH_ENV_VAR "DYLD_LIBRARY_PATH")
else()
set(LIBRARY_PATH_ENV_VAR "LD_LIBRARY_PATH")
endif()
set(
AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_drake_library_path
"prepend-non-duplicate;${LIBRARY_PATH_ENV_VAR};${DRAKE_LIBRARY_DIR}")
ament_environment_hooks("env-hooks/drake_library_path.sh.in")
### Python module path environment hook for pydrake
set(
AMENT_CMAKE_ENVIRONMENT_HOOKS_DESC_pydrake_pythonpath
"prepend-non-duplicate;PYTHONPATH;${drake_PYTHON_DIR}")
ament_environment_hooks("env-hooks/pydrake_pythonpath.sh.in")
ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(drake)
ament_export_dependencies(eigen3_cmake_module)
ament_export_dependencies(Eigen3)
ament_export_dependencies(geometry_msgs)
ament_export_dependencies(rclcpp)
ament_export_dependencies(rosidl_runtime_c)
ament_export_dependencies(rosidl_typesupport_cpp)
ament_export_dependencies(tf2_eigen)
ament_export_dependencies(tf2_ros)
ament_export_dependencies(visualization_msgs)
ament_export_dependencies(VTK)
ament_package()