-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
199 lines (169 loc) · 5.87 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
cmake_minimum_required(VERSION 3.24)
project(rtac_base VERSION 1.0)
option(WITH_CUDA "Compile and install cuda-dependent code." ON)
option(WITH_ASYNC "Compile and install async components (will use GCC '-pthread' compile and link option)" ON)
option(BUILD_TESTS "Build unit tests" OFF)
option(BUILD_DOCS "Build Doxygen documentation" OFF)
# Loading installation script (just loading function, not calling)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/rtac_installation.cmake)
find_package(Eigen3 3.4 REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(PNG)
find_package(JPEG)
list(APPEND rtac_base_headers
include/rtac_base/common.h
include/rtac_base/cuda_defines.h
include/rtac_base/Exception.h
include/rtac_base/utilities.h
include/rtac_base/types/TypeInfo.h
include/rtac_base/types/Shape.h
include/rtac_base/types/Rectangle.h
include/rtac_base/types/Bounds.h
include/rtac_base/types/Linspace.h
include/rtac_base/types/Point.h
include/rtac_base/types/PointFormat.h
include/rtac_base/types/Complex.h
include/rtac_base/types/PODWrapper.h
include/rtac_base/types/StringId.h
include/rtac_base/containers/VectorView.h
include/rtac_base/containers/HostVector.h
include/rtac_base/containers/Image.h
include/rtac_base/containers/DimExpression.h
include/rtac_base/containers/ScaledImage.h
include/rtac_base/containers/utilities.h
include/rtac_base/type_utils.h
include/rtac_base/types/MappedPointer.h
include/rtac_base/types/BuildTarget.h
include/rtac_base/types/CallbackQueue.h
include/rtac_base/types/PointCloudBase.h
include/rtac_base/types/PointCloud.h
include/rtac_base/types/Mesh.h
include/rtac_base/types/SonarPing2D.h
include/rtac_base/types/SonarPing.h
include/rtac_base/types/Edge.h
include/rtac_base/types/DualMesh.h
include/rtac_base/types/common.h
include/rtac_base/types/Pose.h
include/rtac_base/geometry.h
include/rtac_base/interpolation.h
include/rtac_base/interpolation_impl.h
include/rtac_base/signal_helpers.h
include/rtac_base/files.h
include/rtac_base/time.h
include/rtac_base/bin_codecs.h
include/rtac_base/external/ply_files.h
include/rtac_base/external/happly.h
include/rtac_base/external/obj_codec.h
include/rtac_base/external/ImageCodec.h
include/rtac_base/external/tinyxml2.h
include/rtac_base/external/metashape.h
include/rtac_base/external/kalibr.h
include/rtac_base/external/nmea_utils.h
include/rtac_base/external/RIFF.h
include/rtac_base/external/npy.h
include/rtac_base/serialization/serialization.h
include/rtac_base/serialization/sonar_ping.h
include/rtac_base/navigation.h
include/rtac_base/files/sonar_ping.h
)
add_library(rtac_base SHARED
src/types/BuildTarget.cpp
src/files.cpp
src/time.cpp
src/bin_codecs.cpp
src/Mesh.cpp
src/external/nmea_utils.cpp
src/external/ply_files.cpp
src/external/obj_codec.cpp
src/external/ImageCodec.cpp
src/external/tinyxml2.cpp
src/external/metashape.cpp
src/external/kalibr.cpp
src/external/RIFF.cpp
)
target_link_libraries(rtac_base
PUBLIC
Eigen3::Eigen
yaml-cpp
PRIVATE
stdc++fs
)
target_include_directories(rtac_base
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_features(rtac_base PUBLIC cxx_std_14)
# target_compile_features(rtac_base PUBLIC cxx_std_17)
target_compile_definitions(rtac_base PUBLIC
# $<$<COMPILE_LANGUAGE:CXX>:RTAC_CXX_STD=17>
$<$<COMPILE_LANGUAGE:CXX>:RTAC_CXX_STD=14>
)
if(WITH_ASYNC)
list(APPEND rtac_base_headers
include/rtac_base/async/AsyncFunction.h
include/rtac_base/async/AsyncWorker.h
)
target_sources(rtac_base PRIVATE src/async/AsyncWorker.cpp)
target_compile_options(rtac_base PUBLIC -pthread)
target_link_options (rtac_base PUBLIC -pthread)
endif()
if(WITH_CUDA)
target_compile_definitions(rtac_base PUBLIC "-DRTAC_CUDA_ENABLED")
add_subdirectory(cuda)
endif()
if(PNG_FOUND)
message(STATUS "Found libpng, version ${PNG_VERSION_STRING}")
target_include_directories(rtac_base PUBLIC ${PNG_INCLUDE_DIRS})
target_link_libraries(rtac_base PUBLIC ${PNG_LIBRARIES})
target_compile_definitions(rtac_base PUBLIC ${PNG_DEFINITIONS} RTAC_PNG)
target_sources(rtac_base PRIVATE
src/external/png_codec.cpp
)
list(APPEND rtac_base_headers
include/rtac_base/external/png_codec.h
)
set_target_properties(rtac_base PROPERTIES
RTAC_PUBLIC_HEADERS "${rtac_base_headers}"
)
endif()
if(JPEG_FOUND)
message(STATUS "Found libjpeg, version ${JPEG_VERSION}")
target_link_libraries(rtac_base PUBLIC JPEG::JPEG)
target_compile_definitions(rtac_base PUBLIC RTAC_JPEG)
target_sources(rtac_base PRIVATE
src/external/jpg_codec.cpp
)
list(APPEND rtac_base_headers
include/rtac_base/external/jpg_codec.h
)
set_target_properties(rtac_base PROPERTIES
RTAC_PUBLIC_HEADERS "${rtac_base_headers}"
)
endif()
find_package(PROJ QUIET CONFIG)
if(TARGET PROJ::proj)
set(WITH_PROJ ON)
target_link_libraries(rtac_base PUBLIC PROJ::proj)
list(APPEND rtac_base_headers
include/rtac_base/external/proj.h
)
target_sources(rtac_base PRIVATE
src/external/proj.cpp
)
endif()
if(BUILD_TESTS)
add_subdirectory(tests)
endif()
if(BUILD_DOCS)
# This script handles Doxygen documentation (add a BUILD_DOCUMENTATION option)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/rtac_build_docs.cmake)
rtac_build_docs(rtac_base)
endif()
rtac_install_target(rtac_base
HEADER_FILES ${rtac_base_headers}
ADDITIONAL_CONFIG_FILES cmake/rtac_installation.cmake
ADDITIONAL_CONFIG_FILES cmake/rtac_generate_asm.cmake
ADDITIONAL_CONFIG_FILES cmake/rtac_build_docs.cmake
ADDITIONAL_CONFIG_FILES cmake/Doxyfile.in
)