-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
56 lines (49 loc) · 1.46 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
cmake_minimum_required(VERSION 2.8)
project(egbis)
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 11)
if(NOT WIN32)
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-pthread)
endif(NOT WIN32)
file(GLOB SOURCES
egbis.cpp
egbis/disjoint-set.cpp
egbis/misc.cpp
egbis/segment-graph.cpp
egbis/filter.cpp
egbis/segment-image.cpp
egbis/imconv.cpp
egbis/convolve.cpp
)
if(WIN32)
add_library(egbis_library STATIC ${SOURCES})
else(WIN32)
add_library(egbis_library SHARED ${SOURCES})
endif(WIN32)
target_link_libraries(egbis_library ${OpenCV_LIBS})
target_include_directories(egbis_library PUBLIC ${CMAKE_CURRENT_LIST_DIR})
add_executable(main main.cpp)
target_link_libraries(main egbis_library)