-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
167 lines (149 loc) · 4.03 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
cmake_minimum_required(VERSION 3.5.0)
project(particle_filter VERSION 1.0
DESCRIPTION "particle_filter"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -fopenmp)
endif()
# find_program(CLANGTIDY clang-tidy)
# if(CLANGTIDY)
# set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY} -extra-arg=-Wno-unknown-warning-option)
# if(${CMAKE_CXX_STANDARD})
# set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY} -extra-arg=-std=c++${CMAKE_CXX_STANDARD} --header-filter=${PROJECT_NAME})
# endif()
# endif()
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()
enable_language(CUDA)
else()
message(STATUS "No CUDA support")
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(adx_data REQUIRED)
find_package(roscomp REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(laser_geometry REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(uio_map QUIET)
find_package(yaml-cpp REQUIRED)
find_package(OpenCV REQUIRED)
find_package(OpenMP)
# uio_map library
if(uio_map_FOUND)
add_library(pl_driver STATIC
src/ray_casting/xrm.cpp
)
target_include_directories(pl_driver PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(pl_driver PUBLIC
uio_map::map
)
add_definitions(-DFPGA_SUPPORT_ENABLED)
message(STATUS "FPGA drivers detected. Compiling FPGA driver support.")
else()
message(STATUS "No FPGA drivers available.")
endif()
# ray_marching library
add_library(ray_marching
src/ray_casting/ray_marching.cpp
src/ray_casting/ray_casting.cpp
)
target_include_directories(ray_marching PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(ray_marching PUBLIC
adx_data::particle
adx_data::pose
OpenMP::OpenMP_CXX
)
if(uio_map_FOUND)
target_sources(ray_marching PRIVATE
src/ray_casting/ray_marching_fpga.cpp
)
target_link_libraries(ray_marching PUBLIC
pl_driver
)
endif()
# if (CMAKE_CUDA_COMPILER)
# add_library(
# gpuRM STATIC
# src/cudaRayMarching.cu
# )
# target_include_directories(gpuRM PUBLIC
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# $<BUILD_INTERFACE:${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}>
# $<INSTALL_INTERFACE:include>
# )
# target_compile_options(gpuRM PUBLIC -DTKCUDA_ENABLED)
# set_target_properties(gpuRM
# PROPERTIES
# CUDA_SEPARABLE_COMPILATION ON
# CUDA_RESOLVE_DEVICE_SYMBOLS ON
# )
# target_link_libraries(raymarching PUBLIC
# gpuRM
# )
# endif()
# particle_filter library
add_library(particle_filter
src/particle_filter/particle_filter.cpp
)
target_include_directories(particle_filter PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(particle_filter PUBLIC
ray_marching
yaml-cpp
roscomp::roscomp
roscomp::roscompnav_msgs
${OpenCV_LIBS}
)
# particle_filter_node executable
add_executable(particle_filter_node
src/pf_main.cpp
)
ament_target_dependencies(particle_filter_node
rclcpp
adx_data
nav_msgs
std_msgs
sensor_msgs
laser_geometry
tf2
tf2_ros
)
target_link_libraries(particle_filter_node
particle_filter
yaml-cpp
adx_data::twist
adx_data::odometry
roscomp::roscompgeometry_msgs
)
# install targets
install(TARGETS
ray_marching
particle_filter
particle_filter_node
DESTINATION lib/${PROJECT_NAME}
)
# install files
install(DIRECTORY
launch
conf
DESTINATION share/${PROJECT_NAME}
)
ament_package()