forked from pantor/frankx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (66 loc) · 2.45 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
cmake_minimum_required(VERSION 3.11)
project(frankx VERSION 0.2.0 LANGUAGES CXX)
include(GNUInstallDirs)
option(BUILD_EXAMPLES "Build example programs" ON)
option(BUILD_PYTHON_MODULE "Build python module" ON)
option(BUILD_TESTS "Build tests" ON)
option(USE_PYTHON_EXTENSION "Use python in frankx library" ON)
find_package(Eigen3 3.3.7 REQUIRED NO_MODULE)
find_package(Franka 0.8 REQUIRED)
message("Found Eigen Version: ${Eigen3_VERSION}")
message("Found Franka Version: ${Franka_VERSION}")
add_subdirectory(affx)
add_subdirectory(ruckig)
add_library(movex src/movex/path.cpp)
target_compile_features(movex PUBLIC cxx_std_17)
target_include_directories(movex PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(movex PUBLIC affx ruckig)
add_library(frankx
src/frankx/gripper.cpp
src/frankx/kinematics.cpp
src/frankx/robot.cpp
)
target_compile_features(frankx PUBLIC cxx_std_17)
target_include_directories(frankx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(frankx PUBLIC Franka::Franka Eigen3::Eigen movex)
if(BUILD_PYTHON_MODULE)
# Check if pybind11 exists as a subdirectory
if(EXISTS pybind11)
add_subdirectory(pybind11)
else()
find_package(Python COMPONENTS Interpreter Development)
find_package(pybind11 2.6 REQUIRED)
endif()
if(USE_PYTHON_EXTENSION)
target_compile_definitions(frankx PUBLIC WITH_PYTHON)
target_link_libraries(frankx PUBLIC pybind11::embed)
endif()
pybind11_add_module(_frankx src/frankx/python.cpp)
target_link_libraries(_frankx PUBLIC frankx)
# Movex python package for development
pybind11_add_module(_movex src/movex/python.cpp)
target_compile_features(_movex PUBLIC cxx_std_17)
target_include_directories(_movex PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include pybind11::embed)
target_link_libraries(_movex PUBLIC Eigen3::Eigen movex)
endif()
if(BUILD_EXAMPLES)
foreach(example IN ITEMS linear grasping)
add_executable(${example} "examples/${example}.cpp")
target_link_libraries(${example} PRIVATE frankx)
endforeach()
endif()
if(BUILD_TESTS)
enable_testing()
find_package(Catch2 REQUIRED)
foreach(test IN ITEMS kinematics-test unit-test path-test)
add_executable(${test} "test/${test}.cpp")
target_link_libraries(${test} PRIVATE frankx Catch2::Catch2)
add_test(NAME ${test} COMMAND ${test})
endforeach()
endif()
install(TARGETS frankx
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)