mirror of https://github.com/opencv/opencv.git
Started top-level CMakeLists.txt file reorganization: cmake scripts are moved to separate folder; refactored BUILD_*, INSTALL_*, ENABLE_*, USE_*, WITH_* options.
parent
60eecd4529
commit
8cab65c173
22 changed files with 1068 additions and 1228 deletions
@ -1,143 +1,143 @@ |
||||
# creates target "${_target}_android_project" for building standard Android project |
||||
macro(add_android_project _target _path) |
||||
SET (android_dependencies opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core) |
||||
if(NOT BUILD_SHARED_LIBS) |
||||
LIST(APPEND android_dependencies opencv_androidcamera) |
||||
endif() |
||||
|
||||
if (ANDROID AND CAN_BUILD_ANDROID_PROJECTS) |
||||
file(GLOB_RECURSE res_files_all RELATIVE "${_path}" "${_path}/res/*") |
||||
file(GLOB_RECURSE jni_files_all RELATIVE "${_path}" "${_path}/jni/*.c*" "${_path}/jni/*.h*") |
||||
file(GLOB_RECURSE src_files_all RELATIVE "${_path}" "${_path}/src/*.java") |
||||
|
||||
#remove .svn |
||||
set(res_files) |
||||
foreach(f ${res_files_all}) |
||||
if(NOT f MATCHES "\\.svn") |
||||
list(APPEND res_files "${f}") |
||||
endif() |
||||
endforeach() |
||||
set(jni_files) |
||||
foreach(f ${jni_files_all}) |
||||
if(NOT f MATCHES "\\.svn") |
||||
list(APPEND jni_files "${f}") |
||||
endif() |
||||
endforeach() |
||||
set(src_files) |
||||
foreach(f ${src_files_all}) |
||||
if(NOT f MATCHES "\\.svn") |
||||
list(APPEND src_files "${f}") |
||||
endif() |
||||
endforeach() |
||||
|
||||
# get temporary location for the project |
||||
file(RELATIVE_PATH build_path "${OpenCV_SOURCE_DIR}" "${_path}") |
||||
SET(build_path "${CMAKE_BINARY_DIR}/${build_path}") |
||||
|
||||
# copy project to temporary location |
||||
SET(${_target}_project_files) |
||||
foreach(f ${res_files} ${src_files} "AndroidManifest.xml") |
||||
if(NOT "${build_path}" STREQUAL "${_path}") |
||||
#this is not needed in case of in-source build |
||||
add_custom_command( |
||||
OUTPUT "${build_path}/${f}" |
||||
COMMAND ${CMAKE_COMMAND} -E copy "${_path}/${f}" "${build_path}/${f}" |
||||
DEPENDS "${_path}/${f}" |
||||
COMMENT "" |
||||
) |
||||
endif() |
||||
list(APPEND ${_target}_project_files "${build_path}/${f}") |
||||
endforeach() |
||||
|
||||
# process default.properties |
||||
file(STRINGS "${_path}/default.properties" default_properties REGEX "^android\\.library\\.reference\\.1=.+$") |
||||
if (default_properties) |
||||
# has opencv dependency |
||||
file(RELATIVE_PATH OPENCV_REFERENCE_PATH "${build_path}" "${CMAKE_BINARY_DIR}") |
||||
add_custom_command( |
||||
OUTPUT "${build_path}/default.properties" |
||||
OUTPUT "${build_path}/build.xml" |
||||
OUTPUT "${build_path}/local.properties" |
||||
OUTPUT "${build_path}/proguard.cfg" |
||||
COMMAND ${CMAKE_COMMAND} -E echo "" > "default.properties" |
||||
COMMAND ${ANDROID_EXECUTABLE} update project --name "${_target}" --target "${ANDROID_SDK_TARGET}" --library "${OPENCV_REFERENCE_PATH}" --path . |
||||
WORKING_DIRECTORY ${build_path} |
||||
DEPENDS ${${_target}_project_files} |
||||
DEPENDS "${CMAKE_BINARY_DIR}/default.properties" |
||||
DEPENDS "${CMAKE_BINARY_DIR}/AndroidManifest.xml" |
||||
COMMENT "Updating android project - ${_target}" |
||||
) |
||||
else() |
||||
# has no opencv dependency |
||||
add_custom_command( |
||||
OUTPUT "${build_path}/default.properties" |
||||
OUTPUT "${build_path}/build.xml" |
||||
OUTPUT "${build_path}/local.properties" |
||||
OUTPUT "${build_path}/proguard.cfg" |
||||
COMMAND ${CMAKE_COMMAND} -E echo "" > "default.properties" |
||||
COMMAND ${ANDROID_EXECUTABLE} update project --name "${_target}" --target "${ANDROID_SDK_TARGET}" --path . |
||||
WORKING_DIRECTORY ${build_path} |
||||
DEPENDS ${${_target}_project_files} |
||||
COMMENT "Updating android project - ${_target}" |
||||
) |
||||
endif() |
||||
|
||||
if("${build_path}" STREQUAL "${_path}") |
||||
#in case of in-source build default.properties file is not generated (it is just overwritten :) |
||||
SET_SOURCE_FILES_PROPERTIES("${build_path}/default.properties" PROPERTIES GENERATED FALSE) |
||||
endif() |
||||
|
||||
list(APPEND ${_target}_project_files "${build_path}/default.properties" "${build_path}/build.xml" "${build_path}/local.properties" "${build_path}/proguard.cfg") |
||||
|
||||
# build native part of android project |
||||
if(jni_files) |
||||
INCLUDE_DIRECTORIES("${_path}/jni") |
||||
|
||||
FILE(STRINGS "${_path}/jni/Android.mk" JNI_LIB_NAME REGEX "LOCAL_MODULE[ ]*:=[ ]*.*" ) |
||||
string(REGEX REPLACE "LOCAL_MODULE[ ]*:=[ ]*([a-zA-Z_][a-zA-Z_0-9]*)[ ]*" "\\1" JNI_LIB_NAME "${JNI_LIB_NAME}") |
||||
|
||||
SET(jni_sources) |
||||
foreach(src ${jni_files}) |
||||
list(APPEND jni_sources "${_path}/${src}") |
||||
endforeach() |
||||
|
||||
ADD_LIBRARY(${JNI_LIB_NAME} MODULE ${jni_sources}) |
||||
TARGET_LINK_LIBRARIES(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_dependencies}) |
||||
|
||||
set_target_properties(${JNI_LIB_NAME} PROPERTIES |
||||
OUTPUT_NAME "${JNI_LIB_NAME}" |
||||
LIBRARY_OUTPUT_DIRECTORY "${build_path}/libs/${ANDROID_NDK_ABI_NAME}" |
||||
) |
||||
|
||||
ADD_CUSTOM_COMMAND( |
||||
TARGET ${JNI_LIB_NAME} |
||||
POST_BUILD |
||||
COMMAND ${CMAKE_STRIP} "${build_path}/libs/${ANDROID_NDK_ABI_NAME}/*.so" |
||||
) |
||||
else() |
||||
SET(JNI_LIB_NAME) |
||||
endif() |
||||
|
||||
add_custom_command( |
||||
OUTPUT "${build_path}/bin/${_target}-debug.apk" |
||||
OUTPUT "${CMAKE_BINARY_DIR}/bin/${_target}.apk" |
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug |
||||
COMMAND ${CMAKE_COMMAND} -E copy "${build_path}/bin/${_target}-debug.apk" "${CMAKE_BINARY_DIR}/bin/${_target}.apk" |
||||
WORKING_DIRECTORY ${build_path} |
||||
DEPENDS ${${_target}_project_files} |
||||
DEPENDS "${LIBRARY_OUTPUT_PATH}/libopencv_java.so" |
||||
COMMENT "Generating bin/${_target}.apk" |
||||
) |
||||
|
||||
ADD_CUSTOM_TARGET(${_target}_android_project ALL |
||||
DEPENDS "${build_path}/bin/${_target}-debug.apk" |
||||
DEPENDS "${CMAKE_BINARY_DIR}/bin/${_target}.apk" |
||||
) |
||||
|
||||
add_dependencies(${_target}_android_project opencv_java ${JNI_LIB_NAME}) |
||||
|
||||
if("${ARGN}" STREQUAL "INSTALL" AND INSTALL_ANDROID_EXAMPLES) |
||||
install(FILES "${CMAKE_BINARY_DIR}/bin/${_target}.apk" DESTINATION "bin" COMPONENT main) |
||||
endif() |
||||
endif() |
||||
endmacro() |
||||
# creates target "${_target}_android_project" for building standard Android project |
||||
macro(add_android_project _target _path) |
||||
SET (android_dependencies opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core) |
||||
if(NOT BUILD_SHARED_LIBS) |
||||
LIST(APPEND android_dependencies opencv_androidcamera) |
||||
endif() |
||||
|
||||
if (ANDROID AND CAN_BUILD_ANDROID_PROJECTS) |
||||
file(GLOB_RECURSE res_files_all RELATIVE "${_path}" "${_path}/res/*") |
||||
file(GLOB_RECURSE jni_files_all RELATIVE "${_path}" "${_path}/jni/*.c*" "${_path}/jni/*.h*") |
||||
file(GLOB_RECURSE src_files_all RELATIVE "${_path}" "${_path}/src/*.java") |
||||
|
||||
#remove .svn |
||||
set(res_files) |
||||
foreach(f ${res_files_all}) |
||||
if(NOT f MATCHES "\\.svn") |
||||
list(APPEND res_files "${f}") |
||||
endif() |
||||
endforeach() |
||||
set(jni_files) |
||||
foreach(f ${jni_files_all}) |
||||
if(NOT f MATCHES "\\.svn") |
||||
list(APPEND jni_files "${f}") |
||||
endif() |
||||
endforeach() |
||||
set(src_files) |
||||
foreach(f ${src_files_all}) |
||||
if(NOT f MATCHES "\\.svn") |
||||
list(APPEND src_files "${f}") |
||||
endif() |
||||
endforeach() |
||||
|
||||
# get temporary location for the project |
||||
file(RELATIVE_PATH build_path "${OpenCV_SOURCE_DIR}" "${_path}") |
||||
SET(build_path "${CMAKE_BINARY_DIR}/${build_path}") |
||||
|
||||
# copy project to temporary location |
||||
SET(${_target}_project_files) |
||||
foreach(f ${res_files} ${src_files} "AndroidManifest.xml") |
||||
if(NOT "${build_path}" STREQUAL "${_path}") |
||||
#this is not needed in case of in-source build |
||||
add_custom_command( |
||||
OUTPUT "${build_path}/${f}" |
||||
COMMAND ${CMAKE_COMMAND} -E copy "${_path}/${f}" "${build_path}/${f}" |
||||
DEPENDS "${_path}/${f}" |
||||
COMMENT "" |
||||
) |
||||
endif() |
||||
list(APPEND ${_target}_project_files "${build_path}/${f}") |
||||
endforeach() |
||||
|
||||
# process default.properties |
||||
file(STRINGS "${_path}/default.properties" default_properties REGEX "^android\\.library\\.reference\\.1=.+$") |
||||
if (default_properties) |
||||
# has opencv dependency |
||||
file(RELATIVE_PATH OPENCV_REFERENCE_PATH "${build_path}" "${CMAKE_BINARY_DIR}") |
||||
add_custom_command( |
||||
OUTPUT "${build_path}/default.properties" |
||||
OUTPUT "${build_path}/build.xml" |
||||
OUTPUT "${build_path}/local.properties" |
||||
OUTPUT "${build_path}/proguard.cfg" |
||||
COMMAND ${CMAKE_COMMAND} -E echo "" > "default.properties" |
||||
COMMAND ${ANDROID_EXECUTABLE} update project --name "${_target}" --target "${ANDROID_SDK_TARGET}" --library "${OPENCV_REFERENCE_PATH}" --path . |
||||
WORKING_DIRECTORY ${build_path} |
||||
DEPENDS ${${_target}_project_files} |
||||
DEPENDS "${CMAKE_BINARY_DIR}/default.properties" |
||||
DEPENDS "${CMAKE_BINARY_DIR}/AndroidManifest.xml" |
||||
COMMENT "Updating android project - ${_target}" |
||||
) |
||||
else() |
||||
# has no opencv dependency |
||||
add_custom_command( |
||||
OUTPUT "${build_path}/default.properties" |
||||
OUTPUT "${build_path}/build.xml" |
||||
OUTPUT "${build_path}/local.properties" |
||||
OUTPUT "${build_path}/proguard.cfg" |
||||
COMMAND ${CMAKE_COMMAND} -E echo "" > "default.properties" |
||||
COMMAND ${ANDROID_EXECUTABLE} update project --name "${_target}" --target "${ANDROID_SDK_TARGET}" --path . |
||||
WORKING_DIRECTORY ${build_path} |
||||
DEPENDS ${${_target}_project_files} |
||||
COMMENT "Updating android project - ${_target}" |
||||
) |
||||
endif() |
||||
|
||||
if("${build_path}" STREQUAL "${_path}") |
||||
#in case of in-source build default.properties file is not generated (it is just overwritten :) |
||||
SET_SOURCE_FILES_PROPERTIES("${build_path}/default.properties" PROPERTIES GENERATED FALSE) |
||||
endif() |
||||
|
||||
list(APPEND ${_target}_project_files "${build_path}/default.properties" "${build_path}/build.xml" "${build_path}/local.properties" "${build_path}/proguard.cfg") |
||||
|
||||
# build native part of android project |
||||
if(jni_files) |
||||
INCLUDE_DIRECTORIES("${_path}/jni") |
||||
|
||||
FILE(STRINGS "${_path}/jni/Android.mk" JNI_LIB_NAME REGEX "LOCAL_MODULE[ ]*:=[ ]*.*" ) |
||||
string(REGEX REPLACE "LOCAL_MODULE[ ]*:=[ ]*([a-zA-Z_][a-zA-Z_0-9]*)[ ]*" "\\1" JNI_LIB_NAME "${JNI_LIB_NAME}") |
||||
|
||||
SET(jni_sources) |
||||
foreach(src ${jni_files}) |
||||
list(APPEND jni_sources "${_path}/${src}") |
||||
endforeach() |
||||
|
||||
ADD_LIBRARY(${JNI_LIB_NAME} MODULE ${jni_sources}) |
||||
TARGET_LINK_LIBRARIES(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_dependencies}) |
||||
|
||||
set_target_properties(${JNI_LIB_NAME} PROPERTIES |
||||
OUTPUT_NAME "${JNI_LIB_NAME}" |
||||
LIBRARY_OUTPUT_DIRECTORY "${build_path}/libs/${ANDROID_NDK_ABI_NAME}" |
||||
) |
||||
|
||||
ADD_CUSTOM_COMMAND( |
||||
TARGET ${JNI_LIB_NAME} |
||||
POST_BUILD |
||||
COMMAND ${CMAKE_STRIP} "${build_path}/libs/${ANDROID_NDK_ABI_NAME}/*.so" |
||||
) |
||||
else() |
||||
SET(JNI_LIB_NAME) |
||||
endif() |
||||
|
||||
add_custom_command( |
||||
OUTPUT "${build_path}/bin/${_target}-debug.apk" |
||||
OUTPUT "${CMAKE_BINARY_DIR}/bin/${_target}.apk" |
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug |
||||
COMMAND ${CMAKE_COMMAND} -E copy "${build_path}/bin/${_target}-debug.apk" "${CMAKE_BINARY_DIR}/bin/${_target}.apk" |
||||
WORKING_DIRECTORY ${build_path} |
||||
DEPENDS ${${_target}_project_files} |
||||
DEPENDS "${LIBRARY_OUTPUT_PATH}/libopencv_java.so" |
||||
COMMENT "Generating bin/${_target}.apk" |
||||
) |
||||
|
||||
ADD_CUSTOM_TARGET(${_target}_android_project ALL |
||||
DEPENDS "${build_path}/bin/${_target}-debug.apk" |
||||
DEPENDS "${CMAKE_BINARY_DIR}/bin/${_target}.apk" |
||||
) |
||||
|
||||
add_dependencies(${_target}_android_project opencv_java ${JNI_LIB_NAME}) |
||||
|
||||
if("${ARGN}" STREQUAL "INSTALL" AND INSTALL_ANDROID_EXAMPLES) |
||||
install(FILES "${CMAKE_BINARY_DIR}/bin/${_target}.apk" DESTINATION "bin" COMPONENT main) |
||||
endif() |
||||
endif() |
||||
endmacro() |
@ -1,320 +1,322 @@ |
||||
# |
||||
# The script to detect Intel(R) Integrated Performance Primitives (IPP) |
||||
# installation/package |
||||
# |
||||
# This will try to find Intel IPP libraries, and include path by automatic |
||||
# search through typical install locations and if failed it will |
||||
# examine IPPROOT environment variable. |
||||
# Note, IPPROOT is not set by IPP installer, it should be set manually. |
||||
# |
||||
# On return this will define: |
||||
# |
||||
# IPP_FOUND - True if Intel IPP found |
||||
# IPP_ROOT_DIR - root of IPP installation |
||||
# IPP_INCLUDE_DIRS - IPP include folder |
||||
# IPP_LIBRARY_DIRS - IPP libraries folder |
||||
# IPP_LIBRARIES - IPP libraries names that are used by OpenCV |
||||
# IPP_LATEST_VERSION_STR - string with the newest detected IPP version |
||||
# IPP_LATEST_VERSION_MAJOR - numbers of IPP version (MAJOR.MINOR.BUILD) |
||||
# IPP_LATEST_VERSION_MINOR |
||||
# IPP_LATEST_VERSION_BUILD |
||||
# |
||||
# Created: 30 Dec 2010 by Vladimir Dudnik (vladimir.dudnik@intel.com) |
||||
# |
||||
|
||||
set(IPP_FOUND) |
||||
set(IPP_VERSION_STR "5.3.0.0") # will not detect earlier versions |
||||
set(IPP_VERSION_MAJOR 0) |
||||
set(IPP_VERSION_MINOR 0) |
||||
set(IPP_VERSION_BUILD 0) |
||||
set(IPP_ROOT_DIR) |
||||
set(IPP_INCLUDE_DIRS) |
||||
set(IPP_LIBRARY_DIRS) |
||||
set(IPP_LIBRARIES) |
||||
set(LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX}) |
||||
set(LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) |
||||
set(IPP_PREFIX "ipp") |
||||
set(IPP_SUFFIX "_l") |
||||
set(IPPCORE "core") # core functionality |
||||
set(IPPS "s") # signal processing |
||||
set(IPPI "i") # image processing |
||||
set(IPPCC "cc") # color conversion |
||||
set(IPPCV "cv") # computer vision |
||||
set(IPPVM "vm") # vector math |
||||
|
||||
|
||||
set(IPP_X64 0) |
||||
if (CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) |
||||
set(IPP_X64 1) |
||||
endif() |
||||
if (CMAKE_CL_64) |
||||
set(IPP_X64 1) |
||||
endif() |
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This function detect IPP version by analyzing ippversion.h file |
||||
# Note, ippversion.h file was inroduced since IPP 5.3 |
||||
# ------------------------------------------------------------------------ |
||||
function(get_ipp_version _ROOT_DIR) |
||||
set(_VERSION_STR) |
||||
set(_MAJOR) |
||||
set(_MINOR) |
||||
set(_BUILD) |
||||
|
||||
# read IPP version info from file |
||||
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR1 REGEX "IPP_VERSION_MAJOR") |
||||
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR2 REGEX "IPP_VERSION_MINOR") |
||||
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR3 REGEX "IPP_VERSION_BUILD") |
||||
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR4 REGEX "IPP_VERSION_STR") |
||||
|
||||
# extract info and assign to variables |
||||
string(REGEX MATCHALL "[0-9]+" _MAJOR ${STR1}) |
||||
string(REGEX MATCHALL "[0-9]+" _MINOR ${STR2}) |
||||
string(REGEX MATCHALL "[0-9]+" _BUILD ${STR3}) |
||||
string(REGEX MATCHALL "[0-9]+[.]+[0-9]+[^\"]+|[0-9]+[.]+[0-9]+" _VERSION_STR ${STR4}) |
||||
|
||||
# export info to parent scope |
||||
set(IPP_VERSION_STR ${_VERSION_STR} PARENT_SCOPE) |
||||
set(IPP_VERSION_MAJOR ${_MAJOR} PARENT_SCOPE) |
||||
set(IPP_VERSION_MINOR ${_MINOR} PARENT_SCOPE) |
||||
set(IPP_VERSION_BUILD ${_BUILD} PARENT_SCOPE) |
||||
|
||||
message(STATUS "found IPP: ${_MAJOR}.${_MINOR}.${_BUILD} [${_VERSION_STR}]") |
||||
message(STATUS "at: ${_ROOT_DIR}") |
||||
|
||||
return() |
||||
|
||||
endfunction() |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This is auxiliary function called from set_ipp_variables() |
||||
# to set IPP_LIBRARIES variable in IPP 6.x style (IPP 5.3 should also work) |
||||
# ------------------------------------------------------------------------ |
||||
function(set_ipp_old_libraries) |
||||
set(IPP_PREFIX "ipp") |
||||
set(IPP_SUFFIX) # old style static core libs suffix |
||||
set(IPP_ARCH) # architecture suffix |
||||
set(IPP_DISP "emerged") # old style dipatcher and cpu-specific |
||||
set(IPP_MRGD "merged") # static libraries |
||||
set(IPPCORE "core") # core functionality |
||||
set(IPPSP "s") # signal processing |
||||
set(IPPIP "i") # image processing |
||||
set(IPPCC "cc") # color conversion |
||||
set(IPPCV "cv") # computer vision |
||||
set(IPPVM "vm") # vector math |
||||
|
||||
if (IPP_X64) |
||||
set(IPP_ARCH "em64t") |
||||
endif() |
||||
|
||||
if(WIN32) |
||||
set(IPP_SUFFIX "l") |
||||
endif() |
||||
|
||||
set(IPP_LIBRARIES |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPIP}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPIP}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPSP}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPSP}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_ARCH}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
PARENT_SCOPE) |
||||
|
||||
return() |
||||
|
||||
endfunction() |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This is auxiliary function called from set_ipp_variables() |
||||
# to set IPP_LIBRARIES variable in IPP 7.x style |
||||
# ------------------------------------------------------------------------ |
||||
function(set_ipp_new_libraries) |
||||
set(IPP_PREFIX "ipp") |
||||
set(IPP_SUFFIX "_l") # static not threaded libs suffix |
||||
set(IPP_THRD "_t") # static threaded libs suffix |
||||
set(IPPCORE "core") # core functionality |
||||
set(IPPSP "s") # signal processing |
||||
set(IPPIP "i") # image processing |
||||
set(IPPCC "cc") # color conversion |
||||
set(IPPCV "cv") # computer vision |
||||
set(IPPVM "vm") # vector math |
||||
|
||||
set(IPP_LIBRARIES |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPI}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPS}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
PARENT_SCOPE) |
||||
|
||||
return() |
||||
|
||||
endfunction() |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This function will set |
||||
# IPP_INCLUDE_DIRS, IPP_LIBRARY_DIRS and IPP_LIBRARIES variables depending |
||||
# on IPP version parameter. |
||||
# Since IPP 7.0 version library names and install folder structure |
||||
# was changed |
||||
# ------------------------------------------------------------------------ |
||||
function(set_ipp_variables _LATEST_VERSION) |
||||
if(${_LATEST_VERSION} VERSION_LESS "7.0") |
||||
# message(STATUS "old") |
||||
|
||||
# set INCLUDE and LIB folders |
||||
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE) |
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE) |
||||
|
||||
if (IPP_X64) |
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/../em64t) |
||||
message(SEND_ERROR "IPP EM64T libraries not found") |
||||
endif() |
||||
else() |
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/../ia32) |
||||
message(SEND_ERROR "IPP IA32 libraries not found") |
||||
endif() |
||||
endif() |
||||
|
||||
# set IPP_LIBRARIES variable (6.x lib names) |
||||
set_ipp_old_libraries() |
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) |
||||
message(STATUS "IPP libs: ${IPP_LIBRARIES}") |
||||
|
||||
else() |
||||
# message(STATUS "new") |
||||
|
||||
# set INCLUDE and LIB folders |
||||
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE) |
||||
|
||||
if (IPP_X64) |
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64) |
||||
message(SEND_ERROR "IPP EM64T libraries not found") |
||||
endif() |
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64 PARENT_SCOPE) |
||||
else() |
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32) |
||||
message(SEND_ERROR "IPP IA32 libraries not found") |
||||
endif() |
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32 PARENT_SCOPE) |
||||
endif() |
||||
|
||||
# set IPP_LIBRARIES variable (7.x lib names) |
||||
set_ipp_new_libraries() |
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) |
||||
message(STATUS "IPP libs: ${IPP_LIBRARIES}") |
||||
|
||||
endif() |
||||
|
||||
return() |
||||
|
||||
endfunction() |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This section will look for IPP through IPPROOT env variable |
||||
# Note, IPPROOT is not set by IPP installer, you may need to set it manually |
||||
# ------------------------------------------------------------------------ |
||||
find_path( |
||||
IPP_H_PATH |
||||
NAMES ippversion.h |
||||
PATHS $ENV{IPPROOT} |
||||
PATH_SUFFIXES include |
||||
DOC "The path to Intel(R) IPP header files" |
||||
NO_DEFAULT_PATH |
||||
NO_CMAKE_PATH) |
||||
|
||||
if(IPP_H_PATH) |
||||
|
||||
set(IPP_FOUND 1) |
||||
|
||||
# traverse up to IPPROOT level |
||||
get_filename_component(IPP_ROOT_DIR ${IPP_H_PATH} PATH) |
||||
|
||||
# extract IPP version info |
||||
get_ipp_version(${IPP_ROOT_DIR}) |
||||
|
||||
# keep info in the same vars for auto search and search by IPPROOT |
||||
set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR}) |
||||
set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR}) |
||||
set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR}) |
||||
set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD}) |
||||
|
||||
# set IPP INCLUDE, LIB dirs and library names |
||||
set_ipp_variables(${IPP_LATEST_VERSION_STR}) |
||||
|
||||
endif() |
||||
|
||||
|
||||
if(IPP_FOUND) |
||||
return() |
||||
endif() |
||||
|
||||
# reset var from previous search |
||||
set(IPP_H_PATH) |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This section will look for IPP through system program folders |
||||
# Note, if several IPP installations found the newest version will be |
||||
# selected |
||||
# ------------------------------------------------------------------------ |
||||
foreach(curdir ${CMAKE_SYSTEM_PREFIX_PATH}) |
||||
set(curdir ${curdir}/intel) |
||||
file(TO_CMAKE_PATH ${curdir} CURDIR) |
||||
|
||||
if(EXISTS ${curdir}) |
||||
file(GLOB_RECURSE IPP_H_DIR ${curdir}/ippversion.h) |
||||
|
||||
if(IPP_H_DIR) |
||||
set(IPP_FOUND 1) |
||||
endif() |
||||
|
||||
# init IPP_LATEST_VERSION version with oldest detectable version (5.3.0.0) |
||||
# IPP prior 5.3 did not have ippversion.h file |
||||
set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR}) |
||||
|
||||
# look through all dirs where ippversion.h was found |
||||
foreach(item ${IPP_H_DIR}) |
||||
|
||||
# traverse up to IPPROOT level |
||||
get_filename_component(_FILE_PATH ${item} PATH) |
||||
get_filename_component(_ROOT_DIR ${_FILE_PATH} PATH) |
||||
|
||||
# extract IPP version info |
||||
get_ipp_version(${_ROOT_DIR}) |
||||
|
||||
# remember the latest version (if many found) |
||||
if(${IPP_LATEST_VERSION_STR} VERSION_LESS ${IPP_VERSION_STR}) |
||||
set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR}) |
||||
set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR}) |
||||
set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR}) |
||||
set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD}) |
||||
set(IPP_ROOT_DIR ${_ROOT_DIR}) |
||||
endif() |
||||
endforeach() |
||||
endif() |
||||
endforeach() |
||||
|
||||
# set IPP INCLUDE, LIB dirs and library names |
||||
set_ipp_variables(${IPP_LATEST_VERSION_STR}) |
||||
|
||||
# set CACHE variable IPP_H_PATH, |
||||
# path to IPP header files for the latest version |
||||
find_path( |
||||
IPP_H_PATH |
||||
NAMES ippversion.h |
||||
PATHS ${IPP_ROOT_DIR} |
||||
PATH_SUFFIXES include |
||||
DOC "The path to Intel(R) IPP header files" |
||||
NO_DEFAULT_PATH |
||||
NO_CMAKE_PATH) |
||||
# |
||||
# The script to detect Intel(R) Integrated Performance Primitives (IPP) |
||||
# installation/package |
||||
# |
||||
# This will try to find Intel IPP libraries, and include path by automatic |
||||
# search through typical install locations and if failed it will |
||||
# examine IPPROOT environment variable. |
||||
# Note, IPPROOT is not set by IPP installer, it should be set manually. |
||||
# |
||||
# On return this will define: |
||||
# |
||||
# IPP_FOUND - True if Intel IPP found |
||||
# IPP_ROOT_DIR - root of IPP installation |
||||
# IPP_INCLUDE_DIRS - IPP include folder |
||||
# IPP_LIBRARY_DIRS - IPP libraries folder |
||||
# IPP_LIBRARIES - IPP libraries names that are used by OpenCV |
||||
# IPP_LATEST_VERSION_STR - string with the newest detected IPP version |
||||
# IPP_LATEST_VERSION_MAJOR - numbers of IPP version (MAJOR.MINOR.BUILD) |
||||
# IPP_LATEST_VERSION_MINOR |
||||
# IPP_LATEST_VERSION_BUILD |
||||
# |
||||
# Created: 30 Dec 2010 by Vladimir Dudnik (vladimir.dudnik@intel.com) |
||||
# |
||||
|
||||
set(IPP_FOUND) |
||||
set(IPP_VERSION_STR "5.3.0.0") # will not detect earlier versions |
||||
set(IPP_VERSION_MAJOR 0) |
||||
set(IPP_VERSION_MINOR 0) |
||||
set(IPP_VERSION_BUILD 0) |
||||
set(IPP_ROOT_DIR) |
||||
set(IPP_INCLUDE_DIRS) |
||||
set(IPP_LIBRARY_DIRS) |
||||
set(IPP_LIBRARIES) |
||||
set(LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX}) |
||||
set(LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) |
||||
set(IPP_PREFIX "ipp") |
||||
set(IPP_SUFFIX "_l") |
||||
set(IPPCORE "core") # core functionality |
||||
set(IPPS "s") # signal processing |
||||
set(IPPI "i") # image processing |
||||
set(IPPCC "cc") # color conversion |
||||
set(IPPCV "cv") # computer vision |
||||
set(IPPVM "vm") # vector math |
||||
|
||||
|
||||
set(IPP_X64 0) |
||||
if (CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) |
||||
set(IPP_X64 1) |
||||
endif() |
||||
if (CMAKE_CL_64) |
||||
set(IPP_X64 1) |
||||
endif() |
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This function detect IPP version by analyzing ippversion.h file |
||||
# Note, ippversion.h file was inroduced since IPP 5.3 |
||||
# ------------------------------------------------------------------------ |
||||
function(get_ipp_version _ROOT_DIR) |
||||
set(_VERSION_STR) |
||||
set(_MAJOR) |
||||
set(_MINOR) |
||||
set(_BUILD) |
||||
|
||||
# read IPP version info from file |
||||
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR1 REGEX "IPP_VERSION_MAJOR") |
||||
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR2 REGEX "IPP_VERSION_MINOR") |
||||
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR3 REGEX "IPP_VERSION_BUILD") |
||||
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR4 REGEX "IPP_VERSION_STR") |
||||
|
||||
# extract info and assign to variables |
||||
string(REGEX MATCHALL "[0-9]+" _MAJOR ${STR1}) |
||||
string(REGEX MATCHALL "[0-9]+" _MINOR ${STR2}) |
||||
string(REGEX MATCHALL "[0-9]+" _BUILD ${STR3}) |
||||
string(REGEX MATCHALL "[0-9]+[.]+[0-9]+[^\"]+|[0-9]+[.]+[0-9]+" _VERSION_STR ${STR4}) |
||||
|
||||
# export info to parent scope |
||||
set(IPP_VERSION_STR ${_VERSION_STR} PARENT_SCOPE) |
||||
set(IPP_VERSION_MAJOR ${_MAJOR} PARENT_SCOPE) |
||||
set(IPP_VERSION_MINOR ${_MINOR} PARENT_SCOPE) |
||||
set(IPP_VERSION_BUILD ${_BUILD} PARENT_SCOPE) |
||||
|
||||
message(STATUS "found IPP: ${_MAJOR}.${_MINOR}.${_BUILD} [${_VERSION_STR}]") |
||||
message(STATUS "at: ${_ROOT_DIR}") |
||||
|
||||
return() |
||||
|
||||
endfunction() |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This is auxiliary function called from set_ipp_variables() |
||||
# to set IPP_LIBRARIES variable in IPP 6.x style (IPP 5.3 should also work) |
||||
# ------------------------------------------------------------------------ |
||||
function(set_ipp_old_libraries) |
||||
set(IPP_PREFIX "ipp") |
||||
set(IPP_SUFFIX) # old style static core libs suffix |
||||
set(IPP_ARCH) # architecture suffix |
||||
set(IPP_DISP "emerged") # old style dipatcher and cpu-specific |
||||
set(IPP_MRGD "merged") # static libraries |
||||
set(IPPCORE "core") # core functionality |
||||
set(IPPSP "s") # signal processing |
||||
set(IPPIP "i") # image processing |
||||
set(IPPCC "cc") # color conversion |
||||
set(IPPCV "cv") # computer vision |
||||
set(IPPVM "vm") # vector math |
||||
|
||||
if (IPP_X64) |
||||
set(IPP_ARCH "em64t") |
||||
endif() |
||||
|
||||
if(WIN32) |
||||
set(IPP_SUFFIX "l") |
||||
endif() |
||||
|
||||
set(IPP_LIBRARIES |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPIP}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPIP}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPSP}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPSP}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_ARCH}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
PARENT_SCOPE) |
||||
|
||||
return() |
||||
|
||||
endfunction() |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This is auxiliary function called from set_ipp_variables() |
||||
# to set IPP_LIBRARIES variable in IPP 7.x style |
||||
# ------------------------------------------------------------------------ |
||||
function(set_ipp_new_libraries) |
||||
set(IPP_PREFIX "ipp") |
||||
set(IPP_SUFFIX "_l") # static not threaded libs suffix |
||||
set(IPP_THRD "_t") # static threaded libs suffix |
||||
set(IPPCORE "core") # core functionality |
||||
set(IPPSP "s") # signal processing |
||||
set(IPPIP "i") # image processing |
||||
set(IPPCC "cc") # color conversion |
||||
set(IPPCV "cv") # computer vision |
||||
set(IPPVM "vm") # vector math |
||||
|
||||
set(IPP_LIBRARIES |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPI}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPS}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
${LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${LIB_SUFFIX} |
||||
PARENT_SCOPE) |
||||
|
||||
return() |
||||
|
||||
endfunction() |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This function will set |
||||
# IPP_INCLUDE_DIRS, IPP_LIBRARY_DIRS and IPP_LIBRARIES variables depending |
||||
# on IPP version parameter. |
||||
# Since IPP 7.0 version library names and install folder structure |
||||
# was changed |
||||
# ------------------------------------------------------------------------ |
||||
function(set_ipp_variables _LATEST_VERSION) |
||||
if(${_LATEST_VERSION} VERSION_LESS "7.0") |
||||
# message(STATUS "old") |
||||
|
||||
# set INCLUDE and LIB folders |
||||
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE) |
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE) |
||||
|
||||
if (IPP_X64) |
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/../em64t) |
||||
message(SEND_ERROR "IPP EM64T libraries not found") |
||||
endif() |
||||
else() |
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/../ia32) |
||||
message(SEND_ERROR "IPP IA32 libraries not found") |
||||
endif() |
||||
endif() |
||||
|
||||
# set IPP_LIBRARIES variable (6.x lib names) |
||||
set_ipp_old_libraries() |
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) |
||||
message(STATUS "IPP libs: ${IPP_LIBRARIES}") |
||||
|
||||
else() |
||||
# message(STATUS "new") |
||||
|
||||
# set INCLUDE and LIB folders |
||||
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE) |
||||
|
||||
if (IPP_X64) |
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64) |
||||
message(SEND_ERROR "IPP EM64T libraries not found") |
||||
endif() |
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64 PARENT_SCOPE) |
||||
else() |
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32) |
||||
message(SEND_ERROR "IPP IA32 libraries not found") |
||||
endif() |
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32 PARENT_SCOPE) |
||||
endif() |
||||
|
||||
# set IPP_LIBRARIES variable (7.x lib names) |
||||
set_ipp_new_libraries() |
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) |
||||
message(STATUS "IPP libs: ${IPP_LIBRARIES}") |
||||
|
||||
endif() |
||||
|
||||
return() |
||||
|
||||
endfunction() |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This section will look for IPP through IPPROOT env variable |
||||
# Note, IPPROOT is not set by IPP installer, you may need to set it manually |
||||
# ------------------------------------------------------------------------ |
||||
find_path( |
||||
IPP_H_PATH |
||||
NAMES ippversion.h |
||||
PATHS $ENV{IPPROOT} |
||||
PATH_SUFFIXES include |
||||
DOC "The path to Intel(R) IPP header files" |
||||
NO_DEFAULT_PATH |
||||
NO_CMAKE_PATH) |
||||
|
||||
if(IPP_H_PATH) |
||||
|
||||
set(IPP_FOUND 1) |
||||
|
||||
# traverse up to IPPROOT level |
||||
get_filename_component(IPP_ROOT_DIR ${IPP_H_PATH} PATH) |
||||
|
||||
# extract IPP version info |
||||
get_ipp_version(${IPP_ROOT_DIR}) |
||||
|
||||
# keep info in the same vars for auto search and search by IPPROOT |
||||
set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR}) |
||||
set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR}) |
||||
set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR}) |
||||
set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD}) |
||||
|
||||
# set IPP INCLUDE, LIB dirs and library names |
||||
set_ipp_variables(${IPP_LATEST_VERSION_STR}) |
||||
|
||||
endif() |
||||
|
||||
|
||||
if(IPP_FOUND) |
||||
return() |
||||
endif() |
||||
|
||||
# reset var from previous search |
||||
set(IPP_H_PATH) |
||||
|
||||
|
||||
# ------------------------------------------------------------------------ |
||||
# This section will look for IPP through system program folders |
||||
# Note, if several IPP installations found the newest version will be |
||||
# selected |
||||
# ------------------------------------------------------------------------ |
||||
foreach(curdir ${CMAKE_SYSTEM_PREFIX_PATH}) |
||||
set(curdir ${curdir}/intel) |
||||
file(TO_CMAKE_PATH ${curdir} CURDIR) |
||||
|
||||
if(EXISTS ${curdir}) |
||||
file(GLOB_RECURSE IPP_H_DIR ${curdir}/ippversion.h) |
||||
|
||||
if(IPP_H_DIR) |
||||
set(IPP_FOUND 1) |
||||
endif() |
||||
|
||||
# init IPP_LATEST_VERSION version with oldest detectable version (5.3.0.0) |
||||
# IPP prior 5.3 did not have ippversion.h file |
||||
set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR}) |
||||
|
||||
# look through all dirs where ippversion.h was found |
||||
foreach(item ${IPP_H_DIR}) |
||||
|
||||
# traverse up to IPPROOT level |
||||
get_filename_component(_FILE_PATH ${item} PATH) |
||||
get_filename_component(_ROOT_DIR ${_FILE_PATH} PATH) |
||||
|
||||
# extract IPP version info |
||||
get_ipp_version(${_ROOT_DIR}) |
||||
|
||||
# remember the latest version (if many found) |
||||
if(${IPP_LATEST_VERSION_STR} VERSION_LESS ${IPP_VERSION_STR}) |
||||
set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR}) |
||||
set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR}) |
||||
set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR}) |
||||
set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD}) |
||||
set(IPP_ROOT_DIR ${_ROOT_DIR}) |
||||
endif() |
||||
endforeach() |
||||
endif() |
||||
endforeach() |
||||
|
||||
if(IPP_FOUND) |
||||
# set IPP INCLUDE, LIB dirs and library names |
||||
set_ipp_variables(${IPP_LATEST_VERSION_STR}) |
||||
|
||||
# set CACHE variable IPP_H_PATH, |
||||
# path to IPP header files for the latest version |
||||
find_path( |
||||
IPP_H_PATH |
||||
NAMES ippversion.h |
||||
PATHS ${IPP_ROOT_DIR} |
||||
PATH_SUFFIXES include |
||||
DOC "The path to Intel(R) IPP header files" |
||||
NO_DEFAULT_PATH |
||||
NO_CMAKE_PATH) |
||||
endif() |
@ -0,0 +1,118 @@ |
||||
# Search packages for host system instead of packages for target system |
||||
# in case of cross compilation thess macro should be defined by toolchain file |
||||
if(NOT COMMAND find_host_package) |
||||
macro(find_host_package) |
||||
find_package(${ARGN}) |
||||
endmacro() |
||||
endif() |
||||
if(NOT COMMAND find_host_program) |
||||
macro(find_host_program) |
||||
find_program(${ARGN}) |
||||
endmacro() |
||||
endif() |
||||
|
||||
|
||||
# Provides an option that the user can optionally select. |
||||
# Can accept condition to control when option is available for user. |
||||
# Usage: |
||||
# option(<option_variable> "help string describing option" <initial value> [IF <condition>]) |
||||
macro(OCV_OPTION variable description value) |
||||
SET(__condition ${ARGN}) |
||||
if("${__condition}" STREQUAL "") |
||||
SET(__condition 1) |
||||
endif() |
||||
list(REMOVE_ITEM __condition "IF" "if") |
||||
if(${__condition}) |
||||
OPTION(${variable} "${description}" ${value}) |
||||
else() |
||||
UNSET(${variable} CACHE) |
||||
endif() |
||||
UNSET(__condition) |
||||
endmacro() |
||||
|
||||
|
||||
# Macros that checks if module have been installed. |
||||
# After it adds module to build and define |
||||
# constants passed as second arg |
||||
macro(CHECK_MODULE module_name define) |
||||
set(${define} 0) |
||||
if(PKG_CONFIG_FOUND) |
||||
set(ALIAS ALIASOF_${module_name}) |
||||
set(ALIAS_FOUND ${ALIAS}_FOUND) |
||||
set(ALIAS_INCLUDE_DIRS ${ALIAS}_INCLUDE_DIRS) |
||||
set(ALIAS_LIBRARY_DIRS ${ALIAS}_LIBRARY_DIRS) |
||||
set(ALIAS_LIBRARIES ${ALIAS}_LIBRARIES) |
||||
|
||||
PKG_CHECK_MODULES(${ALIAS} ${module_name}) |
||||
|
||||
if (${ALIAS_FOUND}) |
||||
set(${define} 1) |
||||
foreach(P "${ALIAS_INCLUDE_DIRS}") |
||||
if (${P}) |
||||
list(APPEND HIGHGUI_INCLUDE_DIRS ${${P}}) |
||||
endif() |
||||
endforeach() |
||||
|
||||
foreach(P "${ALIAS_LIBRARY_DIRS}") |
||||
if (${P}) |
||||
list(APPEND HIGHGUI_LIBRARY_DIRS ${${P}}) |
||||
endif() |
||||
endforeach() |
||||
|
||||
list(APPEND HIGHGUI_LIBRARIES ${${ALIAS_LIBRARIES}}) |
||||
endif() |
||||
endif() |
||||
endmacro() |
||||
|
||||
# Status report macro. |
||||
# Automatically align right column and selects text based on condition. |
||||
# Usage: |
||||
# status(<text>) |
||||
# status(<heading> <value1> [<value2> ...]) |
||||
# status(<heading> <condition> THEN <text for TRUE> ELSE <text for FALSE> ) |
||||
macro(status text) |
||||
SET(status_cond) |
||||
SET(status_then) |
||||
SET(status_else) |
||||
|
||||
SET(status_current_name "cond") |
||||
foreach(arg ${ARGN}) |
||||
if(arg STREQUAL "THEN") |
||||
SET(status_current_name "then") |
||||
elseif(arg STREQUAL "ELSE") |
||||
SET(status_current_name "else") |
||||
else() |
||||
LIST(APPEND status_${status_current_name} ${arg}) |
||||
endif() |
||||
endforeach() |
||||
|
||||
if(DEFINED status_cond) |
||||
SET(status_placeholder_length 32) |
||||
string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder) |
||||
string(LENGTH "${text}" status_text_length) |
||||
if (status_text_length LESS status_placeholder_length) |
||||
string(SUBSTRING "${text}${status_placeholder}" 0 ${status_placeholder_length} status_text) |
||||
elseif (DEFINED status_then OR DEFINED status_else) |
||||
message(STATUS "${text}") |
||||
SET(status_text "${status_placeholder}") |
||||
else() |
||||
SET(status_text "${text}") |
||||
endif() |
||||
|
||||
if (DEFINED status_then OR DEFINED status_else) |
||||
if(${status_cond}) |
||||
string(REPLACE ";" " " status_then "${status_then}") |
||||
message(STATUS "${status_text}" "${status_then}") |
||||
else() |
||||
string(REPLACE ";" " " status_else "${status_else}") |
||||
message(STATUS "${status_text}" "${status_else}") |
||||
endif() |
||||
else() |
||||
string(REPLACE ";" " " status_cond "${status_cond}") |
||||
message(STATUS "${status_text}" "${status_cond}") |
||||
endif() |
||||
else() |
||||
message(STATUS "${text}") |
||||
endif() |
||||
endmacro() |
||||
|
@ -1,14 +1,14 @@ |
||||
set(OpenCV_VERSION @OPENCV_VERSION@) |
||||
set(PACKAGE_VERSION ${OpenCV_VERSION}) |
||||
|
||||
set(PACKAGE_VERSION_EXACT False) |
||||
set(PACKAGE_VERSION_COMPATIBLE False) |
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) |
||||
set(PACKAGE_VERSION_EXACT True) |
||||
set(PACKAGE_VERSION_COMPATIBLE True) |
||||
endif() |
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION) |
||||
set(PACKAGE_VERSION_COMPATIBLE True) |
||||
endif() |
||||
set(OpenCV_VERSION @OPENCV_VERSION@) |
||||
set(PACKAGE_VERSION ${OpenCV_VERSION}) |
||||
|
||||
set(PACKAGE_VERSION_EXACT False) |
||||
set(PACKAGE_VERSION_COMPATIBLE False) |
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) |
||||
set(PACKAGE_VERSION_EXACT True) |
||||
set(PACKAGE_VERSION_COMPATIBLE True) |
||||
endif() |
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION) |
||||
set(PACKAGE_VERSION_COMPATIBLE True) |
||||
endif() |
@ -1,198 +1,198 @@ |
||||
# =================================================================================== |
||||
# The OpenCV CMake configuration file |
||||
# |
||||
# ** File generated automatically, do not modify ** |
||||
# |
||||
# Usage from an external project: |
||||
# In your CMakeLists.txt, add these lines: |
||||
# |
||||
# FIND_PACKAGE(OpenCV REQUIRED ) |
||||
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS}) |
||||
# |
||||
# This file will define the following variables: |
||||
# - OpenCV_LIBS : The list of libraries to links against. |
||||
# - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES |
||||
# with this path is NOT needed. |
||||
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories. |
||||
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability |
||||
# - OpenCV_VERSION : The version of this OpenCV build. Example: "@OPENCV_VERSION@" |
||||
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MAJOR@" |
||||
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MINOR@" |
||||
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_PATCH@" |
||||
# |
||||
# Advanced variables: |
||||
# - OpenCV_SHARED |
||||
# - OpenCV_CONFIG_PATH |
||||
# - OpenCV_INSTALL_PATH |
||||
# - OpenCV_LIB_COMPONENTS |
||||
# - OpenCV_EXTRA_COMPONENTS |
||||
# - OpenCV_USE_MANGLED_PATHS |
||||
# - OpenCV_HAVE_ANDROID_CAMERA |
||||
# - OpenCV_SOURCE_PATH |
||||
# |
||||
# ================================================================================================= |
||||
|
||||
# ====================================================== |
||||
# Version Compute Capability from which library OpenCV |
||||
# has been compiled is remembered |
||||
# ====================================================== |
||||
SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@) |
||||
|
||||
# Some additional settings are required if OpenCV is built as static libs |
||||
set(OpenCV_SHARED @BUILD_SHARED_LIBS@) |
||||
|
||||
# Enables mangled install paths, that help with side by side installs |
||||
set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@) |
||||
|
||||
# Extract the directory where *this* file has been installed (determined at cmake run-time) |
||||
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) |
||||
|
||||
# Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings |
||||
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH) |
||||
|
||||
# Presence of Android native camera support |
||||
set (OpenCV_HAVE_ANDROID_CAMERA @WITH_ANDROID_CAMERA@) |
||||
|
||||
# ====================================================== |
||||
# Include directories to add to the user project: |
||||
# ====================================================== |
||||
|
||||
# Provide the include directories to the caller |
||||
SET(OpenCV_INCLUDE_DIRS @CMAKE_INCLUDE_DIRS_CONFIGCMAKE@) |
||||
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) |
||||
|
||||
# ====================================================== |
||||
# Link directories to add to the user project: |
||||
# ====================================================== |
||||
|
||||
# Provide the libs directory anyway, it may be needed in some cases. |
||||
SET(OpenCV_LIB_DIR @CMAKE_LIB_DIRS_CONFIGCMAKE@) |
||||
LINK_DIRECTORIES(${OpenCV_LIB_DIR}) |
||||
|
||||
# ==================================================================== |
||||
# Link libraries: e.g. libopencv_core.so, opencv_imgproc220d.lib, etc... |
||||
# ==================================================================== |
||||
|
||||
# OpenCV internal dependencies: |
||||
# opencv_androidcamera -> {} |
||||
# opencv_core -> {} |
||||
# opencv_flann -> {opencv_core} |
||||
# opencv_imgproc -> {opencv_core} |
||||
# opencv_ml -> {opencv_core} |
||||
# opencv_highgui -> {opencv_core, opencv_imgproc, opencv_androidcamera} |
||||
# opencv_video -> {opencv_core, opencv_imgproc} |
||||
# opencv_features2d -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui} |
||||
# opencv_calib3d -> {opencv_core, opencv_imgproc, opencv_flann, opencv_features2d} |
||||
# opencv_objdetect -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui, opencv_features2d, opencv_calib3d} |
||||
# opencv_gpu -> {opencv_core, opencv_imgproc, opencv_flann, opencv_features2d, opencv_calib3d, opencv_objdetect} |
||||
# opencv_stitching -> {opencv_core, opencv_imgproc, opencv_flann, opencv_features2d, opencv_calib3d, opencv_objdetect, opencv_gpu} |
||||
# opencv_legacy -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui, opencv_features2d, opencv_calib3d, opencv_video} |
||||
# opencv_contrib -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui, opencv_features2d, opencv_calib3d, opencv_objdetect, opencv_video, opencv_ml} |
||||
|
||||
SET(OpenCV_LIB_COMPONENTS opencv_contrib opencv_legacy opencv_stitching opencv_gpu opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core opencv_androidcamera) |
||||
|
||||
# remove modules unavailable on current platform: |
||||
if(ANDROID) |
||||
LIST(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_gpu) |
||||
SET(OpenCV_LIB_ANDROID @OpenCV_LIB_ANDROID@) |
||||
IF(OpenCV_LIB_ANDROID) |
||||
SET(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS} ${OpenCV_LIB_ANDROID}) |
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-shlib-undefined") |
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-shlib-undefined") |
||||
ENDIF() |
||||
endif() |
||||
if(NOT ANDROID OR OpenCV_SHARED OR NOT OpenCV_HAVE_ANDROID_CAMERA) |
||||
LIST(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_androidcamera) |
||||
endif() |
||||
|
||||
if(OpenCV_USE_MANGLED_PATHS) |
||||
#be explicit about the library names. |
||||
set(OpenCV_LIB_COMPONENTS_ ) |
||||
foreach( CVLib ${OpenCV_LIB_COMPONENTS}) |
||||
list(APPEND OpenCV_LIB_COMPONENTS_ ${OpenCV_LIB_DIR}/lib${CVLib}.so.@OPENCV_VERSION@ ) |
||||
endforeach() |
||||
set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) |
||||
endif() |
||||
|
||||
SET(OpenCV_LIBS "") |
||||
if(WIN32) |
||||
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) |
||||
# CMake>=2.6 supports the notation "debug XXd optimized XX" |
||||
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4) |
||||
# Modern CMake: |
||||
SET(OpenCV_LIBS ${OpenCV_LIBS} debug ${__CVLIB}@OPENCV_DLLVERSION@@OPENCV_DEBUG_POSTFIX@ optimized ${__CVLIB}@OPENCV_DLLVERSION@) |
||||
else() |
||||
# Old CMake: |
||||
SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}@OPENCV_DLLVERSION@) |
||||
endif() |
||||
endforeach() |
||||
else() |
||||
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) |
||||
SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}) |
||||
endforeach() |
||||
endif() |
||||
|
||||
# ============================================================== |
||||
# Extra include directories, needed by OpenCV 2 new structure |
||||
# ============================================================== |
||||
SET(OpenCV_SOURCE_PATH "@CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE@") |
||||
if(NOT "${OpenCV_SOURCE_PATH}" STREQUAL "") |
||||
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) |
||||
# We only need the "core",... part here: "opencv_core" -> "core" |
||||
STRING(REGEX REPLACE "opencv_(.*)" "\\1" __MODNAME ${__CVLIB}) |
||||
INCLUDE_DIRECTORIES("${OpenCV_SOURCE_PATH}/modules/${__MODNAME}/include") |
||||
LIST(APPEND OpenCV_INCLUDE_DIRS "${OpenCV_SOURCE_PATH}/modules/${__MODNAME}/include") |
||||
endforeach() |
||||
endif() |
||||
|
||||
# For OpenCV built as static libs, we need the user to link against |
||||
# many more dependencies: |
||||
IF (NOT OpenCV_SHARED) |
||||
# Under static libs, the user of OpenCV needs access to the 3rdparty libs as well: |
||||
LINK_DIRECTORIES(@CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE@) |
||||
|
||||
set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS}) |
||||
set(OpenCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@) |
||||
|
||||
if (WIN32 AND ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4) |
||||
# Modern CMake: |
||||
foreach(__EXTRA_LIB ${OpenCV_EXTRA_COMPONENTS}) |
||||
set(OpenCV_LIBS ${OpenCV_LIBS} |
||||
debug ${__EXTRA_LIB}@OPENCV_DEBUG_POSTFIX@ |
||||
optimized ${__EXTRA_LIB}) |
||||
endforeach() |
||||
else() |
||||
# Old CMake: |
||||
set(OpenCV_LIBS ${OpenCV_LIBS} ${OpenCV_EXTRA_COMPONENTS}) |
||||
endif() |
||||
|
||||
if (APPLE) |
||||
set(OpenCV_LIBS ${OpenCV_LIBS} "-lbz2" "-framework Cocoa" "-framework QuartzCore" "-framework QTKit") |
||||
endif() |
||||
ENDIF() |
||||
|
||||
# ====================================================== |
||||
# Android camera helper macro |
||||
# ====================================================== |
||||
IF (OpenCV_HAVE_ANDROID_CAMERA) |
||||
macro( COPY_NATIVE_CAMERA_LIBS target ) |
||||
get_target_property(target_location ${target} LOCATION) |
||||
get_filename_component(target_location "${target_location}" PATH) |
||||
file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so") |
||||
foreach(wrapper ${camera_wrappers}) |
||||
ADD_CUSTOM_COMMAND( |
||||
TARGET ${target} |
||||
POST_BUILD |
||||
COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}" |
||||
) |
||||
endforeach() |
||||
endmacro() |
||||
ENDIF() |
||||
|
||||
# ====================================================== |
||||
# Version variables: |
||||
# ====================================================== |
||||
SET(OpenCV_VERSION @OPENCV_VERSION@) |
||||
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@) |
||||
SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@) |
||||
SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@) |
||||
# =================================================================================== |
||||
# The OpenCV CMake configuration file |
||||
# |
||||
# ** File generated automatically, do not modify ** |
||||
# |
||||
# Usage from an external project: |
||||
# In your CMakeLists.txt, add these lines: |
||||
# |
||||
# FIND_PACKAGE(OpenCV REQUIRED ) |
||||
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS}) |
||||
# |
||||
# This file will define the following variables: |
||||
# - OpenCV_LIBS : The list of libraries to links against. |
||||
# - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES |
||||
# with this path is NOT needed. |
||||
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories. |
||||
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability |
||||
# - OpenCV_VERSION : The version of this OpenCV build. Example: "@OPENCV_VERSION@" |
||||
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MAJOR@" |
||||
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MINOR@" |
||||
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_PATCH@" |
||||
# |
||||
# Advanced variables: |
||||
# - OpenCV_SHARED |
||||
# - OpenCV_CONFIG_PATH |
||||
# - OpenCV_INSTALL_PATH |
||||
# - OpenCV_LIB_COMPONENTS |
||||
# - OpenCV_EXTRA_COMPONENTS |
||||
# - OpenCV_USE_MANGLED_PATHS |
||||
# - OpenCV_HAVE_ANDROID_CAMERA |
||||
# - OpenCV_SOURCE_PATH |
||||
# |
||||
# ================================================================================================= |
||||
|
||||
# ====================================================== |
||||
# Version Compute Capability from which library OpenCV |
||||
# has been compiled is remembered |
||||
# ====================================================== |
||||
SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@) |
||||
|
||||
# Some additional settings are required if OpenCV is built as static libs |
||||
set(OpenCV_SHARED @BUILD_SHARED_LIBS@) |
||||
|
||||
# Enables mangled install paths, that help with side by side installs |
||||
set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@) |
||||
|
||||
# Extract the directory where *this* file has been installed (determined at cmake run-time) |
||||
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) |
||||
|
||||
# Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings |
||||
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH) |
||||
|
||||
# Presence of Android native camera support |
||||
set (OpenCV_HAVE_ANDROID_CAMERA @WITH_ANDROID_CAMERA@) |
||||
|
||||
# ====================================================== |
||||
# Include directories to add to the user project: |
||||
# ====================================================== |
||||
|
||||
# Provide the include directories to the caller |
||||
SET(OpenCV_INCLUDE_DIRS @CMAKE_INCLUDE_DIRS_CONFIGCMAKE@) |
||||
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) |
||||
|
||||
# ====================================================== |
||||
# Link directories to add to the user project: |
||||
# ====================================================== |
||||
|
||||
# Provide the libs directory anyway, it may be needed in some cases. |
||||
SET(OpenCV_LIB_DIR @CMAKE_LIB_DIRS_CONFIGCMAKE@) |
||||
LINK_DIRECTORIES(${OpenCV_LIB_DIR}) |
||||
|
||||
# ==================================================================== |
||||
# Link libraries: e.g. libopencv_core.so, opencv_imgproc220d.lib, etc... |
||||
# ==================================================================== |
||||
|
||||
# OpenCV internal dependencies: |
||||
# opencv_androidcamera -> {} |
||||
# opencv_core -> {} |
||||
# opencv_flann -> {opencv_core} |
||||
# opencv_imgproc -> {opencv_core} |
||||
# opencv_ml -> {opencv_core} |
||||
# opencv_highgui -> {opencv_core, opencv_imgproc, opencv_androidcamera} |
||||
# opencv_video -> {opencv_core, opencv_imgproc} |
||||
# opencv_features2d -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui} |
||||
# opencv_calib3d -> {opencv_core, opencv_imgproc, opencv_flann, opencv_features2d} |
||||
# opencv_objdetect -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui, opencv_features2d, opencv_calib3d} |
||||
# opencv_gpu -> {opencv_core, opencv_imgproc, opencv_flann, opencv_features2d, opencv_calib3d, opencv_objdetect} |
||||
# opencv_stitching -> {opencv_core, opencv_imgproc, opencv_flann, opencv_features2d, opencv_calib3d, opencv_objdetect, opencv_gpu} |
||||
# opencv_legacy -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui, opencv_features2d, opencv_calib3d, opencv_video} |
||||
# opencv_contrib -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui, opencv_features2d, opencv_calib3d, opencv_objdetect, opencv_video, opencv_ml} |
||||
|
||||
SET(OpenCV_LIB_COMPONENTS opencv_contrib opencv_legacy opencv_stitching opencv_gpu opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core opencv_androidcamera) |
||||
|
||||
# remove modules unavailable on current platform: |
||||
if(ANDROID) |
||||
LIST(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_gpu) |
||||
SET(OpenCV_LIB_ANDROID @OpenCV_LIB_ANDROID@) |
||||
IF(OpenCV_LIB_ANDROID) |
||||
SET(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS} ${OpenCV_LIB_ANDROID}) |
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-shlib-undefined") |
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-shlib-undefined") |
||||
ENDIF() |
||||
endif() |
||||
if(NOT ANDROID OR OpenCV_SHARED OR NOT OpenCV_HAVE_ANDROID_CAMERA) |
||||
LIST(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_androidcamera) |
||||
endif() |
||||
|
||||
if(OpenCV_USE_MANGLED_PATHS) |
||||
#be explicit about the library names. |
||||
set(OpenCV_LIB_COMPONENTS_ ) |
||||
foreach( CVLib ${OpenCV_LIB_COMPONENTS}) |
||||
list(APPEND OpenCV_LIB_COMPONENTS_ ${OpenCV_LIB_DIR}/lib${CVLib}.so.@OPENCV_VERSION@ ) |
||||
endforeach() |
||||
set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) |
||||
endif() |
||||
|
||||
SET(OpenCV_LIBS "") |
||||
if(WIN32) |
||||
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) |
||||
# CMake>=2.6 supports the notation "debug XXd optimized XX" |
||||
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4) |
||||
# Modern CMake: |
||||
SET(OpenCV_LIBS ${OpenCV_LIBS} debug ${__CVLIB}@OPENCV_DLLVERSION@@OPENCV_DEBUG_POSTFIX@ optimized ${__CVLIB}@OPENCV_DLLVERSION@) |
||||
else() |
||||
# Old CMake: |
||||
SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}@OPENCV_DLLVERSION@) |
||||
endif() |
||||
endforeach() |
||||
else() |
||||
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) |
||||
SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}) |
||||
endforeach() |
||||
endif() |
||||
|
||||
# ============================================================== |
||||
# Extra include directories, needed by OpenCV 2 new structure |
||||
# ============================================================== |
||||
SET(OpenCV_SOURCE_PATH "@CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE@") |
||||
if(NOT "${OpenCV_SOURCE_PATH}" STREQUAL "") |
||||
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) |
||||
# We only need the "core",... part here: "opencv_core" -> "core" |
||||
STRING(REGEX REPLACE "opencv_(.*)" "\\1" __MODNAME ${__CVLIB}) |
||||
INCLUDE_DIRECTORIES("${OpenCV_SOURCE_PATH}/modules/${__MODNAME}/include") |
||||
LIST(APPEND OpenCV_INCLUDE_DIRS "${OpenCV_SOURCE_PATH}/modules/${__MODNAME}/include") |
||||
endforeach() |
||||
endif() |
||||
|
||||
# For OpenCV built as static libs, we need the user to link against |
||||
# many more dependencies: |
||||
IF (NOT OpenCV_SHARED) |
||||
# Under static libs, the user of OpenCV needs access to the 3rdparty libs as well: |
||||
LINK_DIRECTORIES(@CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE@) |
||||
|
||||
set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS}) |
||||
set(OpenCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@) |
||||
|
||||
if (WIN32 AND ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4) |
||||
# Modern CMake: |
||||
foreach(__EXTRA_LIB ${OpenCV_EXTRA_COMPONENTS}) |
||||
set(OpenCV_LIBS ${OpenCV_LIBS} |
||||
debug ${__EXTRA_LIB}@OPENCV_DEBUG_POSTFIX@ |
||||
optimized ${__EXTRA_LIB}) |
||||
endforeach() |
||||
else() |
||||
# Old CMake: |
||||
set(OpenCV_LIBS ${OpenCV_LIBS} ${OpenCV_EXTRA_COMPONENTS}) |
||||
endif() |
||||
|
||||
if (APPLE) |
||||
set(OpenCV_LIBS ${OpenCV_LIBS} "-lbz2" "-framework Cocoa" "-framework QuartzCore" "-framework QTKit") |
||||
endif() |
||||
ENDIF() |
||||
|
||||
# ====================================================== |
||||
# Android camera helper macro |
||||
# ====================================================== |
||||
IF (OpenCV_HAVE_ANDROID_CAMERA) |
||||
macro( COPY_NATIVE_CAMERA_LIBS target ) |
||||
get_target_property(target_location ${target} LOCATION) |
||||
get_filename_component(target_location "${target_location}" PATH) |
||||
file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so") |
||||
foreach(wrapper ${camera_wrappers}) |
||||
ADD_CUSTOM_COMMAND( |
||||
TARGET ${target} |
||||
POST_BUILD |
||||
COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}" |
||||
) |
||||
endforeach() |
||||
endmacro() |
||||
ENDIF() |
||||
|
||||
# ====================================================== |
||||
# Version variables: |
||||
# ====================================================== |
||||
SET(OpenCV_VERSION @OPENCV_VERSION@) |
||||
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@) |
||||
SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@) |
||||
SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@) |
Loading…
Reference in new issue