-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (62 loc) · 1.86 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
project(ec_dds)
cmake_minimum_required(VERSION 3.0)
set(ENABLE_XENO OFF CACHE BOOL "Enable xenomai real-time features")
if ( ${ENABLE_XENO} )
option(CMAKE_USE_XENOMAI "Use Xenomai libraries" ON)
find_package(Xenomai REQUIRED)
if(TARGET Xenomai::cobalt)
set(USE_COBALT True)
endif()
else ()
option(CMAKE_USE_XENOMAI "Use Xenomai libraries" OFF)
endif()
find_package(ecat_client_advr REQUIRED)
# Find requirements
# if(NOT fastcdr_FOUND)
# find_package(fastcdr REQUIRED)
# endif()
find_package(fastcdr REQUIRED)
find_package(fastrtps REQUIRED)
find_package(Eigen3 REQUIRED)
# if(NOT fastrtps_FOUND)
# find_package(fastrtps REQUIRED)
# endif()
#Check C++17
include(CheckCXXCompilerFlag)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
check_cxx_compiler_flag(-std=c++17 SUPPORTS_CXX17)
if(NOT SUPPORTS_CXX17)
message(FATAL_ERROR "Compiler doesn't support C++17")
endif()
endif()
file(GLOB DDS_HELLOWORLD_EXAMPLE_SOURCES_CXX "src/messages/ecat*.cxx")
file(GLOB DDS_HELLOWORLD_EXAMPLE_SOURCES_CPP "src/messages/ecat*.cpp")
add_executable(${PROJECT_NAME}
src/ec_hydraulic_control.cpp
src/pub_valve.cpp
src/sub_valve_ref.cpp
src/utils.cpp
src/custom_pid.cpp
${DDS_HELLOWORLD_EXAMPLE_SOURCES_CXX} ${DDS_HELLOWORLD_EXAMPLE_SOURCES_CPP})
target_include_directories(${PROJECT_NAME}
PUBLIC
include
src/messages
${EIGEN3_INCLUDE_DIR}
)
if ( Xenomai_FOUND )
xenomai_target_bootstrap(${PROJECT_NAME} SKINS posix)
xenomai_target_bootstrap(${PROJECT_NAME} SKINS posix)
endif()
target_link_libraries(${PROJECT_NAME}
PUBLIC
ecat_client_advr::ec_library
ecat_master::tools_utils
fastrtps
fastcdr
fastdds::optionparser
fmt
)
install(TARGETS ${PROJECT_NAME}
DESTINATION bin
COMPONENT applications)