-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
86 lines (71 loc) · 2.42 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
cmake_minimum_required(VERSION 3.1.0)
project(seeta_facedet_lib)
# Build options
option(BUILD_EXAMPLES "Set to ON to build examples" ON)
option(USE_OPENMP "Set to ON to build use openmp" ON)
option(USE_SSE "Set to ON to build use SSE" ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
SET(CMAKE_CXX_FLAGS "-lboost_system")
SET(CMAKE_CXX_FLAGS "-lpthread")
# Use C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "C++11 support has been enabled by default.")
# Use SSE
if (USE_SSE)
add_definitions(-DUSE_SSE)
message(STATUS "Use SSE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
endif()
# Use OpenMP
if (USE_OPENMP)
find_package(OpenMP QUIET)
if (OPENMP_FOUND)
message(STATUS "Use OpenMP")
add_definitions(-DUSE_OPENMP)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
endif()
include_directories(include)
set(src_files
src/util/nms.cpp
src/util/image_pyramid.cpp
src/io/lab_boost_model_reader.cpp
src/io/surf_mlp_model_reader.cpp
src/feat/lab_feature_map.cpp
src/feat/surf_feature_map.cpp
src/classifier/lab_boosted_classifier.cpp
src/classifier/mlp.cpp
src/classifier/surf_mlp.cpp
src/face_detection.cpp
src/fust.cpp
)
# Build shared library
add_library(seeta_facedet_lib SHARED ${src_files})
set(facedet_required_libs seeta_facedet_lib)
# Build examples
if (BUILD_EXAMPLES)
message(STATUS "Build with examples.")
find_package(OpenCV)
if (NOT OpenCV_FOUND)
message(WARNING "OpenCV not found. Test will not be built.")
else()
include_directories(${OpenCV_INCLUDE_DIRS})
list(APPEND facedet_required_libs ${OpenCV_LIBS})
#use boost
find_package(Boost REQUIRED COMPONENTS
# regex
filesystem
system
)#需要使用的boost的库的名称
if(Boost_FOUND)
aux_source_directory(. srcs)
include_directories(${Boost_INCLUDE_DIRS})
list(APPEND facedet_required_libs ${Boost_LIBRARIES})
endif()
add_executable(facedet_test src/test/facedetection_test.cpp;src/test/3frame_diff.cpp;src/test/auto_window.cpp;src/test/file_control/file_control.cxx;src/test/facetrack/facetrack.cpp)
target_link_libraries(facedet_test ${facedet_required_libs})
endif()
endif()