-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (58 loc) · 2.01 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
project(general)
cmake_minimum_required(VERSION 3.7)
macro(find_opencv)
if(WIN32)
# put opencv_world???.dll near the final executable before running
# which is located at "${OpenCV_DIR}/../bin"
# or add "${OpenCV_DIR}/../bin" to PATH environment variable
# cmake -D OpenCV_DIR="C:/opencv/build/x64/vc15/lib" ..
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif(WIN32)
find_package(OpenCV REQUIRED)
if (WIN32 AND NOT BUILD_SHARED_LIBS)
# MSVC settings for static build
# https://stackoverflow.com/a/14172871/12447766
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 "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
endif(WIN32 AND NOT BUILD_SHARED_LIBS)
set(CMAKE_CXX_STANDARD 14)
if(NOT WIN32)
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-pthread)
endif(NOT WIN32)
endmacro(find_opencv)
find_opencv()
set(SOURCES "src/imgops.cpp" "src/Contour.cpp")
if(WIN32)
add_library(general_library STATIC ${SOURCES})
else(WIN32)
add_library(general_library SHARED ${SOURCES})
endif(WIN32)
target_link_libraries(general_library ${OpenCV_LIBS})
target_include_directories(general_library PUBLIC "include")
option(BUILD_SUBDIRECTORIES "Build all projects" OFF)
message(STATUS "Build subdirectories: " ${BUILD_SUBDIRECTORIES})
if(BUILD_SUBDIRECTORIES)
if(NOT TARGET stitch_library)
add_subdirectory(Stitch)
endif(NOT TARGET stitch_library)
add_subdirectory(Calibrate)
add_subdirectory(Jpeg)
add_subdirectory(Segment)
endif(BUILD_SUBDIRECTORIES)
include_directories("include")
if(${OpenCV_VERSION} VERSION_GREATER_EQUAL "4.5.3")
add_executable(optflow "src/optflow.cpp" "src/modules.cpp")
target_link_libraries(optflow general_library)
add_executable(tracker "src/tracker.cpp" "src/modules.cpp")
target_link_libraries(tracker general_library)
endif()