-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
74 lines (59 loc) · 1.46 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
cmake_minimum_required(VERSION 3.8)
project(tr1200_base)
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(hardware_interface REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(sensor_msgs REQUIRED)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(ARCH "x86_64")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(ARCH "aarch64")
else()
message(FATAL_ERROR "Unknown System Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
link_directories(lib/${ARCH})
include_directories(include)
set(ROS_DEPENDENCIES
hardware_interface
rclcpp
rclcpp_lifecycle
sensor_msgs
)
add_library(${PROJECT_NAME} SHARED
src/hardware.cpp
)
ament_target_dependencies(${PROJECT_NAME}
${ROS_DEPENDENCIES}
)
target_link_libraries(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/lib/${ARCH}/libtr1200_driver.so
)
pluginlib_export_plugin_description_file(hardware_interface ${PROJECT_NAME}.xml)
install(
DIRECTORY
include/
DESTINATION
include
)
install(
TARGETS ${PROJECT_NAME}
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(
FILES
lib/${ARCH}/libtr1200_driver.so
DESTINATION
lib/${PACKAGE_NAME}
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()