-
Notifications
You must be signed in to change notification settings - Fork 111
/
CMakeLists.txt
93 lines (73 loc) · 3.3 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
cmake_minimum_required( VERSION 3.0.0 )
project(clandmark)
# The version number
set(clandmark_VERSION_MAJOR 1)
set(clandmark_VERSION_MINOR 6)
set(clandmark_VERSION ${clandmark_VERSION_MAJOR}.${clandmark_VERSION_MINOR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
mark_as_advanced(CMAKE_INSTALL_PREFIX)
# set(BUILD_SHARED_LIBS "TRUE" CACHE BOOL "Global flag to cause add_library to create shared libraries if on.")
# set(CMAKE_SKIP_BUILD_RPATH "FALSE" CACHE BOOL "Do not include RPATHs in the build tree.")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
endif(NOT CMAKE_BUILD_TYPE)
option(BUILD_SHARED_LIBS "Check whether to build libraries dynamically or statically. On for dynamic, Off for static build." OFF)
option(DOUBLE_PRECISION "Set the default precision used in CLandmark." ON)
option(BUILD_MATLAB_BINDINGS "Check whether to build MATLAB interface." OFF)
option(BUILD_PYTHON_BINDINGS "Check whether to build Python interface." OFF)
option(BUILD_CPP_EXAMPLES "Check whether to build CPP examples." OFF)
option(USE_OPENMP "Enable/Disable OpenMP." OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -pedantic")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic")
# for configured header files:
include_directories(${PROJECT_BINARY_DIR})
# build clandmark & flandmark
add_subdirectory (libclandmark)
# build examples
if(BUILD_CPP_EXAMPLES)
add_subdirectory(examples)
# copy important files needed to run examples (opencv haarcascade for facial detector, flandmark_model file, example images and videos)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/flandmark_model.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/flandmark_model.xml COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/face.jpg ${CMAKE_CURRENT_BINARY_DIR}/examples/face.jpg COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/haarcascade_frontalface_alt.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/haarcascade_frontalface_alt.xml COPYONLY)
endif(BUILD_CPP_EXAMPLES)
# build MATLAB mex-files
if(BUILD_MATLAB_BINDINGS)
add_subdirectory(matlab_interface)
endif(BUILD_MATLAB_BINDINGS)
# build Python interface
if(BUILD_PYTHON_BINDINGS)
add_subdirectory(python_interface)
endif(BUILD_PYTHON_BINDINGS)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/clandmark/CLandmarkConfigVersion.cmake"
VERSION ${clandmark_VERSION}
COMPATIBILITY AnyNewerVersion
)
export(EXPORT CLandmarkTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/clandmark/CLandmarkTargets.cmake"
NAMESPACE CLandmark::
)
configure_file(cmake/Templates/CLandmarkConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/clandmark/CLandmarkConfig.cmake"
COPYONLY
)
install(EXPORT CLandmarkTargets
FILE CLandmarkTargets.cmake
NAMESPACE CLandmark::
DESTINATION lib/cmake/clandmark
)
install(
FILES
cmake/Templates/CLandmarkConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/clandmark/CLandmarkConfigVersion.cmake"
DESTINATION lib/cmake/clandmark
COMPONENT
Devel
)
#install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/Findclandmark.cmake" DESTINATION ./ COMPONENT Devel)