-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (66 loc) · 1.95 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
cmake_minimum_required(VERSION 3.10)
project(
StereoLab
VERSION 0.0.1
LANGUAGES CXX CUDA
)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_ARCHITECTURES 75)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -arch=compute_75;-code=compute_75")
message(STATUS "Operating System: " ${CMAKE_SYSTEM_NAME})
message(STATUS "Compiler ID: " ${CMAKE_CXX_COMPILER_ID})
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
else()
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MT" "/MD" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
set(CMAKE_CXX_FLAGS_RELEASE "/MT")
set(CMAKE_CXX_FLAGS_DEBUG "/MTd")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /std:c++17 /O2 /Zc:wchar_t-")
endif()
option(ENABLE_STEREO_LAB_DEBUG "Enable stereo lab debug code" On)
option(ENBALE_BUILD_TEST "Enable build test" On)
include_directories(${PROJECT_SOURCE_DIR}/include)
configure_file(
${PROJECT_SOURCE_DIR}/include/common/config.h.in
${PROJECT_SOURCE_DIR}/include/common/config.h
)
find_package(OpenCV REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package (Eigen3 3.4 REQUIRED)
add_library(sl_common
${PROJECT_SOURCE_DIR}/src/common/util.cc
${PROJECT_SOURCE_DIR}/src/common/mb_data_loader.cc
)
target_include_directories(sl_common
PUBLIC
${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(sl_common
PUBLIC
Eigen3::Eigen
${OpenCV_LIBS}
)
add_library(sl_algorithm
${PROJECT_SOURCE_DIR}/src/algorithm/feature.cc
${PROJECT_SOURCE_DIR}/src/algorithm/stereo_match_bm.cc
${PROJECT_SOURCE_DIR}/src/algorithm/stereo_match_pm.cc
)
target_link_libraries(sl_algorithm
PUBLIC
sl_common
nlohmann_json
)
if (${ENBALE_BUILD_TEST})
enable_testing()
add_subdirectory(test)
endif()