-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
107 lines (93 loc) · 3.52 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
97
98
99
100
101
102
103
104
105
106
107
cmake_minimum_required(VERSION 3.5.1)
project(v2x_gw)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
# Select the ITS library that should be used
set(LIB_NAME_VCITS "vcits") # - vcits ... vehicleCAPTAIN its library -> free and open source
set(LIB_NAME_OSSITS "ossits") # - ossits ... uses the same principle as vcits, but requires the oss.com asn1 generator -> license fees
set(LIB_ASN_FOLDER_OSSITS "asn1oss/include/asn1oss")
set(LIB_ASN_FOLDER_VCITS "asn1c")
if(NOT USE_ITS_LIBRARY)
set(USE_ITS_LIBRARY ${LIB_NAME_VCITS})
#set(USE_ITS_LIBRARY ${LIB_NAME_OSSITS})
endif()
if(USE_ITS_LIBRARY STREQUAL LIB_NAME_VCITS)
set(USE_ITS_LIBRARY_ASN_FOLDER ${LIB_ASN_FOLDER_VCITS})
else()
set(USE_ITS_LIBRARY_ASN_FOLDER ${LIB_ASN_FOLDER_OSSITS})
endif()
# compile options
# - activation will lead to a shitload of warnings of unused variables in autogenerated vcits lib
#if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# add_compile_options(-Wall -Wextra -Wpedantic)
#endif()
# ZeroMQ configuration
# - activate relative paths for libraries (use that for deployment; WARNING: don't use with --symlink-install -> lib won't be found by file)
# - set lib location for building and linking
# - copy the lib files
#set(CMAKE_INSTALL_RPATH "$ORIGIN")
#set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(ZEROMQ_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/include")
set(ZEROMQ_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/libzmq.so")
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/libzmq.so"
"${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/libzmq.so.5"
"${CMAKE_CURRENT_SOURCE_DIR}/ext/libzmq/libzmq.so.5.2.4"
DESTINATION lib/${PROJECT_NAME}/
)
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_auto REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(rclcpp REQUIRED)
find_package(eigen3_cmake_module)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(std_msgs REQUIRED)
find_package(dbw_ford_msgs REQUIRED)
find_package(v2x_msgs REQUIRED)
#pkg_check_modules(${USE_ITS_LIBRARY} REQUIRED)
add_subdirectory(${USE_ITS_LIBRARY})
# add executable and sources
ament_auto_add_executable(v2x_gw src/V2XGateway.cpp
src/server/V2XServer.cpp
src/server/V2XZMQServer.cpp
src/handler/${USE_ITS_LIBRARY}/V2XMHandler.cpp
src/handler/${USE_ITS_LIBRARY}/ExampleMHandler.cpp
src/handler/${USE_ITS_LIBRARY}/CAMHandler.cpp
src/handler/${USE_ITS_LIBRARY}/CPMHandler.cpp
src/handler/${USE_ITS_LIBRARY}/DENMHandler.cpp
src/handler/${USE_ITS_LIBRARY}/IVIMHandler.cpp
src/handler/${USE_ITS_LIBRARY}/IVIMUtils.cpp
)
# reference headers
target_include_directories(v2x_gw PUBLIC ${CMAKE_INSTALL_PREFIX}/include/
include
include/server
include/handler
include/utils
${ZEROMQ_INCLUDE_DIR}
${USE_ITS_LIBRARY}/${USE_ITS_LIBRARY_ASN_FOLDER}
.
)
# link libraries
ament_target_dependencies(v2x_gw rclcpp std_msgs geometry_msgs nav_msgs visualization_msgs diagnostic_msgs dbw_ford_msgs v2x_msgs tf2 tf2_ros)
target_link_libraries(v2x_gw
${ZEROMQ_LIBRARIES}
${USE_ITS_LIBRARY})
# install ros package dependencies
ament_auto_package(
INSTALL_TO_SHARE
launch
config
)