[r1493]: branches / emgucv_2_3 / Emgu.CV.Extern / CMakeLists.txt  Maximize  Restore  History

Download this file

238 lines (208 with data), 9.5 kB

  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
# --------------------------------------------------------
# Copyright (C) 2004-2011 by EMGU. All rights reserved.
#
# CMake file for cvextern. See root CMakeLists.txt
#
# ----------------------------------------------------------------------------
project(cvextern)
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/core/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/imgproc/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/ml/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/calib3d/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/objdetect/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/features2d/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/legacy/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/contrib/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/highgui/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/modules/flann/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/../opencv/include/opencv")
IF(WIN32 AND CV_ICC)
STRING(REGEX REPLACE "/Qipo" "" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
STRING(REGEX REPLACE "/Qipo" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
ENDIF()
############################### IPP START ##############################
IF(WITH_IPP)
include(${PROJECT_SOURCE_DIR}/../opencv/OpenCVFindIPP.cmake)
IF (IPP_FOUND)
message(STATUS "CVEXTERN: USING IPP: ${IPP_LIBRARY_DIRS} ")
add_definitions(-DHAVE_IPP)
include_directories(${IPP_INCLUDE_DIRS})
LINK_DIRECTORIES(${IPP_LIBRARY_DIRS})
ENDIF()
ENDIF()
############################### IPP END ################################
############################### TBB START ##############################
if (WITH_TBB AND TBB_INCLUDE_DIR AND TBB_LIB_DIR)
MESSAGE(STATUS "CVEXTERN: using TBB")
add_definitions(-DHAVE_TBB)
include_directories(${TBB_INCLUDE_DIR})
link_directories(${TBB_LIB_DIR})
IF(WIN32)
SET(TBB_BINARY_FILE_DIR "${TBB_INCLUDE_DIR}/../../redist")
IF(TARGET_ARCH_64)
SET(TBB_BINARY_FILE_DIR "${TBB_BINARY_FILE_DIR}/intel64/tbb")
ELSE()
SET(TBB_BINARY_FILE_DIR "${TBB_BINARY_FILE_DIR}/ia32/tbb")
ENDIF()
if (MSVC80)
SET(TBB_BINARY_FILE_DIR "${TBB_BINARY_FILE_DIR}/vc8")
elseif(MSVC90)
SET(TBB_BINARY_FILE_DIR "${TBB_BINARY_FILE_DIR}/vc9")
elseif(MSVC10)
SET(TBB_BINARY_FILE_DIR "${TBB_BINARY_FILE_DIR}/vc10")
endif()
LIST(APPEND CVEXTERN_DEPENDENCY_DLL_NAMES tbb)
LIST(APPEND CVEXTERN_DEPENDENCY_DLLS "${TBB_BINARY_FILE_DIR}/tbb.dll")
ENDIF()
endif()
############################### TBB END ################################
############################### INTEL ICL START ##############################
IF(WIN32 AND CV_ICC)
IF(TARGET_ARCH_64)
SET(INTEL_ICC_REDIST_PATH "$ENV{ICPP_COMPILER12}redist/intel64/compiler/")
ELSE()
SET(INTEL_ICC_REDIST_PATH "$ENV{ICPP_COMPILER12}redist/ia32/compiler/")
ENDIF()
STRING(REGEX REPLACE "\\\\" "/" INTEL_ICC_REDIST_PATH ${INTEL_ICC_REDIST_PATH})
LIST(APPEND CVEXTERN_DEPENDENCY_DLL_NAMES libomp5md libmmd svml_dispmd)
LIST(APPEND CVEXTERN_DEPENDENCY_DLLS ${INTEL_ICC_REDIST_PATH}libiomp5md.dll ${INTEL_ICC_REDIST_PATH}libmmd.dll ${INTEL_ICC_REDIST_PATH}svml_dispmd.dll)
ENDIF()
############################### INTEL ICL START ##############################
############################### OPENNI START ##############################
IF(WIN32 AND WITH_OPENNI)
IF(TARGET_ARCH_64)
SET(OPENNI_BINARY_FILE "${OPENNI_LIB_DIR}/../Bin64/OpenNI64.dll")
LIST(APPEND CVEXTERN_DEPENDENCY_DLL_NAMES OpenNI64)
ELSE()
SET(OPENNI_BINARY_FILE "${OPENNI_LIB_DIR}/../Bin/OpenNI.dll")
LIST(APPEND CVEXTERN_DEPENDENCY_DLL_NAMES OpenNI)
ENDIF()
LIST(APPEND CVEXTERN_DEPENDENCY_DLLS ${OPENNI_BINARY_FILE})
ENDIF()
############################### OPENNI END ################################
IF(DEFINED CVEXTERN_DEPENDENCY_DLLS)
INSTALL(
FILES
${CVEXTERN_DEPENDENCY_DLLS}
DESTINATION bin
COMPONENT main)
ENDIF()
file(GLOB extern_srcs "./*.cpp")
file(GLOB extern_hdrs "./*.h*")
############################### TESSERACT START ########################
IF(WIN32)
SET(EMGU_CV_WITH_TESSERACT ON CACHE BOOL "BUILD OCR")
IF(EMGU_CV_WITH_TESSERACT)
ADD_SUBDIRECTORY(tesseract/libtesseract)
SET(TESSERACT_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/tesseract/libtesseract/tesseract-ocr/ccutil" "${PROJECT_SOURCE_DIR}/tesseract/libtesseract/tesseract-ocr/api" "${PROJECT_SOURCE_DIR}/tesseract/libtesseract/tesseract-ocr/ccmain" "${PROJECT_SOURCE_DIR}/tesseract/libtesseract/tesseract-ocr/ccstruct" "${PROJECT_SOURCE_DIR}/tesseract")
SET(TESSERACT_LIBRARY tesseract_ccstruct tesseract_ccutil tesseract_classify tesseract_cube tesseract_cutil tesseract_dict tesseract_image tesseract_neural_networks tesseract_api tesseract_textord tesseract_viewer tesseract_wordrec libleptonica tesseract_ccmain)
ENDIF()
ELSE()
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../cmake/modules")
FIND_PACKAGE(TESSERACT)
IF(TESSERACT_FOUND)
SET(EMGU_CV_WITH_TESSERACT ON CACHE BOOL "BUILD OCR")
ELSE()
SET(EMGU_CV_WITH_TESSERACT OFF CACHE BOOL "BUILD OCR")
SET(TESSERACT_INCLUDE_DIRS "")
SET(TESSERACT_LIBRARY "")
ENDIF()
ENDIF()
IF(EMGU_CV_WITH_TESSERACT)
INCLUDE_DIRECTORIES(${TESSERACT_INCLUDE_DIRS})
LIST(APPEND extern_srcs "${PROJECT_SOURCE_DIR}/tesseract/tesseract.cpp")
ENDIF()
############################### TESSERACT END ##########################
source_group("Src" FILES ${extern_srcs})
source_group("Include" FILES ${extern_hdrs})
set(the_target ${PROJECT_NAME})
add_library(${the_target} ${extern_srcs} ${extern_hdrs})
IF(DEFINED CVEXTERN_DEPENDENCY_DLLS)
FOREACH(CVEXTERN_DEPENDENCY_DLL ${CVEXTERN_DEPENDENCY_DLLS})
LIST(APPEND CVEXTERN_DEPENDENCY_DLL_DEPLOY_COMMAND COMMAND ${CMAKE_COMMAND} -E copy "${CVEXTERN_DEPENDENCY_DLL}" ${LIBRARY_OUTPUT_PATH})
ENDFOREACH()
#Promote this to parent scope such that cpack will know what dlls to be included in the package
SET(CVEXTERN_DEPENDENCY_DLL_NAMES ${CVEXTERN_DEPENDENCY_DLL_NAMES} PARENT_SCOPE)
ADD_CUSTOM_COMMAND(
TARGET ${the_target}
POST_BUILD
${CVEXTERN_DEPENDENCY_DLL_DEPLOY_COMMAND}
COMMENT "Copying ${CVEXTERN_DEPENDENCY_DLLS} to ${LIBRARY_OUTPUT_PATH}")
ENDIF()
# For dynamic link numbering convenions
set_target_properties(${the_target} PROPERTIES
OUTPUT_NAME "${the_target}"
)
# Additional target properties
set_target_properties(${the_target} PROPERTIES
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
DEFINE_SYMBOL "CVAPI_EXPORTS"
)
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "emgu")
endif()
FIND_PACKAGE(TIFF)
IF(NOT TIFF_FOUND)
ADD_DEPENDENCIES(${the_target} libtiff)
SET(TIFF_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../opencv/3rdparty/libtiff")
SET(TIFF_LIBRARY "libtiff")
ENDIF()
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
MESSAGE(STATUS "CVEXTERN: ZLIB found.")
ENDIF()
IF(NOT ZLIB_FOUND)
MESSAGE(STATUS "CVEXTERN: ZLIB not found, building from source")
ADD_DEPENDENCIES(${the_target} zlib)
SET(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../opencv/3rdparty/zlib")
SET(ZLIB_LIBRARY "zlib")
ENDIF()
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/libgeotiff/cmake")
FIND_PACKAGE(GeoTIFF)
IF(GEOTIFF_FOUND)
MESSAGE(STATUS "CVEXTERN: GEOTIFF found. INCLUDE DIR: ${GEOTIFF_INCLUDE_DIR}")
ENDIF()
IF (NOT GEOTIFF_FOUND)
MESSAGE(STATUS "CVEXTERN: GEOTIFF not found. Building from source")
# ----------------------------------------------------------------------------
# Build libgeotiff
# ----------------------------------------------------------------------------
ADD_SUBDIRECTORY(libgeotiff/libgeotiff-1.3.0)
SET(GEOTIFF_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../opencv/3rdparty/libtiff" "${PROJECT_SOURCE_DIR}/libgeotiff/libgeotiff-1.3.0" "${PROJECT_SOURCE_DIR}/libgeotiff/libgeotiff-1.3.0/libxtiff")
SET(GEOTIFF_LIBRARY geotiff_archive xtiff)
ENDIF()
INCLUDE_DIRECTORIES(${GEOTIFF_INCLUDE_DIR})
ADD_DEPENDENCIES(${the_target}
opencv_core opencv_calib3d opencv_contrib opencv_features2d opencv_highgui opencv_imgproc opencv_legacy opencv_ml opencv_objdetect
${ZLIB_LIBRARY}
# xtiff
${TIFF_LIBRARY} ${GEOTIFF_LIBRARY} ${TESSERACT_LIBRARY})
IF(EMGU_ENABLE_SSE)
ADD_DEFINITIONS(-D__EMGU_ENABLE_SSE__)
IF(MSVC AND (NOT CV_ICC) AND (NOT TARGET_ARCH_64))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") ## Optimization
ENDIF()
ENDIF()
#disable warnings
IF(MSVC)
ADD_DEFINITIONS(-wd4251 -D_CRT_SECURE_NO_WARNINGS)
ENDIF()
# Add the required libraries for linking:
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS}
opencv_core opencv_calib3d opencv_contrib opencv_features2d opencv_highgui opencv_imgproc opencv_legacy opencv_ml opencv_objdetect
${ZLIB_LIBRARY}
# xtiff
${TIFF_LIBRARY} ${GEOTIFF_LIBRARY} ${TESSERACT_LIBRARY})
IF(WIN32 AND EMGU_CV_WITH_TESSERACT)
#additional linkage required for tesseract built on windows
target_link_libraries(${the_target} Ws2_32)
ENDIF()
INSTALL(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
LIBRARY DESTINATION lib COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main)
add_subdirectory(gpu)