forked from tanglw2020/fast-magsac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
111 lines (91 loc) · 3.22 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
cmake_minimum_required(VERSION 3.8)
project(MAGSAC LANGUAGES CXX)
# indicate if OPENMP should be enabled
option(USE_OPENMP "Use OPENMP" OFF)
# ==============================================================================
# Check C++17 support
# ==============================================================================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-fpermissive")
# ==============================================================================
# Find OpenCV
# ==============================================================================
find_package(OpenCV )
# ==============================================================================
# Find Eigen
# ==============================================================================
find_package(Eigen3 REQUIRED)
set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
# ==============================================================================
# Find OpenMP
# ==============================================================================
find_package(OpenMP)
if (USE_OPENMP)
if(NOT OPENMP_FOUND)
message(FATAL_ERROR "OPENMP not found.")
endif()
add_definitions(-DUSE_OPENMP)
set(TRGT_LNK_LBS_ADDITIONAL OpenMP::OpenMP_CXX)
endif (USE_OPENMP)
# ==============================================================================
# Includes
# ==============================================================================
include_directories (
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/graph-cut-ransac/src/pygcransac/include
)
# ==============================================================================
# Structure: Graph-Cut RANSAC Library
# ==============================================================================
# Set header files for the library
file(GLOB_RECURSE HDRS_GraphCutRANSAC
"graph-cut-ransac/src/pygcransac/include/*.h"
)
# Set source files to be added to the library
file(GLOB_RECURSE SRCS_GraphCutRANSAC
"graph-cut-ransac/src/pygcransac/include/*.cpp"
)
add_library(GraphCutRANSAC STATIC
${HDRS_GraphCutRANSAC}
${SRCS_GraphCutRANSAC}
)
target_link_libraries(GraphCutRANSAC
${OpenCV_LIBS}
Eigen3::Eigen)
# ==============================================================================
# Structure: MAGSAC Library
# ==============================================================================
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
# Set header files for the library
file(GLOB_RECURSE HDRS_MAGSAC
"include/*.h"
"include/*.cpp"
)
# Set source files to be added to the library
file(GLOB_RECURSE SRCS_MAGSAC
"src/main_all.cpp"
)
add_executable(${PROJECT_NAME}
${HDRS_MAGSAC}
${SRCS_MAGSAC}
)
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
Eigen3::Eigen
)
# ==============================================================================
# Structure: Applications
# ==============================================================================
if (CREATE_SAMPLE_PROJECT)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
add_executable(SampleProject
src/main_all.cpp)
target_link_libraries(SampleProject
${PROJECT_NAME}
${OpenCV_LIBS}
Eigen3::Eigen
)
add_dependencies(SampleProject ${PROJECT_NAME})
endif (CREATE_SAMPLE_PROJECT)