forked from SpectacularAI/sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (58 loc) · 2.12 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
if(MSVC)
# Windows build uses newer features
cmake_minimum_required(VERSION 3.21)
else()
cmake_minimum_required(VERSION 3.3)
endif()
project(spectacularAI_realsense_example)
if(MSVC)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
else()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()
find_package(realsense2 REQUIRED)
find_package(spectacularAI_realsensePlugin REQUIRED)
set(EXAMPLE_LIBS
realsense2::realsense2
spectacularAI::realsensePlugin)
# enables searching for dynamic libraries from the relative path ../lib
if(NOT MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN/../lib:$ORIGIN/../lib/3rdparty'")
endif()
add_executable(vio_jsonl vio_jsonl.cpp)
target_link_libraries(vio_jsonl ${EXAMPLE_LIBS})
if(MSVC)
add_custom_command(TARGET vio_jsonl POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:vio_jsonl> $<TARGET_FILE_DIR:vio_jsonl>
COMMAND_EXPAND_LISTS
)
endif()
set(BUILD_MAPPER ON CACHE STRING "Build VIO mapper example (requires OpenCV)")
if (BUILD_MAPPER)
set(USE_STATIC_OPENCV OFF CACHE STRING "Use OpenCV as statically linked library (internal and unsupported flag, do not use)")
if (USE_STATIC_OPENCV)
find_package(mobile-cv-suite REQUIRED)
set(MAPPER_LIBS mobile-cv-suite::static mobile-cv-suite::imgcodecs)
else()
find_package(OpenCV REQUIRED)
set(MAPPER_LIBS "${OpenCV_LIBS}")
endif()
add_executable(vio_mapper vio_mapper.cpp)
target_link_libraries(vio_mapper ${EXAMPLE_LIBS} ${MAPPER_LIBS})
if(MSVC)
add_custom_command(TARGET vio_mapper POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:vio_mapper> $<TARGET_FILE_DIR:vio_mapper>
COMMAND_EXPAND_LISTS
)
endif()
add_executable(vio_mapper_legacy vio_mapper_legacy.cpp)
target_link_libraries(vio_mapper_legacy ${EXAMPLE_LIBS} ${MAPPER_LIBS})
if(MSVC)
add_custom_command(TARGET vio_mapper_legacy POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:vio_mapper_legacy> $<TARGET_FILE_DIR:vio_mapper_legacy>
COMMAND_EXPAND_LISTS
)
endif()
endif()