@@ -26,6 +26,10 @@ set(RGL_LOG_FILE "" CACHE STRING # STRING prevents from expanding relative path
26
26
set (RGL_AUTO_TAPE_PATH "" CACHE STRING # STRING prevents from expanding relative paths
27
27
"If non-empty, defines a path for the automatic tape (started on the first API call)" )
28
28
29
+ # Library configuration
30
+ set (RGL_BUILD_STATIC OFF CACHE BOOL
31
+ "Builds RobotecGPULidar as a statically linkable library instead of a shared one" )
32
+
29
33
# Test configuration
30
34
set (RGL_BUILD_TESTS ON CACHE BOOL
31
35
"Enables building test. GTest will be automatically downloaded" )
@@ -89,7 +93,7 @@ add_custom_command(
89
93
VERBATIM )
90
94
add_library (optixPrograms optixProgramsPtx.c)
91
95
92
- add_library (RobotecGPULidar SHARED
96
+ set (RGL_SOURCE_FILES
93
97
src/api/apiCommon.cpp
94
98
src/api/apiCore.cpp
95
99
src/tape/TapePlayer.cpp
@@ -127,6 +131,15 @@ add_library(RobotecGPULidar SHARED
127
131
src/graph/YieldPointsNode.cpp
128
132
)
129
133
134
+ if (RGL_BUILD_STATIC)
135
+ add_library (RobotecGPULidar STATIC ${RGL_SOURCE_FILES} )
136
+ target_compile_definitions (RobotecGPULidar PUBLIC RGL_STATIC)
137
+ set (RGL_SPDLOG_VARIANT spdlog_header_only)
138
+ else ()
139
+ add_library (RobotecGPULidar SHARED ${RGL_SOURCE_FILES} )
140
+ set (RGL_SPDLOG_VARIANT spdlog)
141
+ endif ()
142
+
130
143
set_property (TARGET RobotecGPULidar PROPERTY POSITION_INDEPENDENT_CODE ON )
131
144
132
145
target_compile_definitions (RobotecGPULidar PUBLIC RGL_BUILD_PCL_EXTENSION=$<BOOL :${RGL_BUILD_PCL_EXTENSION} >)
@@ -156,7 +169,7 @@ target_include_directories(RobotecGPULidar
156
169
)
157
170
158
171
target_link_libraries (RobotecGPULidar PRIVATE
159
- spdlog
172
+ ${RGL_SPDLOG_VARIANT}
160
173
yaml-cpp
161
174
optixPrograms
162
175
cmake_git_version_tracking
0 commit comments