-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
131 lines (91 loc) · 3.79 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
#################CMAKE FOR BUILD LIBRARY################
cmake_minimum_required(VERSION 2.8.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
#project declaration
project(RobotLabLibrary)
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif(NOT WIN32)
option(BUILD_SAMPLE "if you want to build sample" ON)
if(NOT WIN32)
find_package(OpenCV)
find_package(PocketSphinx)
find_package(SphinxBase)
endif(NOT WIN32)
#variable declaration
set(LIB_NAME RobotLabLibrary)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(WIN32)
set(POCKETSPHINX_LIB pocketsphinx sphinxbase)
set(OPENCV_LIB opencv_ts300 opencv_world300)
endif(WIN32)
#add link for the lib
if(WIN32)
include_directories(3rdparty/opencv/include)
include_directories(3rdparty/pocketSphinx/include)
include_directories(3rdparty/sphinxbase/include)
link_directories(3rdparty/pocketSphinx/bin)
link_directories(3rdparty/opencv/bin)
else(WIN32)
include_directories(${POCKETSPHINX_INCLUDE_DIRS})
include_directories(${SPHINXBASE_INCLUDE_DIRS})
endif(WIN32)
#auto find file
file(GLOB_RECURSE source_files src/*)
file(GLOB_RECURSE include_files include/*)
file(GLOB_RECURSE faceRecognizerContrib_files 3rdparty/faceRecognizerContrib/*)
#lib declaration
add_library(${LIB_NAME} STATIC ${source_files} ${include_files} ${faceRecognizerContrib_files})
if(WIN32)
target_link_libraries( ${LIB_NAME} ${OPENCV_LIB} ${POCKETSPHINX_LIB})
else(WIN32)
target_link_libraries( ${LIB_NAME} ${OpenCV_LIBS} ${POCKETSPHINX_LIBRARIES} ${SPHINXBASE_LIBRARIES} ${SPHINXAD_LIBRARIES})
endif(WIN32)
#build sample
if(BUILD_SAMPLE)
set(ROBOTLAB_LIB RobotLabLibrary)
include_directories(include)
link_directories(bin)
#executions config
add_executable(
voiceRecognition
samples/voiceRecognition.cpp
)
add_executable(
createFaceDatabase
samples/createFaceDatabase.cpp
)
add_executable(
faceRecognition
samples/faceRecognition.cpp
)
add_executable(
globalSample
samples/globalSample.cpp
)
add_executable(
videoDetection
samples/videoDetection.cpp
)
add_executable(
voiceAndDetection
samples/voiceAndDetection.cpp
)
if(WIN32)
target_link_libraries( voiceRecognition ${OPENCV_LIB} ${POCKETSPHINX_LIB} ${ROBOTLAB_LIB})
target_link_libraries( createFaceDatabase ${OPENCV_LIB} ${POCKETSPHINX_LIB} ${ROBOTLAB_LIB})
target_link_libraries( faceRecognition ${OPENCV_LIB} ${POCKETSPHINX_LIB} ${ROBOTLAB_LIB})
target_link_libraries( globalSample ${OPENCV_LIB} ${POCKETSPHINX_LIB} ${ROBOTLAB_LIB})
target_link_libraries( videoDetection ${OPENCV_LIB} ${POCKETSPHINX_LIB} ${ROBOTLAB_LIB})
target_link_libraries( voiceAndDetection ${OPENCV_LIB} ${POCKETSPHINX_LIB} ${ROBOTLAB_LIB})
else(WIN32)
target_link_libraries( voiceRecognition ${OpenCV_LIBS} ${POCKETSPHINX_LIBRARIES} ${SPHINXBASE_LIBRARIES} ${SPHINXAD_LIBRARIES} ${ROBOTLAB_LIB})
target_link_libraries( createFaceDatabase ${OpenCV_LIBS} ${POCKETSPHINX_LIBRARIES} ${SPHINXBASE_LIBRARIES} ${SPHINXAD_LIBRARIES} ${ROBOTLAB_LIB})
target_link_libraries( faceRecognition ${OpenCV_LIBS} ${POCKETSPHINX_LIBRARIES} ${SPHINXBASE_LIBRARIES} ${SPHINXAD_LIBRARIES} ${ROBOTLAB_LIB})
target_link_libraries( globalSample ${OpenCV_LIBS} ${POCKETSPHINX_LIBRARIES} ${SPHINXBASE_LIBRARIES} ${SPHINXAD_LIBRARIES} ${ROBOTLAB_LIB})
target_link_libraries( videoDetection ${OpenCV_LIBS} ${POCKETSPHINX_LIBRARIES} ${SPHINXBASE_LIBRARIES} ${SPHINXAD_LIBRARIES} ${ROBOTLAB_LIB})
target_link_libraries( voiceAndDetection ${OpenCV_LIBS} ${POCKETSPHINX_LIBRARIES} ${SPHINXBASE_LIBRARIES} ${SPHINXAD_LIBRARIES} ${ROBOTLAB_LIB})
endif(WIN32)
endif(BUILD_SAMPLE)