-
Notifications
You must be signed in to change notification settings - Fork 43
/
CMakeLists.txt
150 lines (124 loc) · 4.36 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
cmake_minimum_required(VERSION 3.4)
project(find_face_landmarks)
# Set version
set(FFL_MAJOR_VERSION 1)
set(FFL_MINOR_VERSION 2)
set(FIND_FACE_LANDMARKS_VERSION ${FFL_MAJOR_VERSION}.${FFL_MINOR_VERSION})
# Global configurations
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX -DNO_STRICT")
set(DEF_INSTALL_CMAKE_DIR cmake)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(DEF_INSTALL_CMAKE_DIR lib/cmake/${PROJECT_NAME})
endif()
set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH
"Installation directory for CMake files")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING
"Add a custom \"postfix\" to static and shared libraries when in Debug build")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Optional 3rd party components
# ===================================================
option(WITH_BOOST_STATIC "Boost static libraries" OFF)
option(WITH_PROTOBUF "Protocol Buffers - Google's data interchange format" ON)
option(WITH_OPENCV_CONTRIB "OpenCV's extra modules" ON)
option(WITH_QT "Qt" ON)
# Build components
# ===================================================
option(BUILD_SFL_CACHE "Build sfl_cache application" ON)
option(BUILD_SFL_VIEWER "Build sfl_viewer application" ON)
option(BUILD_SFL_TRACK "Build sfl_track application" ON)
option(BUILD_DOCS "Build documentation using Doxygen" ON)
option(BUILD_INTERFACE_MATLAB "Build interface for Matlab" ON)
# Find dependencies
# ===================================================
# dlib
find_package(dlib REQUIRED)
# OpenCV
find_package(OpenCV REQUIRED highgui imgproc imgcodecs features2d)
if(WITH_OPENCV_CONTRIB)
find_package(OpenCV COMPONENTS face)
endif()
# Boost
set(Boost_USE_STATIC_LIBS ${WITH_BOOST_STATIC})
set(BOOST_ALL_DYN_LINK NOT ${WITH_BOOST_STATIC})
if(WIN32)
if(${WITH_BOOST_STATIC})
add_definitions(-DBOOST_ALL_NO_LIB)
else()
add_definitions(-DBOOST_ALL_DYN_LINK)
endif()
endif()
find_package(Boost REQUIRED filesystem program_options)
# protobuf
if(WITH_PROTOBUF)
find_package(protobuf)
endif()
# Qt
if(WITH_QT)
find_package(Qt5Widgets)
endif()
# Docs
if(BUILD_DOCS)
find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
message(STATUS "The documentation won't be build.")
set(BUILD_DOCS OFF CACHE BOOL "Build documentation using Doxygen" FORCE)
endif()
endif()
# Interfaces
if(BUILD_INTERFACE_MATLAB)
find_package(Matlab COMPONENTS MX_LIBRARY)
if(NOT Matlab_FOUND)
message(STATUS "Matlab interface won't be build.")
set(BUILD_INTERFACE_MATLAB OFF CACHE BOOL "Build interface for Matlab" FORCE)
endif()
endif()
# Add subdirectories
# ===================================================
add_subdirectory(sequence_face_landmarks)
set(FFL_TARGETS sequence_face_landmarks)
# cache_face_landmarks
if(BUILD_SFL_CACHE)
add_subdirectory(sfl_cache)
endif()
# face_landmarks_viewer
if(BUILD_SFL_VIEWER)
add_subdirectory(sfl_viewer)
endif()
# sfl_track
if(BUILD_SFL_TRACK)
add_subdirectory(sfl_track)
endif()
if(BUILD_DOCS)
add_subdirectory(doc)
endif()
# interfaces
if(BUILD_INTERFACE_MATLAB)
add_subdirectory(interfaces/matlab)
endif()
# Export configuration
# ===================================================
# Add all targets to the build-tree export set
export(TARGETS ${FFL_TARGETS}
FILE "${PROJECT_BINARY_DIR}/find_face_landmarks-targets.cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE find_face_landmarks)
# Create config files
configure_file(cmake/find_face_landmarks-config.cmake.in
"${PROJECT_BINARY_DIR}/find_face_landmarks-config.cmake" @ONLY)
configure_file(cmake/find_face_landmarks-config-version.cmake.in
"${PROJECT_BINARY_DIR}/find_face_landmarks-config-version.cmake" @ONLY)
# Install config files
install(FILES
"${PROJECT_BINARY_DIR}/find_face_landmarks-config.cmake"
"${PROJECT_BINARY_DIR}/find_face_landmarks-config-version.cmake"
DESTINATION "cmake" COMPONENT dev)
# Install the export set for use with the install-tree
install(EXPORT find_face_landmarks-targets DESTINATION cmake COMPONENT dev)
#install(FILES ${CMAKE_SOURCE_DIR}/find_face_landmarks.txt DESTINATION mex COMPONENT mex RENAME find_face_landmarks.m)
#install(FILES ${CMAKE_SOURCE_DIR}/show_face_landmarks.m DESTINATION utilities COMPONENT utilities)
#install(FILES ${CMAKE_SOURCE_DIR}/find_face_landmarks_setup.m DESTINATION .)