-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
83 lines (74 loc) · 2.61 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
cmake_minimum_required(VERSION 3.5.0)
project(tagbench)
# Compile options etc.
set(CMAKE_CXX_STANDARD 17)
# Find OpenCV package
find_package(OpenCV)
# Simplified manual build for the apriltags library due to problems
# in the original library's CMakeLists.txt
set(APRILTAG_SRC
"libs/apriltag/apriltag.c"
"libs/apriltag/apriltag_pose.c"
"libs/apriltag/apriltag_quad_thresh.c"
"libs/apriltag/tag36h11.c")
file(GLOB APRILTAG_COMMON_SRC
"libs/apriltag/common/*.c"
"libs/apriltag/common/*.cpp")
add_library(apriltags ${APRILTAG_SRC} ${APRILTAG_COMMON_SRC})
target_include_directories(apriltags PUBLIC "libs/apriltag/")
if (NOT MSVC)
find_package(Threads REQUIRED)
target_link_libraries(apriltags PUBLIC Threads::Threads m)
endif()
# dependency: nlohmann_json
option(JSON_BuildTests OFF)
add_subdirectory(libs/json)
# dependency: cxxopts
option(CXXOPTS_BUILD_EXAMPLES OFF)
option(CXXOPTS_BUILD_TESTS OFF)
option(CXXOPTS_ENABLE_INSTALL OFF)
add_subdirectory(libs/cxxopts)
# Input data preprocessor
add_executable(input_data_preprocessor
src/input_data_preprocessor.cpp
src/detect_markers.cpp
src/detect_markers.h
)
target_link_libraries(input_data_preprocessor PRIVATE
${OpenCV_LIBS}
nlohmann_json::nlohmann_json
apriltags
cxxopts
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:stdc++fs>)
target_compile_definitions(input_data_preprocessor PRIVATE _CRT_SECURE_NO_WARNINGS)
# tagbench (the main app)
add_executable(tagbench
src/tagbench.cpp
src/pose_optimizer.cpp
src/pose_optimizer.h
src/detect_markers.cpp
src/detect_markers.h
src/cv_helpers.cpp
src/cv_helpers.h
)
target_include_directories(tagbench PUBLIC "libs/eigen/" ${APRILTAGS_INCLUDE_DIRS})
target_link_libraries(tagbench
${OpenCV_LIBS}
nlohmann_json::nlohmann_json
apriltags
cxxopts)
target_compile_definitions(tagbench PRIVATE _CRT_SECURE_NO_WARNINGS _SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING NOMINMAX _USE_MATH_DEFINES)
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
target_precompile_headers(tagbench PRIVATE src/pch.h)
endif()
# synthetic_test (simple synthetic test app for validating the optimizer)
add_executable(synthetic_test
src/synthetic_test.cpp
src/pose_optimizer.cpp
src/pose_optimizer.h
src/cv_helpers.cpp
src/cv_helpers.h
)
target_include_directories(synthetic_test PUBLIC "libs/eigen/" ${APRILTAGS_INCLUDE_DIRS})
target_link_libraries(synthetic_test ${OpenCV_LIBS})
target_compile_definitions(synthetic_test PRIVATE _CRT_SECURE_NO_WARNINGS _SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING NOMINMAX _USE_MATH_DEFINES)