-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt.mod
273 lines (211 loc) · 8.7 KB
/
CMakeLists.txt.mod
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
project(src)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_BUILD_TYPE RelWithDebugInfo)
#set(CMAKE_BUILD_TYPE Debug)
cmake_minimum_required (VERSION 2.6)
# Set the OpenALPR version in cmake, and also add it as a DEFINE for the code to access
SET(OPENALPR_MAJOR_VERSION "2")
SET(OPENALPR_MINOR_VERSION "3")
SET(OPENALPR_PATCH_VERSION "0")
SET(OPENALPR_VERSION ${OPENALPR_MAJOR_VERSION}.${OPENALPR_MINOR_VERSION}.${OPENALPR_PATCH_VERSION})
add_definitions( -DOPENALPR_MAJOR_VERSION=${OPENALPR_MAJOR_VERSION})
add_definitions( -DOPENALPR_MINOR_VERSION=${OPENALPR_MINOR_VERSION})
add_definitions( -DOPENALPR_PATCH_VERSION=${OPENALPR_PATCH_VERSION})
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
add_definitions( -DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
# TODO: switch to http://www.cmake.org/cmake/help/v2.8.5/cmake.html#module:GNUInstallDirs ?
IF (NOT CMAKE_INSTALL_SYSCONFDIR)
SET(CMAKE_INSTALL_SYSCONFDIR "/etc")
ENDIF()
IF (NOT CMAKE_INSTALL_VARDIR)
SET(CMAKE_INSTALL_VARDIR "${CMAKE_INSTALL_PREFIX}/var")
ENDIF()
IF ( NOT DEFINED WITH_DAEMON )
SET(WITH_DAEMON ON)
ENDIF()
IF ( NOT DEFINED WITH_STATEDETECTION )
SET(WITH_STATEDETECTION OFF)
ENDIF()
if ( NOT DEFINED WITH_GPU_DETECTOR )
SET(WITH_GPU_DETECTOR OFF)
ENDIF()
if ( NOT DEFINED WITH_TESTS )
SET(WITH_TESTS ON)
ENDIF()
if ( NOT DEFINED WITH_BINDING_JAVA )
SET(WITH_BINDING_JAVA ON)
ENDIF()
if ( NOT DEFINED WITH_BINDING_PYTHON )
SET(WITH_BINDING_PYTHON ON)
ENDIF()
if ( NOT DEFINED WITH_BINDING_GO )
SET(WITH_BINDING_GO ON)
ENDIF()
if ( NOT DEFINED WITH_UTILITIES )
SET(WITH_UTILITIES ON)
ENDIF()
IF (WIN32 AND WITH_DAEMON)
MESSAGE(WARNING "Skipping alprd daemon installation, as it is not supported in Windows.")
SET(WITH_DAEMON OFF)
ENDIF()
IF (WIN32 AND WITH_TESTS)
MESSAGE(WARNING "Skipping unit tests, as it is not supported in Windows.")
SET(WITH_TESTS OFF)
ENDIF()
IF(Tesseract_FRAMEWORK_PATH AND Leptonica_FRAMEWORK_PATH)
MESSAGE(STATUS "Using Tesseract iOS framework: ${Tesseract_FRAMEWORK_PATH}")
MESSAGE(STATUS "Using Leptonica iOS framework: ${Leptonica_FRAMEWORK_PATH}")
# http://www.vtk.org/Wiki/CMake:HowToUseExistingOSXFrameworks
SET(Tesseract_LIBRARIES "${Tesseract_FRAMEWORK_PATH};${Leptonica_FRAMEWORK_PATH}")
SET(Tesseract_INCLUDE_DIRS "${Tesseract_FRAMEWORK_PATH}/Headers")
ELSE()
FIND_PACKAGE( Tesseract REQUIRED )
ENDIF()
include_directories(${Tesseract_INCLUDE_DIRS})
IF(OpenCV_FRAMEWORK_PATH)
MESSAGE(STATUS "Using OpenCV iOS framework: ${OpenCV_FRAMEWORK_PATH}")
SET(OpenCV_INCLUDE_DIRS "${OpenCV_FRAMEWORK_PATH}/Headers")
SET(OpenCV_LIBS ${OpenCV_FRAMEWORK_PATH})
# OpenCV's released framework has this disabled, so we must too.
# http://stackoverflow.com/a/32710441/868173
SET(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE NO)
ELSE()
# Discover OpenCV directory automatically
find_path(OpenCV_DIR
NAMES OpenCVConfig.cmake
HINTS ${CMAKE_SOURCE_DIR}/../libraries/opencv/
/storage/projects/alpr/libraries/opencv/
)
# Opencv Package
FIND_PACKAGE( OpenCV REQUIRED )
ENDIF()
IF (${OpenCV_VERSION} VERSION_LESS 2.4.7)
MESSAGE(FATAL_ERROR "OpenCV version is not compatible : ${OpenCV_VERSION}")
ENDIF()
include_directories(${OpenCV_INCLUDE_DIRS})
add_definitions( -DOPENCV_MAJOR_VERSION=${OpenCV_VERSION_MAJOR})
include_directories(./openalpr )
IF (WIN32)
add_definitions( -DWINDOWS)
add_definitions( -DNOMINMAX)
# Extra linker dependencies for Windows
SET (Tesseract_LIBRARIES
${Tesseract_LIBRARIES}
ws2_32.lib
)
ELSE()
SET (Extra_LIBS
pthread
)
ENDIF()
set(CMAKE_CSS_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall ")
if (NOT IOS)
ADD_EXECUTABLE( alpr main.cpp )
ENDIF()
if (WIN32)
SET(OPENALPR_LIB openalpr-static)
ELSE()
SET(OPENALPR_LIB openalpr)
ENDIF()
IF (WITH_STATEDETECTION)
SET(STATE_DETECTION_LIB statedetection)
add_subdirectory(statedetection)
ELSE()
SET(STATE_DETECTION_LIB "")
add_definitions( -DSKIP_STATE_DETECTION=1 )
ENDIF()
if (NOT IOS)
TARGET_LINK_LIBRARIES(alpr
${OPENALPR_LIB}
${STATE_DETECTION_LIB}
support
video
${OpenCV_LIBS}
${Tesseract_LIBRARIES}
${Extra_LIBS}
)
ENDIF()
# Compile the alprd library on Unix-based OS
IF (WITH_DAEMON)
ADD_EXECUTABLE( alprd
daemon.cpp
daemon/daemonconfig.cpp
daemon/beanstalk.c
daemon/beanstalk.cc
)
FIND_PACKAGE( CURL REQUIRED )
FIND_PACKAGE( log4cplus REQUIRED )
TARGET_LINK_LIBRARIES(alprd
${OPENALPR_LIB}
support
video
curl
${OpenCV_LIBS}
${Tesseract_LIBRARIES}
${log4cplus_LIBRARIES}
${Extra_LIBS}
)
ENDIF()
if(WITH_UTILITIES)
add_subdirectory(misc_utilities)
ENDIF()
if (WITH_TESTS)
add_subdirectory(tests)
ENDIF()
add_subdirectory(openalpr)
add_subdirectory(video)
if (WITH_BINDING_JAVA)
add_subdirectory(bindings/java)
ENDIF()
if (WITH_BINDING_PYTHON)
add_subdirectory(bindings/python)
ENDIF()
if (WITH_BINDING_GO)
set(OPENALPR_LIB_GO openalprgo)
set(TAG_OPENALPR_LIB_GO "-l${OPENALPR_LIB_GO}")
add_subdirectory(bindings/go)
ENDIF()
if (NOT IOS)
install (TARGETS alpr DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install (FILES ${CMAKE_SOURCE_DIR}/../doc/man/alpr.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 COMPONENT doc)
ENDIF()
install (DIRECTORY ${CMAKE_SOURCE_DIR}/../runtime_data DESTINATION ${CMAKE_INSTALL_PREFIX}/share/openalpr)
# set runtime_data to reflect the current CMAKE_INSTALL_PREFIX
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/../config/openalpr.conf.user ${CMAKE_CURRENT_BINARY_DIR}/config/openalpr.conf)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/config/openalpr.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/openalpr/ COMPONENT config)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/../config/openalpr.conf.defaults ${CMAKE_CURRENT_BINARY_DIR}/share/openalpr/config/openalpr.defaults.conf)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/share/openalpr/config/openalpr.defaults.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/openalpr/config COMPONENT config)
IF (WITH_DAEMON)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/../config/alprd.conf.user ${CMAKE_CURRENT_BINARY_DIR}/config/alprd.conf)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/config/alprd.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/openalpr/ COMPONENT config)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/../config/alprd.conf.defaults ${CMAKE_CURRENT_BINARY_DIR}/share/openalpr/config/alprd.defaults.conf)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/share/openalpr/config/alprd.defaults.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/openalpr/config COMPONENT config)
install (TARGETS alprd DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
ENDIF()
SET (CPACK_PACKAGE_VERSION ${OPENALPR_VERSION})
SET (CPACK_SET_DESTDIR "on")
SET (CPACK_GENERATOR "DEB;TGZ")
SET (CPACK_PACKAGE_NAME "openalpr")
SET (CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_SOURCE_DIR}/build;src;ALL;/")
SET (CPACK_CMAKE_GENERATOR "Unix Makefiles")
SET (CPACK_STRIP_FILES "1")
SET (CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET (CPACK_DEBIAN_PACKAGE_SECTION "video")
SET (CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
SET (CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.1.3), libgcc1 (>= 4.1.1), libtesseract3 (>= 3.0.3), libopencv-core2.4 (>= 2.4.8), libopencv-objdetect2.4 (>= 2.4.8), libopencv-highgui2.4 (>= 2.4.8), libopencv-imgproc2.4 (>= 2.4.8), libopencv-flann2.4 (>= 2.4.8), libopencv-features2d2.4 (>= 2.4.8), libopencv-video2.4 (>= 2.4.8), libopencv-gpu2.4 (>=2.4.8), liblog4cplus-1.0-4, libcurl3, beanstalkd")
SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/../LICENSE")
SET (CPACK_PACKAGE_DESCRIPTION "OpenALPR - Open Source Automatic License Plate Recognition")
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenALPR is an open source Automatic License Plate Recognition library written in C++. The library analyzes images and identifies license plates. The output is the text representation of any license plate characters found in the image. Check out a live online demo here: http://www.openalpr.com/demo.html" )
SET (CPACK_PACKAGE_CONTACT "Matt Hill <[email protected]>")
SET (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_ARCHITECTURE}")
SET (CPACK_COMPONENTS_ALL Libraries ApplicationData)
INCLUDE(CPack)
# ----------------------------------------------------------------------------
# Uninstall target, for "make uninstall"
# http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
# ----------------------------------------------------------------------------
CONFIGURE_FILE(
"${CMAKE_MODULE_PATH}/templates/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
ADD_CUSTOM_TARGET(uninstall COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")