Started top-level CMakeLists.txt file reorganization: cmake scripts are moved to separate folder; refactored BUILD_*, INSTALL_*, ENABLE_*, USE_*, WITH_* options.

This commit is contained in:
Andrey Kamaev 2012-01-03 13:48:12 +00:00
parent 60eecd4529
commit 8cab65c173
22 changed files with 1069 additions and 1229 deletions

View File

@ -11,6 +11,15 @@
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
# --------------------------------------------------------------
# Indicate CMake 2.7 and above that we don't want to mix relative
# and absolute paths in linker lib lists.
# Run "cmake --help-policy CMP0003" for more information.
# --------------------------------------------------------------
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif()
# Following block can broke build in case of cross-compilng # Following block can broke build in case of cross-compilng
# but CMAKE_CROSSCOMPILING variable will be set only on project(OpenCV) command # but CMAKE_CROSSCOMPILING variable will be set only on project(OpenCV) command
# so we will try to detect crosscompiling by presense of CMAKE_TOOLCHAIN_FILE # so we will try to detect crosscompiling by presense of CMAKE_TOOLCHAIN_FILE
@ -63,29 +72,162 @@ if(CMAKE_VERBOSE)
set(CMAKE_VERBOSE_MAKEFILE 1) set(CMAKE_VERBOSE_MAKEFILE 1)
endif() endif()
# -------------------------------------------------------------- include(cmake/OpenCVUtils.cmake REQUIRED)
# Indicate CMake 2.7 and above that we don't want to mix relative
# and absolute paths in linker lib lists. # ----------------------------------------------------------------------------
# Run "cmake --help-policy CMP0003" for more information. # Detect Microsoft compiler:
# -------------------------------------------------------------- # ----------------------------------------------------------------------------
if(COMMAND cmake_policy) if(CMAKE_CL_64)
cmake_policy(SET CMP0003 NEW) set(MSVC64 1)
endif() endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Build static or dynamic libs? # Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):
# Default: dynamic libraries # see include/opencv/cxtypes.h file for related ICC & CV_ICC defines.
# NOTE: The system needs to determine if the '-fPIC' option needs to be added
# for the 3rdparty static libs being compiled. The CMakeLists.txt files
# in 3rdparty use the CV_ICC definition being set here to determine if
# the -fPIC flag should be used.
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(NOT IOS) if(UNIX)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)") if (__ICL)
else() set(CV_ICC __ICL)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)") elseif(__ICC)
set(CV_ICC __ICC)
elseif(__ECL)
set(CV_ICC __ECL)
elseif(__ECC)
set(CV_ICC __ECC)
elseif(__INTEL_COMPILER)
set(CV_ICC __INTEL_COMPILER)
elseif(CMAKE_C_COMPILER MATCHES "icc")
set(CV_ICC icc_matches_c_compiler)
endif()
endif() endif()
if(MSVC AND CMAKE_C_COMPILER MATCHES "icc")
set(CV_ICC __INTEL_COMPILER_FOR_WINDOWS)
endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Include debug info into debug libs? # Detect GNU version:
# Default: yes
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
set(BUILD_WITH_DEBUG_INFO ON CACHE BOOL "Include debug info into debug libs") if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v
ERROR_VARIABLE CMAKE_OPENCV_GCC_INFO_FULL
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Typical output in CMAKE_OPENCV_GCC_VERSION_FULL: "c+//0 (whatever) 4.2.3 (...)"
# Look for the version number
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
# Split the three parts:
string(REGEX MATCHALL "[0-9]+" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}")
list(GET CMAKE_OPENCV_GCC_VERSIONS 0 CMAKE_OPENCV_GCC_VERSION_MAJOR)
list(GET CMAKE_OPENCV_GCC_VERSIONS 1 CMAKE_OPENCV_GCC_VERSION_MINOR)
set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR})
math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}")
message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})")
if(WIN32)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
set(MINGW64 1)
endif()
endif()
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES amd64.*|x86_64.*)
set(X86_64 1)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES i686.*|i386.*|x86.*)
set(X86 1)
endif()
# Optional 3rd party components
# ===================================================
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (UNIX AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_ANDROID_CAMERA "Build with native Android camera support" ON IF (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7) )
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS)
OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE )
OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON)
OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (UNIX AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (MSVC OR X86 OR X86_64) )
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JPEG "Include JPEG support" ON IF (NOT IOS) )
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) )
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_PNG "Include PNG support" ON IF (NOT IOS) )
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (UNIX AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF IF APPLE )
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS) )
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_VIDEOINPUT "Build HighGUI with DirectShow support" ON IF WIN32 )
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF WIN32 )
OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
# OpenCV build components
# ===================================================
if(ANDROID OR IOS)
OCV_OPTION(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF )
else()
OCV_OPTION(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" ON )
endif()
OCV_OPTION(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" ON IF ANDROID )
OCV_OPTION(BUILD_DOCS "Create build rules for OpenCV Documentation" ON )
OCV_OPTION(BUILD_JAVA_SUPPORT "Build with Java support" ON IF (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7) )
OCV_OPTION(BUILD_EXAMPLES "Build all examples" OFF )
OCV_OPTION(BUILD_NEW_PYTHON_SUPPORT "Build with Python support" ON IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" ON )
OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT IOS) )
OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT IOS) )
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs" ON )
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
if(WIN32 OR ANDROID)
set(OPENCV_BUILD_3RDPARTY_LIBS TRUE CACHE INTERNAL "Build 3rd party libraries")
else()
# Build 3rdparty libraries under unix
set(OPENCV_BUILD_3RDPARTY_LIBS FALSE CACHE BOOL "Build 3rd party libraries")
endif()
# OpenCV installation options
# ===================================================
OCV_OPTION(INSTALL_C_EXAMPLES "Install C examples" OFF )
OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )
OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT IOS) )
# OpenCV build options
# ===================================================
OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) )
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
OCV_OPTION(ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSE "Enable SSE instructions" ON IF (MSVC OR CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSE2 "Enable SSE2 instructions" ON IF (MSVC OR CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSE3 "Enable SSE3 instructions" OFF IF (CV_ICC OR CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSSE3 "Enable SSSE3 instructions" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSE41 "Enable SSE4.1 instructions" OFF IF (CV_ICC OR CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSE42 "Enable SSE4.2 instructions" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Get actual OpenCV version number from sources # Get actual OpenCV version number from sources
@ -100,7 +242,7 @@ set(OPENCV_VERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VER
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}") set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
# create a dependency on version file # create a dependency on version file
# we will never use output of the following command but cmake will rerun if version file changes # we never use output of the following command but cmake will rerun if version file changes
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY) configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY)
if(WIN32) if(WIN32)
@ -115,8 +257,8 @@ endif()
#name mangling #name mangling
set(OPENCV_INCLUDE_PREFIX include) set(OPENCV_INCLUDE_PREFIX include)
if(UNIX AND NOT ANDROID AND BUILD_SHARED_LIBS) if(INSTALL_TO_MANGLED_PATHS AND BUILD_SHARED_LIBS)
option(OPENCV_MANGLED_INSTALL_PATHS "Enables mangled install paths, that help with side by side installs." False) SET(OPENCV_MANGLED_INSTALL_PATHS ${INSTALL_TO_MANGLED_PATHS} )
if(OPENCV_MANGLED_INSTALL_PATHS) if(OPENCV_MANGLED_INSTALL_PATHS)
set(OPENCV_INCLUDE_PREFIX include/opencv-${OPENCV_VERSION}) set(OPENCV_INCLUDE_PREFIX include/opencv-${OPENCV_VERSION})
endif() endif()
@ -144,29 +286,12 @@ endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}") set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# 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()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Use statically or dynamically linked CRT? # Use statically or dynamically linked CRT?
# Default: dynamic # Default: dynamic
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(WIN32 AND NOT BUILD_SHARED_LIBS)
option (BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT" ON)
endif()
if(MSVC) if(MSVC)
if(BUILD_WITH_STATIC_CRT) if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)
foreach(flag_var foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
@ -183,7 +308,7 @@ if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmtd.lib") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmtd.lib")
else(BUILD_WITH_STATIC_CRT) else()
foreach(flag_var foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
@ -196,7 +321,7 @@ if(MSVC)
string(REGEX REPLACE "/MTd" "/MDd" ${flag_var} "${${flag_var}}") string(REGEX REPLACE "/MTd" "/MDd" ${flag_var} "${${flag_var}}")
endif() endif()
endforeach(flag_var) endforeach(flag_var)
endif(BUILD_WITH_STATIC_CRT) endif()
if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8 AND NOT ${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 8.6) if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8 AND NOT ${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 8.6)
include(ProcessorCount) include(ProcessorCount)
@ -261,256 +386,25 @@ else()
set(OPENCV_SVNVERSION "") set(OPENCV_SVNVERSION "")
endif() endif()
# ----------------------------------------------------------------------------
# Detect Microsoft compiler:
# ----------------------------------------------------------------------------
if(CMAKE_CL_64)
set(MSVC64 1)
endif()
# ----------------------------------------------------------------------------
# Detect GNU version:
# ----------------------------------------------------------------------------
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v
ERROR_VARIABLE CMAKE_OPENCV_GCC_INFO_FULL
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Typical output in CMAKE_OPENCV_GCC_VERSION_FULL: "c+//0 (whatever) 4.2.3 (...)"
# Look for the version number
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
# Split the three parts:
string(REGEX MATCHALL "[0-9]+" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}")
list(GET CMAKE_OPENCV_GCC_VERSIONS 0 CMAKE_OPENCV_GCC_VERSION_MAJOR)
list(GET CMAKE_OPENCV_GCC_VERSIONS 1 CMAKE_OPENCV_GCC_VERSION_MINOR)
set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR})
math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}")
message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})")
if(WIN32)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
set(MINGW64 1)
endif()
endif()
endif()
# ----------------------------------------------------------------------------
# Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):
# see include/opencv/cxtypes.h file for related ICC & CV_ICC defines.
# NOTE: The system needs to determine if the '-fPIC' option needs to be added
# for the 3rdparty static libs being compiled. The CMakeLists.txt files
# in 3rdparty use the CV_ICC definition being set here to determine if
# the -fPIC flag should be used.
# ----------------------------------------------------------------------------
if(UNIX)
if (__ICL)
set(CV_ICC __ICL)
elseif(__ICC)
set(CV_ICC __ICC)
elseif(__ECL)
set(CV_ICC __ECL)
elseif(__ECC)
set(CV_ICC __ECC)
elseif(__INTEL_COMPILER)
set(CV_ICC __INTEL_COMPILER)
elseif(CMAKE_C_COMPILER MATCHES "icc")
set(CV_ICC icc_matches_c_compiler)
endif()
endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC.. # CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Build/install (or not) some apps: include(cmake/OpenCVPCHSupport.cmake REQUIRED)
# =================================================== include(cmake/OpenCVModule.cmake REQUIRED)
set(BUILD_EXAMPLES OFF CACHE BOOL "Build all examples")
set(INSTALL_C_EXAMPLES OFF CACHE BOOL "Install C examples")
set(INSTALL_PYTHON_EXAMPLES OFF CACHE BOOL "Install Python examples")
if(ANDROID) if(ANDROID)
set(INSTALL_ANDROID_EXAMPLES OFF CACHE BOOL "Install Android examples") include(cmake/OpenCVAndroidProject.cmake REQUIRED)
endif()
# Build tests:
# ===================================================
if(NOT IOS)
set(BUILD_TESTS ON CACHE BOOL "Build tests")
else()
set(BUILD_TESTS OFF CACHE BOOL "Build tests")
endif()
set(BUILD_PERF_TESTS ON CACHE BOOL "Build performance tests")
# Build 3rdparty libraries under unix
# ===================================================
if(WIN32)
set(OPENCV_BUILD_3RDPARTY_LIBS TRUE CACHE INTERNAL "Build 3rd party libraries")
else()
set(OPENCV_BUILD_3RDPARTY_LIBS FALSE CACHE BOOL "Build 3rd party libraries")
endif()
if(NOT IOS)
include(OpenCVPCHSupport.cmake REQUIRED)
endif()
include(OpenCVModule.cmake REQUIRED)
if(ANDROID)
include(OpenCVAndroidProject.cmake REQUIRED)
endif()
if(PCHSupport_FOUND)
SET(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Use precompiled headers")
else()
SET(USE_PRECOMPILED_HEADERS OFF CACHE BOOL "Use precompiled headers" FORCE)
endif() endif()
if(UNIX) if(UNIX)
include(OpenCVFindPkgConfig.cmake OPTIONAL) include(cmake/OpenCVFindPkgConfig.cmake OPTIONAL)
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckIncludeFile) include(CheckIncludeFile)
endif() endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(ENABLE_PROFILING OFF CACHE BOOL "Enable profiling in the GCC compiler (Add flags: -g -pg)")
set(USE_OMIT_FRAME_POINTER ON CACHE BOOL "Enable -fomit-frame-pointer for GCC")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64.*|x86_64.*)
set(X86_64 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686.*|i386.*|x86.*)
set(X86 1)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES powerpc.*)
set(ENABLE_POWERPC ON CACHE BOOL "Enable PowerPC for GCC")
endif ()
if(X86 OR X86_64)
# enable everything, since the available set of instructions is checked at runtime
#IF ("${CMAKE_GCC_REGEX_VERSION}" VERSION_GREATER 4.5)
SET(_USE_FAST_MATH OFF)
#ELSE()
# SET(_USE_FAST_MATH ON)
#ENDIF()
set(USE_FAST_MATH ${_USE_FAST_MATH} CACHE BOOL "Enable -ffast-math (not recommended for GCC 4.6.x)")
set(ENABLE_SSE ON CACHE BOOL "Enable SSE instructions")
set(ENABLE_SSE2 ON CACHE BOOL "Enable SSE2 instructions")
set(ENABLE_SSE3 OFF CACHE BOOL "Enable SSE3 instructions")
set(ENABLE_SSSE3 OFF CACHE BOOL "Enable SSSE3 instructions")
set(ENABLE_SSE41 OFF CACHE BOOL "Enable SSE4.1 instructions")
set(ENABLE_SSE42 OFF CACHE BOOL "Enable SSE4.2 instructions")
endif()
endif()
if(MSVC)
set(ENABLE_SSE ON CACHE BOOL "Enable SSE instructions for MSVC")
set(ENABLE_SSE2 ON CACHE BOOL "Enable SSE2 instructions for MSVC")
if(CMAKE_C_COMPILER MATCHES "icc")
set(ENABLE_SSE3 OFF CACHE BOOL "Enable SSE3 instructions for ICC")
set(ENABLE_SSE4_1 OFF CACHE BOOL "Enable SSE4.1 instructions for ICC")
endif()
endif()
# allow fine grained control over which libraries not to link, even if
# they are available on the system
# ====================================================================
if(NOT IOS)
set(WITH_PNG ON CACHE BOOL "Include PNG support")
set(WITH_JPEG ON CACHE BOOL "Include JPEG support")
set(WITH_JASPER ON CACHE BOOL "Include JPEG2K support")
set(WITH_TIFF ON CACHE BOOL "Include TIFF support")
set(WITH_OPENEXR ON CACHE BOOL "Include ILM support via OpenEXR")
if(UNIX)
set(WITH_FFMPEG ON CACHE BOOL "Include FFMPEG support")
if(NOT APPLE)
set(WITH_UNICAP OFF CACHE BOOL "Include Unicap support (GPL)")
set(WITH_GTK ON CACHE BOOL "Include GTK support")
set(WITH_GSTREAMER ON CACHE BOOL "Include Gstreamer support")
set(WITH_V4L ON CACHE BOOL "Include Video 4 Linux support")
set(WITH_XINE OFF CACHE BOOL "Include Xine support (GPL)")
endif()
set(WITH_PVAPI ON CACHE BOOL "Include Prosilica GigE support")
set(WITH_1394 ON CACHE BOOL "Include IEEE1394 support")
endif()
endif()
if(APPLE)
set(WITH_CARBON OFF CACHE BOOL "Use Carbon for UI instead of Cocoa")
set(WITH_QUICKTIME OFF CACHE BOOL "Use QuickTime for Video I/O insted of QTKit")
endif()
if(IOS)
set(WITH_AVFOUNDATION ON CACHE BOOL "Use AVFoundation for Video I/O")
endif()
set(WITH_TBB OFF CACHE BOOL "Include Intel TBB support")
set(WITH_THREADING_FRAMEWORK OFF CACHE BOOL "Include Threading Framework support (lightweight analogue of TBB for ARM-s)")
set(WITH_IPP OFF CACHE BOOL "Include Intel IPP support")
set(WITH_EIGEN ON CACHE BOOL "Include Eigen2/Eigen3 support")
if( CMAKE_VERSION VERSION_GREATER "2.8")
set(WITH_CUDA ON CACHE BOOL "Include NVidia Cuda Runtime support")
set(WITH_CUFFT ON CACHE BOOL "Include NVidia Cuda Fast Fourier Transform (FFT) library support")
set(WITH_CUBLAS OFF CACHE BOOL "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support")
else()
set(WITH_CUDA OFF CACHE BOOL "Include NVidia Cuda Runtime support")
set(WITH_CUFFT OFF CACHE BOOL "Include NVidia Cuda Fast Fourier Transform (FFT) library support")
set(WITH_CUBLAS OFF CACHE BOOL "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support")
endif()
set(WITH_OPENNI OFF CACHE BOOL "Include OpenNI support")
set(WITH_XIMEA OFF CACHE BOOL "Include XIMEA cameras support")
set(WITH_OPENGL OFF CACHE BOOL "Include OpenGL support")
set(HAVE_OPENGL 0) set(HAVE_OPENGL 0)
# ===================================================
# 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()
if(UNIX) if(UNIX)
if(NOT APPLE) if(NOT APPLE)
if(WITH_GTK) if(WITH_GTK)
@ -681,25 +575,11 @@ endif()
#message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}") #message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}")
if(WITH_OPENEXR) if(WITH_OPENEXR)
include(OpenCVFindOpenEXR.cmake) include(cmake/OpenCVFindOpenEXR.cmake)
endif() endif()
set(BUILD_DOCS ON CACHE BOOL "Build OpenCV Documentation")
if(BUILD_DOCS) if(BUILD_DOCS)
include(OpenCVFindLATEX.cmake REQUIRED) include(cmake/OpenCVFindLATEX.cmake REQUIRED)
endif()
set(BUILD_NEW_PYTHON_SUPPORT ON CACHE BOOL "Build with Python support")
if (WIN32)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(BUILD_NEW_PYTHON_SUPPORT OFF)
endif()
endif()
if(ANDROID)
set(BUILD_NEW_PYTHON_SUPPORT OFF)
endif() endif()
# Always try to find python # Always try to find python
@ -768,11 +648,7 @@ endif()
# Java support # Java support
# =================================================== # ===================================================
if (PYTHON_EXECUTABLE AND ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7) if (BUILD_JAVA_SUPPORT AND PYTHON_EXECUTABLE)
option(BUILD_JAVA_SUPPORT "Build with Java support" TRUE)
endif()
if (BUILD_JAVA_SUPPORT)
file(TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH) file(TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH)
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
@ -792,9 +668,7 @@ if (BUILD_JAVA_SUPPORT)
) )
if(ANDROID_EXECUTABLE) if(ANDROID_EXECUTABLE)
message(STATUS " Found android tool: ${ANDROID_EXECUTABLE}") message(STATUS " Found android tool: ${ANDROID_EXECUTABLE}")
get_filename_component(ANDROID_SDK_TOOLS_PATH "${ANDROID_EXECUTABLE}" PATH) get_filename_component(ANDROID_SDK_TOOLS_PATH "${ANDROID_EXECUTABLE}" PATH)
#read source.properties #read source.properties
if (EXISTS "${ANDROID_SDK_TOOLS_PATH}/source.properties") if (EXISTS "${ANDROID_SDK_TOOLS_PATH}/source.properties")
file(STRINGS "${ANDROID_SDK_TOOLS_PATH}/source.properties" ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES REGEX "^[ ]*[^#].*$") file(STRINGS "${ANDROID_SDK_TOOLS_PATH}/source.properties" ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES REGEX "^[ ]*[^#].*$")
@ -887,15 +761,13 @@ if (BUILD_JAVA_SUPPORT)
endif() endif()
endif() endif()
if(CAN_BUILD_ANDROID_PROJECTS) if(NOT CAN_BUILD_ANDROID_PROJECTS)
SET(BUILD_ANDROID_EXAMPLES TRUE CACHE BOOL "Build examples for Android platform") UNSET(BUILD_ANDROID_EXAMPLES CACHE)
endif() endif()
#YV #YV
############################### QT ################################ ############################### QT ################################
set(WITH_QT OFF CACHE BOOL "Build with Qt Backend support")
set(HAVE_QT 0) set(HAVE_QT 0)
set(HAVE_QT_OPENGL 0) set(HAVE_QT_OPENGL 0)
@ -983,25 +855,11 @@ if (WITH_TBB)
endif() endif()
endif(WITH_TBB) endif(WITH_TBB)
#Threading Framework -- temporary decision for ARM-s instead of TBB
set(HAVE_THREADING_FRAMEWORK)
if (NOT HAVE_TBB AND WITH_THREADING_FRAMEWORK)
file(GLOB THREADING_FRAMEWORK_HEADER "${OpenCV_SOURCE_DIR}/modules/core/include/opencv2/core/threading_framework.hpp")
file(GLOB THREADING_FRAMEWORK_SOURCE "${OpenCV_SOURCE_DIR}/modules/core/src/threading_framework.cpp")
if(THREADING_FRAMEWORK_HEADER AND THREADING_FRAMEWORK_SOURCE)
set(HAVE_THREADING_FRAMEWORK 1)
endif()
if (TEGRA_DIR)
set(HAVE_THREADING_FRAMEWORK 1)
endif()
endif()
############################ Intel IPP ############################# ############################ Intel IPP #############################
set(IPP_FOUND) set(IPP_FOUND)
if(WITH_IPP) if(WITH_IPP)
include(OpenCVFindIPP.cmake) include(cmake/OpenCVFindIPP.cmake)
endif() endif()
if(IPP_FOUND) if(IPP_FOUND)
@ -1092,14 +950,14 @@ set(HAVE_OPENNI FALSE)
set(HAVE_OPENNI_PRIME_SENSOR_MODULE FALSE) set(HAVE_OPENNI_PRIME_SENSOR_MODULE FALSE)
if(WITH_OPENNI) if(WITH_OPENNI)
include(OpenCVFindOpenNI.cmake) include(cmake/OpenCVFindOpenNI.cmake)
endif() endif()
############################### XIMEA ################################ ############################### XIMEA ################################
set(HAVE_XIMEA FALSE) set(HAVE_XIMEA FALSE)
if(WITH_XIMEA) if(WITH_XIMEA)
include(OpenCVFindXimea.cmake) include(cmake/OpenCVFindXimea.cmake)
endif() endif()
if(XIMEA_FOUND) if(XIMEA_FOUND)
@ -1123,7 +981,6 @@ endif()
################## Extra HighGUI libs on Windows ################### ################## Extra HighGUI libs on Windows ###################
if(WIN32) if(WIN32)
set(WITH_VIDEOINPUT ON CACHE BOOL "Build HighGUI with DirectShow support")
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} comctl32 gdi32 ole32) set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} comctl32 gdi32 ole32)
if(WITH_VIDEOINPUT) if(WITH_VIDEOINPUT)
@ -1155,8 +1012,6 @@ endif()
############## Android source tree for native camera ############### ############## Android source tree for native camera ###############
if(ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7) if(ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)
option(WITH_ANDROID_CAMERA "Build with native Android camera support" TRUE)
SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH
"Path to Android source tree. "Path to Android source tree.
Set this variable to path to your Android sources to compile Set this variable to path to your Android sources to compile
@ -1190,7 +1045,7 @@ add_definitions(-DHAVE_CVCONFIG_H)
set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h") set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
message(STATUS "Parsing 'cvconfig.h.cmake'") message(STATUS "Parsing 'cvconfig.h.cmake'")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# The C+//0 include & link directories: # The C+//0 include & link directories:
@ -1261,10 +1116,12 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
# Other optimizations # Other optimizations
if(USE_OMIT_FRAME_POINTER) if(ENABLE_OMIT_FRAME_POINTER)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer") set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer")
else()
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fno-omit-frame-pointer")
endif() endif()
if(USE_FAST_MATH) if(ENABLE_FAST_MATH)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math") set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math")
endif() endif()
if(ENABLE_POWERPC) if(ENABLE_POWERPC)
@ -1374,7 +1231,7 @@ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${EXTRA_EX
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${EXTRA_EXE_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${EXTRA_EXE_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}")
# In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release: # In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release:
if (${CMAKE_GENERATOR} MATCHES ".*Makefiles" AND "${CMAKE_BUILD_TYPE}" STREQUAL "") if (CMAKE_GENERATOR MATCHES ".*Makefiles" AND "${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
endif() endif()
@ -1418,9 +1275,9 @@ set(CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}") set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}")
set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY)
#support for version checking when finding opencv. find_package(OpenCV 2.3.1 EXACT) should now work. #support for version checking when finding opencv. find_package(OpenCV 2.3.1 EXACT) should now work.
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig-version.cmake" IMMEDIATE @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig-version.cmake" IMMEDIATE @ONLY)
# -------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install" # Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
# ------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------
@ -1438,8 +1295,8 @@ else()
endif() endif()
endif() endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake" IMMEDIATE @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake" IMMEDIATE @ONLY)
if(UNIX) if(UNIX)
#http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference #http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference
@ -1471,7 +1328,7 @@ if(WIN32)
set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL) exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
# Install the OpenCVConfig.cmake file which has the right paths pointing to the install directory # Install the OpenCVConfig.cmake file which has the right paths pointing to the install directory
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/") install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/")
@ -1509,7 +1366,7 @@ if(ANDROID)
set(CMAKE_BASE_INCLUDE_DIR_CONFIGCMAKE "\"${CMAKE_CURRENT_SOURCE_DIR}\"") set(CMAKE_BASE_INCLUDE_DIR_CONFIGCMAKE "\"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)") set(CMAKE_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" IMMEDIATE @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" IMMEDIATE @ONLY)
endif(ANDROID) endif(ANDROID)
# ------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------
@ -1520,7 +1377,7 @@ if(ANDROID)
set(CMAKE_BASE_INCLUDE_DIR_CONFIGCMAKE "") set(CMAKE_BASE_INCLUDE_DIR_CONFIGCMAKE "")
set(CMAKE_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../..") set(CMAKE_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../..")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" IMMEDIATE @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" IMMEDIATE @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION share/OpenCV/) install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION share/OpenCV/)
endif(ANDROID) endif(ANDROID)
@ -1554,9 +1411,9 @@ if(OPENCV_MANGLED_INSTALL_PATHS)
endforeach() endforeach()
set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_})
set(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc") set(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencv-XXX.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}" @ONLY IMMEDIATE) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv-XXX.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}" @ONLY IMMEDIATE)
else() else()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}" @ONLY IMMEDIATE) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}" @ONLY IMMEDIATE)
endif() endif()
if(UNIX AND NOT ANDROID) if(UNIX AND NOT ANDROID)
@ -1567,7 +1424,7 @@ endif()
# Uninstall target, for "make uninstall" # Uninstall target, for "make uninstall"
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
CONFIGURE_FILE( CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY) IMMEDIATE @ONLY)
@ -1576,8 +1433,6 @@ ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/c
#----------------------------------- #-----------------------------------
# Source package: # Source package:
#----------------------------------- #-----------------------------------
set(BUILD_PACKAGE ON CACHE BOOL "Enables 'make package_source' command")
if(BUILD_PACKAGE) if(BUILD_PACKAGE)
set(TARBALL_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}") set(TARBALL_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
if (NOT WIN32) if (NOT WIN32)
@ -1602,11 +1457,6 @@ endif()
#----------------------------------- #-----------------------------------
# Solution folders: # Solution folders:
#----------------------------------- #-----------------------------------
if(${CMAKE_VERSION} VERSION_GREATER "2.8.0")
set(ENABLE_SOLUTION_FOLDERS OFF CACHE BOOL "Solution folder in Visual Studio or in other IDEs")
endif()
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets") set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
@ -1647,57 +1497,11 @@ endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Summary: # Summary:
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
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()
status("") status("")
status("General configuration for opencv ${OPENCV_VERSION} =====================================") status("General configuration for opencv ${OPENCV_VERSION} =====================================")
status("") status("")
status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO) status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
status(" Compiler:" CMAKE_COMPILER THEN "${CMAKE_COMPILER}" ELSE "${CMAKE_CXX_COMPILER}") status(" C++ Compiler:" CMAKE_COMPILER THEN "${CMAKE_COMPILER}" ELSE "${CMAKE_CXX_COMPILER}")
status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}) status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}) status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
if(WIN32) if(WIN32)
@ -1719,8 +1523,8 @@ if(ANDROID)
elseif(BUILD_WITH_STANDALONE_TOOLCHAIN) elseif(BUILD_WITH_STANDALONE_TOOLCHAIN)
status(" Android toolchain:" "${ANDROID_STANDALONE_TOOLCHAIN}") status(" Android toolchain:" "${ANDROID_STANDALONE_TOOLCHAIN}")
endif() endif()
status(" android tool:" ANDROID_EXECUTABLE THEN "${ANDROID_EXECUTABLE} (${ANDROID_TOOLS_Pkg_Desc})" ELSE NO) status(" android tool:" ANDROID_EXECUTABLE THEN "${ANDROID_EXECUTABLE} (${ANDROID_TOOLS_Pkg_Desc})" ELSE NO)
status(" ant:" ANT_EXECUTABLE THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})" ELSE NO) status(" ant:" ANT_EXECUTABLE THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})" ELSE NO)
endif() endif()
#YV #YV
@ -1741,8 +1545,8 @@ else()
status(" Cocoa:" YES) status(" Cocoa:" YES)
endif() endif()
else() else()
status(" GTK+ 2.x:" HAVE_GTK THEN YES ELSE NO) status(" GTK+ 2.x:" HAVE_GTK THEN YES ELSE NO)
status(" GThread :" HAVE_GTHREAD THEN YES ELSE NO) status(" GThread :" HAVE_GTHREAD THEN YES ELSE NO)
status(" GtkGlExt:" HAVE_GTKGLEXT THEN YES ELSE NO) status(" GtkGlExt:" HAVE_GTKGLEXT THEN YES ELSE NO)
endif() endif()
endif() endif()
@ -1753,7 +1557,7 @@ status(" OpenGL support:" HAVE_OPENGL THEN YES ELSE NO)
# media # media
status("") status("")
status(" Media I/O: ") status(" Media I/O: ")
status(" ZLib:" ZLIB_FOUND THEN ${ZLIB_FOUND} ELSE build) status(" ZLib:" ZLIB_FOUND THEN ${ZLIB_FOUND} ELSE build)
status(" JPEG:" NOT WITH_JPEG OR JPEG_FOUND THEN ${JPEG_FOUND} ELSE build) status(" JPEG:" NOT WITH_JPEG OR JPEG_FOUND THEN ${JPEG_FOUND} ELSE build)
status(" PNG:" NOT WITH_PNG OR PNG_FOUND THEN ${PNG_FOUND} ELSE build) status(" PNG:" NOT WITH_PNG OR PNG_FOUND THEN ${PNG_FOUND} ELSE build)
status(" TIFF:" NOT WITH_TIFF OR TIFF_FOUND THEN ${TIFF_FOUND} ELSE build) status(" TIFF:" NOT WITH_TIFF OR TIFF_FOUND THEN ${TIFF_FOUND} ELSE build)
@ -1763,7 +1567,9 @@ status(" OpenEXR:" WITH_OPENEXR AND OPENEXR_FOUND THEN YES
status(" OpenNI:" HAVE_OPENNI THEN YES ELSE NO) status(" OpenNI:" HAVE_OPENNI THEN YES ELSE NO)
status(" OpenNI PrimeSensor Modules:" status(" OpenNI PrimeSensor Modules:"
HAVE_OPENNI_PRIME_SENSOR_MODULE THEN YES ELSE NO) HAVE_OPENNI_PRIME_SENSOR_MODULE THEN YES ELSE NO)
status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO) if(WIN32)
status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO)
endif()
# video # video
status("") status("")
@ -1780,7 +1586,7 @@ if(UNIX AND NOT APPLE)
status(" GStreamer:" HAVE_GSTREAMER THEN YES ELSE NO) status(" GStreamer:" HAVE_GSTREAMER THEN YES ELSE NO)
status(" UniCap:" HAVE_UNICAP THEN YES ELSE NO) status(" UniCap:" HAVE_UNICAP THEN YES ELSE NO)
status(" PvAPI:" HAVE_PVAPI THEN YES ELSE NO) status(" PvAPI:" HAVE_PVAPI THEN YES ELSE NO)
status(" V4L/V4L2:" HAVE_LIBV4L THEN Using libv4l ELSE ${HAVE_CAMV4L}/${HAVE_CAMV4L2}) status(" V4L/V4L2:" HAVE_LIBV4L THEN "Using libv4l" ELSE ${HAVE_CAMV4L}/${HAVE_CAMV4L2})
status(" Xine:" HAVE_XINE THEN YES ELSE NO) status(" Xine:" HAVE_XINE THEN YES ELSE NO)
if(ANDROID) if(ANDROID)
@ -1792,7 +1598,7 @@ if(UNIX AND NOT APPLE)
endif() endif()
elseif(APPLE) elseif(APPLE)
if(NOT IOS) if(NOT IOS)
status(" Video I/O:" WITH_QUICKTIME THEN QuickTime ELSE QTKit) status(" Video I/O:" WITH_QUICKTIME THEN QuickTime ELSE QTKit)
else() else()
status(" Video I/O: AVFoundation") status(" Video I/O: AVFoundation")
endif() endif()
@ -1808,15 +1614,10 @@ if(WITH_IPP AND IPP_FOUND)
status(" Use IPP:" "${IPP_LATEST_VERSION_STR} [${IPP_LATEST_VERSION_MAJOR}.${IPP_LATEST_VERSION_MINOR}.${IPP_LATEST_VERSION_BUILD}]") status(" Use IPP:" "${IPP_LATEST_VERSION_STR} [${IPP_LATEST_VERSION_MAJOR}.${IPP_LATEST_VERSION_MINOR}.${IPP_LATEST_VERSION_BUILD}]")
status(" at:" "${IPP_ROOT_DIR}") status(" at:" "${IPP_ROOT_DIR}")
else() else()
status(" Use IPP:" WITH_IPP AND NOT IPP_FOUND THEN IPP not found ELSE NO) status(" Use IPP:" WITH_IPP AND NOT IPP_FOUND THEN "IPP not found" ELSE NO)
endif()
status(" Use TBB:" HAVE_TBB THEN YES ELSE NO)
if(UNIX)
status(" Use ThreadingFramework:" HAVE_THREADING_FRAMEWORK THEN YES ELSE NO)
endif() endif()
status(" Use TBB:" HAVE_TBB THEN YES ELSE NO)
status(" Use Cuda:" HAVE_CUDA THEN YES ELSE NO) status(" Use Cuda:" HAVE_CUDA THEN YES ELSE NO)
status(" Use Eigen:" HAVE_EIGEN THEN YES ELSE NO) status(" Use Eigen:" HAVE_EIGEN THEN YES ELSE NO)
@ -1825,12 +1626,10 @@ status(" Python interpreter:" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTAB
# interfaces to other languages # interfaces to other languages
status("") status("")
status(" Interfaces:") status(" Interfaces:")
status(" Python:" BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE NO) status(" Python:" BUILD_NEW_PYTHON_SUPPORT AND PYTHON_EXECUTABLE THEN YES ELSE NO)
status(" Python numpy:" PYTHON_USE_NUMPY AND BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE "NO (Python wrappers will not be generated)") status(" Python numpy:" PYTHON_USE_NUMPY AND BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE "NO (Python wrappers will not be generated)")
if(ANDROID AND ANDROID_NATIVE_API_LEVEL LESS 8) if(ANDROID)
status(" Java:" "NO (Java API requires Android API level 8 or higher)") status(" Java:" BUILD_JAVA_SUPPORT AND PYTHON_EXECUTABLE THEN YES ELSE NO)
else()
status(" Java:" BUILD_JAVA_SUPPORT THEN YES ELSE NO)
endif() endif()
# documentation # documentation
@ -1838,8 +1637,8 @@ status("")
status(" Documentation:") status(" Documentation:")
status(" Sphinx:" HAVE_SPHINX THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO) status(" Sphinx:" HAVE_SPHINX THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO)
status(" PdfLaTeX compiler:" PDFLATEX_COMPILER THEN "${PDFLATEX_COMPILER}" ELSE NO) status(" PdfLaTeX compiler:" PDFLATEX_COMPILER THEN "${PDFLATEX_COMPILER}" ELSE NO)
if (BUILD_DOCS AND HAVE_SPHINX) if(BUILD_DOCS AND HAVE_SPHINX)
status(" Build Documentation:" PDFLATEX_COMPILER THEN YES ELSE "YES (only HTML without math formulas)") status(" Build Documentation:" PDFLATEX_COMPILER THEN YES ELSE "YES (only HTML without math expressions)")
else() else()
status(" Build Documentation:" NO) status(" Build Documentation:" NO)
endif() endif()
@ -1852,11 +1651,11 @@ status(" Performance tests:" BUILD_PERF_TESTS THEN YES ELSE NO)
status(" Examples:" BUILD_EXAMPLES THEN YES ELSE NO) status(" Examples:" BUILD_EXAMPLES THEN YES ELSE NO)
if(ANDROID) if(ANDROID)
status(" Android tests:" BUILD_TESTS AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO) status(" Android tests:" BUILD_TESTS AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO)
status(" Android examples:" BUILD_ANDROID_EXAMPLES THEN YES ELSE NO) status(" Android examples:" BUILD_ANDROID_EXAMPLES THEN YES ELSE NO)
endif() endif()
# auxiliary #auxiliary
status("") status("")
status(" Install path:" "${CMAKE_INSTALL_PREFIX}") status(" Install path:" "${CMAKE_INSTALL_PREFIX}")
status("") status("")

View File

@ -4,75 +4,9 @@
# cmake -C # cmake -C
######################## ########################
#Build shared libraries (.dll/.so CACHE BOOL "" ) instead of static ones (.lib/.a CACHE BOOL "" )
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" )
#Build 3rd party libraries
set(OPENCV_BUILD_3RDPARTY_LIBS ON CACHE BOOL "" )
#Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel. #Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel.
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" ) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" )
#Include IEEE1394 support
set(WITH_1394 OFF CACHE BOOL "" )
#Include NVidia Cuda Runtime support
set(WITH_CUDA OFF CACHE BOOL "" )
#Include Eigen2/Eigen3 support
set(WITH_EIGEN2 OFF CACHE BOOL "" )
#Include FFMPEG support
set(WITH_FFMPEG OFF CACHE BOOL "" )
#Include Gstreamer support
set(WITH_GSTREAMER OFF CACHE BOOL "" )
#Include GTK support
set(WITH_GTK OFF CACHE BOOL "" )
#Include Intel IPP support
set(WITH_IPP OFF CACHE BOOL "" )
#Include JPEG2K support
set(WITH_JASPER ON CACHE BOOL "" )
#Include JPEG support
set(WITH_JPEG ON CACHE BOOL "" )
#Include ILM support via OpenEXR
set(WITH_OPENEXR OFF CACHE BOOL "" )
#Include OpenNI support
set(WITH_OPENNI OFF CACHE BOOL "" )
#Include PNG support
set(WITH_PNG ON CACHE BOOL "" )
#Include Prosilica GigE support
set(WITH_PVAPI OFF CACHE BOOL "" )
#Build with Qt Backend support
set(WITH_QT OFF CACHE BOOL "" )
#Add OpenGL support
set(WITH_OPENGL OFF CACHE BOOL "" )
#Include Intel TBB support
set(WITH_TBB OFF CACHE BOOL "" )
#Include TIFF support
set(WITH_TIFF ON CACHE BOOL "" )
#Include Unicap support (GPL CACHE BOOL "" )
set(WITH_UNICAP OFF CACHE BOOL "" )
#Include Video 4 Linux support
set(WITH_V4L OFF CACHE BOOL "" )
#Include Xine support (GPL CACHE BOOL "" )
set(WITH_XINE OFF CACHE BOOL "" )
#no python available on Android #no python available on Android
set(BUILD_NEW_PYTHON_SUPPORT OFF CACHE INTERNAL "" FORCE) set(BUILD_NEW_PYTHON_SUPPORT OFF CACHE INTERNAL "" FORCE)

View File

@ -1,143 +1,143 @@
# creates target "${_target}_android_project" for building standard Android project # creates target "${_target}_android_project" for building standard Android project
macro(add_android_project _target _path) 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) 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) if(NOT BUILD_SHARED_LIBS)
LIST(APPEND android_dependencies opencv_androidcamera) LIST(APPEND android_dependencies opencv_androidcamera)
endif() endif()
if (ANDROID AND CAN_BUILD_ANDROID_PROJECTS) if (ANDROID AND CAN_BUILD_ANDROID_PROJECTS)
file(GLOB_RECURSE res_files_all RELATIVE "${_path}" "${_path}/res/*") 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 jni_files_all RELATIVE "${_path}" "${_path}/jni/*.c*" "${_path}/jni/*.h*")
file(GLOB_RECURSE src_files_all RELATIVE "${_path}" "${_path}/src/*.java") file(GLOB_RECURSE src_files_all RELATIVE "${_path}" "${_path}/src/*.java")
#remove .svn #remove .svn
set(res_files) set(res_files)
foreach(f ${res_files_all}) foreach(f ${res_files_all})
if(NOT f MATCHES "\\.svn") if(NOT f MATCHES "\\.svn")
list(APPEND res_files "${f}") list(APPEND res_files "${f}")
endif() endif()
endforeach() endforeach()
set(jni_files) set(jni_files)
foreach(f ${jni_files_all}) foreach(f ${jni_files_all})
if(NOT f MATCHES "\\.svn") if(NOT f MATCHES "\\.svn")
list(APPEND jni_files "${f}") list(APPEND jni_files "${f}")
endif() endif()
endforeach() endforeach()
set(src_files) set(src_files)
foreach(f ${src_files_all}) foreach(f ${src_files_all})
if(NOT f MATCHES "\\.svn") if(NOT f MATCHES "\\.svn")
list(APPEND src_files "${f}") list(APPEND src_files "${f}")
endif() endif()
endforeach() endforeach()
# get temporary location for the project # get temporary location for the project
file(RELATIVE_PATH build_path "${OpenCV_SOURCE_DIR}" "${_path}") file(RELATIVE_PATH build_path "${OpenCV_SOURCE_DIR}" "${_path}")
SET(build_path "${CMAKE_BINARY_DIR}/${build_path}") SET(build_path "${CMAKE_BINARY_DIR}/${build_path}")
# copy project to temporary location # copy project to temporary location
SET(${_target}_project_files) SET(${_target}_project_files)
foreach(f ${res_files} ${src_files} "AndroidManifest.xml") foreach(f ${res_files} ${src_files} "AndroidManifest.xml")
if(NOT "${build_path}" STREQUAL "${_path}") if(NOT "${build_path}" STREQUAL "${_path}")
#this is not needed in case of in-source build #this is not needed in case of in-source build
add_custom_command( add_custom_command(
OUTPUT "${build_path}/${f}" OUTPUT "${build_path}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${_path}/${f}" "${build_path}/${f}" COMMAND ${CMAKE_COMMAND} -E copy "${_path}/${f}" "${build_path}/${f}"
DEPENDS "${_path}/${f}" DEPENDS "${_path}/${f}"
COMMENT "" COMMENT ""
) )
endif() endif()
list(APPEND ${_target}_project_files "${build_path}/${f}") list(APPEND ${_target}_project_files "${build_path}/${f}")
endforeach() endforeach()
# process default.properties # process default.properties
file(STRINGS "${_path}/default.properties" default_properties REGEX "^android\\.library\\.reference\\.1=.+$") file(STRINGS "${_path}/default.properties" default_properties REGEX "^android\\.library\\.reference\\.1=.+$")
if (default_properties) if (default_properties)
# has opencv dependency # has opencv dependency
file(RELATIVE_PATH OPENCV_REFERENCE_PATH "${build_path}" "${CMAKE_BINARY_DIR}") file(RELATIVE_PATH OPENCV_REFERENCE_PATH "${build_path}" "${CMAKE_BINARY_DIR}")
add_custom_command( add_custom_command(
OUTPUT "${build_path}/default.properties" OUTPUT "${build_path}/default.properties"
OUTPUT "${build_path}/build.xml" OUTPUT "${build_path}/build.xml"
OUTPUT "${build_path}/local.properties" OUTPUT "${build_path}/local.properties"
OUTPUT "${build_path}/proguard.cfg" OUTPUT "${build_path}/proguard.cfg"
COMMAND ${CMAKE_COMMAND} -E echo "" > "default.properties" COMMAND ${CMAKE_COMMAND} -E echo "" > "default.properties"
COMMAND ${ANDROID_EXECUTABLE} update project --name "${_target}" --target "${ANDROID_SDK_TARGET}" --library "${OPENCV_REFERENCE_PATH}" --path . COMMAND ${ANDROID_EXECUTABLE} update project --name "${_target}" --target "${ANDROID_SDK_TARGET}" --library "${OPENCV_REFERENCE_PATH}" --path .
WORKING_DIRECTORY ${build_path} WORKING_DIRECTORY ${build_path}
DEPENDS ${${_target}_project_files} DEPENDS ${${_target}_project_files}
DEPENDS "${CMAKE_BINARY_DIR}/default.properties" DEPENDS "${CMAKE_BINARY_DIR}/default.properties"
DEPENDS "${CMAKE_BINARY_DIR}/AndroidManifest.xml" DEPENDS "${CMAKE_BINARY_DIR}/AndroidManifest.xml"
COMMENT "Updating android project - ${_target}" COMMENT "Updating android project - ${_target}"
) )
else() else()
# has no opencv dependency # has no opencv dependency
add_custom_command( add_custom_command(
OUTPUT "${build_path}/default.properties" OUTPUT "${build_path}/default.properties"
OUTPUT "${build_path}/build.xml" OUTPUT "${build_path}/build.xml"
OUTPUT "${build_path}/local.properties" OUTPUT "${build_path}/local.properties"
OUTPUT "${build_path}/proguard.cfg" OUTPUT "${build_path}/proguard.cfg"
COMMAND ${CMAKE_COMMAND} -E echo "" > "default.properties" COMMAND ${CMAKE_COMMAND} -E echo "" > "default.properties"
COMMAND ${ANDROID_EXECUTABLE} update project --name "${_target}" --target "${ANDROID_SDK_TARGET}" --path . COMMAND ${ANDROID_EXECUTABLE} update project --name "${_target}" --target "${ANDROID_SDK_TARGET}" --path .
WORKING_DIRECTORY ${build_path} WORKING_DIRECTORY ${build_path}
DEPENDS ${${_target}_project_files} DEPENDS ${${_target}_project_files}
COMMENT "Updating android project - ${_target}" COMMENT "Updating android project - ${_target}"
) )
endif() endif()
if("${build_path}" STREQUAL "${_path}") if("${build_path}" STREQUAL "${_path}")
#in case of in-source build default.properties file is not generated (it is just overwritten :) #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) SET_SOURCE_FILES_PROPERTIES("${build_path}/default.properties" PROPERTIES GENERATED FALSE)
endif() endif()
list(APPEND ${_target}_project_files "${build_path}/default.properties" "${build_path}/build.xml" "${build_path}/local.properties" "${build_path}/proguard.cfg") 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 # build native part of android project
if(jni_files) if(jni_files)
INCLUDE_DIRECTORIES("${_path}/jni") INCLUDE_DIRECTORIES("${_path}/jni")
FILE(STRINGS "${_path}/jni/Android.mk" JNI_LIB_NAME REGEX "LOCAL_MODULE[ ]*:=[ ]*.*" ) 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}") string(REGEX REPLACE "LOCAL_MODULE[ ]*:=[ ]*([a-zA-Z_][a-zA-Z_0-9]*)[ ]*" "\\1" JNI_LIB_NAME "${JNI_LIB_NAME}")
SET(jni_sources) SET(jni_sources)
foreach(src ${jni_files}) foreach(src ${jni_files})
list(APPEND jni_sources "${_path}/${src}") list(APPEND jni_sources "${_path}/${src}")
endforeach() endforeach()
ADD_LIBRARY(${JNI_LIB_NAME} MODULE ${jni_sources}) ADD_LIBRARY(${JNI_LIB_NAME} MODULE ${jni_sources})
TARGET_LINK_LIBRARIES(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_dependencies}) TARGET_LINK_LIBRARIES(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_dependencies})
set_target_properties(${JNI_LIB_NAME} PROPERTIES set_target_properties(${JNI_LIB_NAME} PROPERTIES
OUTPUT_NAME "${JNI_LIB_NAME}" OUTPUT_NAME "${JNI_LIB_NAME}"
LIBRARY_OUTPUT_DIRECTORY "${build_path}/libs/${ANDROID_NDK_ABI_NAME}" LIBRARY_OUTPUT_DIRECTORY "${build_path}/libs/${ANDROID_NDK_ABI_NAME}"
) )
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
TARGET ${JNI_LIB_NAME} TARGET ${JNI_LIB_NAME}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_STRIP} "${build_path}/libs/${ANDROID_NDK_ABI_NAME}/*.so" COMMAND ${CMAKE_STRIP} "${build_path}/libs/${ANDROID_NDK_ABI_NAME}/*.so"
) )
else() else()
SET(JNI_LIB_NAME) SET(JNI_LIB_NAME)
endif() endif()
add_custom_command( add_custom_command(
OUTPUT "${build_path}/bin/${_target}-debug.apk" OUTPUT "${build_path}/bin/${_target}-debug.apk"
OUTPUT "${CMAKE_BINARY_DIR}/bin/${_target}.apk" OUTPUT "${CMAKE_BINARY_DIR}/bin/${_target}.apk"
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
COMMAND ${CMAKE_COMMAND} -E copy "${build_path}/bin/${_target}-debug.apk" "${CMAKE_BINARY_DIR}/bin/${_target}.apk" COMMAND ${CMAKE_COMMAND} -E copy "${build_path}/bin/${_target}-debug.apk" "${CMAKE_BINARY_DIR}/bin/${_target}.apk"
WORKING_DIRECTORY ${build_path} WORKING_DIRECTORY ${build_path}
DEPENDS ${${_target}_project_files} DEPENDS ${${_target}_project_files}
DEPENDS "${LIBRARY_OUTPUT_PATH}/libopencv_java.so" DEPENDS "${LIBRARY_OUTPUT_PATH}/libopencv_java.so"
COMMENT "Generating bin/${_target}.apk" COMMENT "Generating bin/${_target}.apk"
) )
ADD_CUSTOM_TARGET(${_target}_android_project ALL ADD_CUSTOM_TARGET(${_target}_android_project ALL
DEPENDS "${build_path}/bin/${_target}-debug.apk" DEPENDS "${build_path}/bin/${_target}-debug.apk"
DEPENDS "${CMAKE_BINARY_DIR}/bin/${_target}.apk" DEPENDS "${CMAKE_BINARY_DIR}/bin/${_target}.apk"
) )
add_dependencies(${_target}_android_project opencv_java ${JNI_LIB_NAME}) add_dependencies(${_target}_android_project opencv_java ${JNI_LIB_NAME})
if("${ARGN}" STREQUAL "INSTALL" AND INSTALL_ANDROID_EXAMPLES) if("${ARGN}" STREQUAL "INSTALL" AND INSTALL_ANDROID_EXAMPLES)
install(FILES "${CMAKE_BINARY_DIR}/bin/${_target}.apk" DESTINATION "bin" COMPONENT main) install(FILES "${CMAKE_BINARY_DIR}/bin/${_target}.apk" DESTINATION "bin" COMPONENT main)
endif() endif()
endif() endif()
endmacro() endmacro()

View File

@ -1,320 +1,322 @@
# #
# The script to detect Intel(R) Integrated Performance Primitives (IPP) # The script to detect Intel(R) Integrated Performance Primitives (IPP)
# installation/package # installation/package
# #
# This will try to find Intel IPP libraries, and include path by automatic # This will try to find Intel IPP libraries, and include path by automatic
# search through typical install locations and if failed it will # search through typical install locations and if failed it will
# examine IPPROOT environment variable. # examine IPPROOT environment variable.
# Note, IPPROOT is not set by IPP installer, it should be set manually. # Note, IPPROOT is not set by IPP installer, it should be set manually.
# #
# On return this will define: # On return this will define:
# #
# IPP_FOUND - True if Intel IPP found # IPP_FOUND - True if Intel IPP found
# IPP_ROOT_DIR - root of IPP installation # IPP_ROOT_DIR - root of IPP installation
# IPP_INCLUDE_DIRS - IPP include folder # IPP_INCLUDE_DIRS - IPP include folder
# IPP_LIBRARY_DIRS - IPP libraries folder # IPP_LIBRARY_DIRS - IPP libraries folder
# IPP_LIBRARIES - IPP libraries names that are used by OpenCV # IPP_LIBRARIES - IPP libraries names that are used by OpenCV
# IPP_LATEST_VERSION_STR - string with the newest detected IPP version # 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_MAJOR - numbers of IPP version (MAJOR.MINOR.BUILD)
# IPP_LATEST_VERSION_MINOR # IPP_LATEST_VERSION_MINOR
# IPP_LATEST_VERSION_BUILD # IPP_LATEST_VERSION_BUILD
# #
# Created: 30 Dec 2010 by Vladimir Dudnik (vladimir.dudnik@intel.com) # Created: 30 Dec 2010 by Vladimir Dudnik (vladimir.dudnik@intel.com)
# #
set(IPP_FOUND) set(IPP_FOUND)
set(IPP_VERSION_STR "5.3.0.0") # will not detect earlier versions set(IPP_VERSION_STR "5.3.0.0") # will not detect earlier versions
set(IPP_VERSION_MAJOR 0) set(IPP_VERSION_MAJOR 0)
set(IPP_VERSION_MINOR 0) set(IPP_VERSION_MINOR 0)
set(IPP_VERSION_BUILD 0) set(IPP_VERSION_BUILD 0)
set(IPP_ROOT_DIR) set(IPP_ROOT_DIR)
set(IPP_INCLUDE_DIRS) set(IPP_INCLUDE_DIRS)
set(IPP_LIBRARY_DIRS) set(IPP_LIBRARY_DIRS)
set(IPP_LIBRARIES) set(IPP_LIBRARIES)
set(LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX}) set(LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) set(LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(IPP_PREFIX "ipp") set(IPP_PREFIX "ipp")
set(IPP_SUFFIX "_l") set(IPP_SUFFIX "_l")
set(IPPCORE "core") # core functionality set(IPPCORE "core") # core functionality
set(IPPS "s") # signal processing set(IPPS "s") # signal processing
set(IPPI "i") # image processing set(IPPI "i") # image processing
set(IPPCC "cc") # color conversion set(IPPCC "cc") # color conversion
set(IPPCV "cv") # computer vision set(IPPCV "cv") # computer vision
set(IPPVM "vm") # vector math set(IPPVM "vm") # vector math
set(IPP_X64 0) set(IPP_X64 0)
if (CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) if (CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
set(IPP_X64 1) set(IPP_X64 1)
endif() endif()
if (CMAKE_CL_64) if (CMAKE_CL_64)
set(IPP_X64 1) set(IPP_X64 1)
endif() endif()
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# This function detect IPP version by analyzing ippversion.h file # This function detect IPP version by analyzing ippversion.h file
# Note, ippversion.h file was inroduced since IPP 5.3 # Note, ippversion.h file was inroduced since IPP 5.3
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
function(get_ipp_version _ROOT_DIR) function(get_ipp_version _ROOT_DIR)
set(_VERSION_STR) set(_VERSION_STR)
set(_MAJOR) set(_MAJOR)
set(_MINOR) set(_MINOR)
set(_BUILD) set(_BUILD)
# read IPP version info from file # 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 STR1 REGEX "IPP_VERSION_MAJOR")
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR2 REGEX "IPP_VERSION_MINOR") 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 STR3 REGEX "IPP_VERSION_BUILD")
file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR4 REGEX "IPP_VERSION_STR") file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR4 REGEX "IPP_VERSION_STR")
# extract info and assign to variables # extract info and assign to variables
string(REGEX MATCHALL "[0-9]+" _MAJOR ${STR1}) string(REGEX MATCHALL "[0-9]+" _MAJOR ${STR1})
string(REGEX MATCHALL "[0-9]+" _MINOR ${STR2}) string(REGEX MATCHALL "[0-9]+" _MINOR ${STR2})
string(REGEX MATCHALL "[0-9]+" _BUILD ${STR3}) string(REGEX MATCHALL "[0-9]+" _BUILD ${STR3})
string(REGEX MATCHALL "[0-9]+[.]+[0-9]+[^\"]+|[0-9]+[.]+[0-9]+" _VERSION_STR ${STR4}) string(REGEX MATCHALL "[0-9]+[.]+[0-9]+[^\"]+|[0-9]+[.]+[0-9]+" _VERSION_STR ${STR4})
# export info to parent scope # export info to parent scope
set(IPP_VERSION_STR ${_VERSION_STR} PARENT_SCOPE) set(IPP_VERSION_STR ${_VERSION_STR} PARENT_SCOPE)
set(IPP_VERSION_MAJOR ${_MAJOR} PARENT_SCOPE) set(IPP_VERSION_MAJOR ${_MAJOR} PARENT_SCOPE)
set(IPP_VERSION_MINOR ${_MINOR} PARENT_SCOPE) set(IPP_VERSION_MINOR ${_MINOR} PARENT_SCOPE)
set(IPP_VERSION_BUILD ${_BUILD} PARENT_SCOPE) set(IPP_VERSION_BUILD ${_BUILD} PARENT_SCOPE)
message(STATUS "found IPP: ${_MAJOR}.${_MINOR}.${_BUILD} [${_VERSION_STR}]") message(STATUS "found IPP: ${_MAJOR}.${_MINOR}.${_BUILD} [${_VERSION_STR}]")
message(STATUS "at: ${_ROOT_DIR}") message(STATUS "at: ${_ROOT_DIR}")
return() return()
endfunction() endfunction()
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# This is auxiliary function called from set_ipp_variables() # 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) # to set IPP_LIBRARIES variable in IPP 6.x style (IPP 5.3 should also work)
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
function(set_ipp_old_libraries) function(set_ipp_old_libraries)
set(IPP_PREFIX "ipp") set(IPP_PREFIX "ipp")
set(IPP_SUFFIX) # old style static core libs suffix set(IPP_SUFFIX) # old style static core libs suffix
set(IPP_ARCH) # architecture suffix set(IPP_ARCH) # architecture suffix
set(IPP_DISP "emerged") # old style dipatcher and cpu-specific set(IPP_DISP "emerged") # old style dipatcher and cpu-specific
set(IPP_MRGD "merged") # static libraries set(IPP_MRGD "merged") # static libraries
set(IPPCORE "core") # core functionality set(IPPCORE "core") # core functionality
set(IPPSP "s") # signal processing set(IPPSP "s") # signal processing
set(IPPIP "i") # image processing set(IPPIP "i") # image processing
set(IPPCC "cc") # color conversion set(IPPCC "cc") # color conversion
set(IPPCV "cv") # computer vision set(IPPCV "cv") # computer vision
set(IPPVM "vm") # vector math set(IPPVM "vm") # vector math
if (IPP_X64) if (IPP_X64)
set(IPP_ARCH "em64t") set(IPP_ARCH "em64t")
endif() endif()
if(WIN32) if(WIN32)
set(IPP_SUFFIX "l") set(IPP_SUFFIX "l")
endif() endif()
set(IPP_LIBRARIES set(IPP_LIBRARIES
${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_MRGD}${IPP_ARCH}${LIB_SUFFIX} ${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}${IPPVM}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX}
${LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_MRGD}${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}${IPPCC}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX}
${LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_MRGD}${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}${IPPCV}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX}
${LIB_PREFIX}${IPP_PREFIX}${IPPIP}${IPP_MRGD}${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}${IPPIP}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX}
${LIB_PREFIX}${IPP_PREFIX}${IPPSP}${IPP_MRGD}${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}${IPPSP}${IPP_DISP}${IPP_ARCH}${LIB_SUFFIX}
${LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_ARCH}${IPP_SUFFIX}${LIB_SUFFIX} ${LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_ARCH}${IPP_SUFFIX}${LIB_SUFFIX}
PARENT_SCOPE) PARENT_SCOPE)
return() return()
endfunction() endfunction()
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# This is auxiliary function called from set_ipp_variables() # This is auxiliary function called from set_ipp_variables()
# to set IPP_LIBRARIES variable in IPP 7.x style # to set IPP_LIBRARIES variable in IPP 7.x style
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
function(set_ipp_new_libraries) function(set_ipp_new_libraries)
set(IPP_PREFIX "ipp") set(IPP_PREFIX "ipp")
set(IPP_SUFFIX "_l") # static not threaded libs suffix set(IPP_SUFFIX "_l") # static not threaded libs suffix
set(IPP_THRD "_t") # static threaded libs suffix set(IPP_THRD "_t") # static threaded libs suffix
set(IPPCORE "core") # core functionality set(IPPCORE "core") # core functionality
set(IPPSP "s") # signal processing set(IPPSP "s") # signal processing
set(IPPIP "i") # image processing set(IPPIP "i") # image processing
set(IPPCC "cc") # color conversion set(IPPCC "cc") # color conversion
set(IPPCV "cv") # computer vision set(IPPCV "cv") # computer vision
set(IPPVM "vm") # vector math set(IPPVM "vm") # vector math
set(IPP_LIBRARIES set(IPP_LIBRARIES
${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_SUFFIX}${LIB_SUFFIX} ${LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_SUFFIX}${LIB_SUFFIX}
${LIB_PREFIX}${IPP_PREFIX}${IPPCC}${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}${IPPCV}${IPP_SUFFIX}${LIB_SUFFIX}
${LIB_PREFIX}${IPP_PREFIX}${IPPI}${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}${IPPS}${IPP_SUFFIX}${LIB_SUFFIX}
${LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${LIB_SUFFIX} ${LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${LIB_SUFFIX}
PARENT_SCOPE) PARENT_SCOPE)
return() return()
endfunction() endfunction()
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# This function will set # This function will set
# IPP_INCLUDE_DIRS, IPP_LIBRARY_DIRS and IPP_LIBRARIES variables depending # IPP_INCLUDE_DIRS, IPP_LIBRARY_DIRS and IPP_LIBRARIES variables depending
# on IPP version parameter. # on IPP version parameter.
# Since IPP 7.0 version library names and install folder structure # Since IPP 7.0 version library names and install folder structure
# was changed # was changed
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
function(set_ipp_variables _LATEST_VERSION) function(set_ipp_variables _LATEST_VERSION)
if(${_LATEST_VERSION} VERSION_LESS "7.0") if(${_LATEST_VERSION} VERSION_LESS "7.0")
# message(STATUS "old") # message(STATUS "old")
# set INCLUDE and LIB folders # set INCLUDE and LIB folders
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE) set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE)
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE) set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE)
if (IPP_X64) if (IPP_X64)
if(NOT EXISTS ${IPP_ROOT_DIR}/../em64t) if(NOT EXISTS ${IPP_ROOT_DIR}/../em64t)
message(SEND_ERROR "IPP EM64T libraries not found") message(SEND_ERROR "IPP EM64T libraries not found")
endif() endif()
else() else()
if(NOT EXISTS ${IPP_ROOT_DIR}/../ia32) if(NOT EXISTS ${IPP_ROOT_DIR}/../ia32)
message(SEND_ERROR "IPP IA32 libraries not found") message(SEND_ERROR "IPP IA32 libraries not found")
endif() endif()
endif() endif()
# set IPP_LIBRARIES variable (6.x lib names) # set IPP_LIBRARIES variable (6.x lib names)
set_ipp_old_libraries() set_ipp_old_libraries()
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
message(STATUS "IPP libs: ${IPP_LIBRARIES}") message(STATUS "IPP libs: ${IPP_LIBRARIES}")
else() else()
# message(STATUS "new") # message(STATUS "new")
# set INCLUDE and LIB folders # set INCLUDE and LIB folders
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE) set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE)
if (IPP_X64) if (IPP_X64)
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64) if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64)
message(SEND_ERROR "IPP EM64T libraries not found") message(SEND_ERROR "IPP EM64T libraries not found")
endif() endif()
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64 PARENT_SCOPE) set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64 PARENT_SCOPE)
else() else()
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32) if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32)
message(SEND_ERROR "IPP IA32 libraries not found") message(SEND_ERROR "IPP IA32 libraries not found")
endif() endif()
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32 PARENT_SCOPE) set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32 PARENT_SCOPE)
endif() endif()
# set IPP_LIBRARIES variable (7.x lib names) # set IPP_LIBRARIES variable (7.x lib names)
set_ipp_new_libraries() set_ipp_new_libraries()
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE) set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
message(STATUS "IPP libs: ${IPP_LIBRARIES}") message(STATUS "IPP libs: ${IPP_LIBRARIES}")
endif() endif()
return() return()
endfunction() endfunction()
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# This section will look for IPP through IPPROOT env variable # 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 # Note, IPPROOT is not set by IPP installer, you may need to set it manually
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
find_path( find_path(
IPP_H_PATH IPP_H_PATH
NAMES ippversion.h NAMES ippversion.h
PATHS $ENV{IPPROOT} PATHS $ENV{IPPROOT}
PATH_SUFFIXES include PATH_SUFFIXES include
DOC "The path to Intel(R) IPP header files" DOC "The path to Intel(R) IPP header files"
NO_DEFAULT_PATH NO_DEFAULT_PATH
NO_CMAKE_PATH) NO_CMAKE_PATH)
if(IPP_H_PATH) if(IPP_H_PATH)
set(IPP_FOUND 1) set(IPP_FOUND 1)
# traverse up to IPPROOT level # traverse up to IPPROOT level
get_filename_component(IPP_ROOT_DIR ${IPP_H_PATH} PATH) get_filename_component(IPP_ROOT_DIR ${IPP_H_PATH} PATH)
# extract IPP version info # extract IPP version info
get_ipp_version(${IPP_ROOT_DIR}) get_ipp_version(${IPP_ROOT_DIR})
# keep info in the same vars for auto search and search by IPPROOT # 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_STR ${IPP_VERSION_STR})
set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR}) set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR})
set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR}) set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR})
set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD}) set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD})
# set IPP INCLUDE, LIB dirs and library names # set IPP INCLUDE, LIB dirs and library names
set_ipp_variables(${IPP_LATEST_VERSION_STR}) set_ipp_variables(${IPP_LATEST_VERSION_STR})
endif() endif()
if(IPP_FOUND) if(IPP_FOUND)
return() return()
endif() endif()
# reset var from previous search # reset var from previous search
set(IPP_H_PATH) set(IPP_H_PATH)
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# This section will look for IPP through system program folders # This section will look for IPP through system program folders
# Note, if several IPP installations found the newest version will be # Note, if several IPP installations found the newest version will be
# selected # selected
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
foreach(curdir ${CMAKE_SYSTEM_PREFIX_PATH}) foreach(curdir ${CMAKE_SYSTEM_PREFIX_PATH})
set(curdir ${curdir}/intel) set(curdir ${curdir}/intel)
file(TO_CMAKE_PATH ${curdir} CURDIR) file(TO_CMAKE_PATH ${curdir} CURDIR)
if(EXISTS ${curdir}) if(EXISTS ${curdir})
file(GLOB_RECURSE IPP_H_DIR ${curdir}/ippversion.h) file(GLOB_RECURSE IPP_H_DIR ${curdir}/ippversion.h)
if(IPP_H_DIR) if(IPP_H_DIR)
set(IPP_FOUND 1) set(IPP_FOUND 1)
endif() endif()
# init IPP_LATEST_VERSION version with oldest detectable version (5.3.0.0) # init IPP_LATEST_VERSION version with oldest detectable version (5.3.0.0)
# IPP prior 5.3 did not have ippversion.h file # IPP prior 5.3 did not have ippversion.h file
set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR}) set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR})
# look through all dirs where ippversion.h was found # look through all dirs where ippversion.h was found
foreach(item ${IPP_H_DIR}) foreach(item ${IPP_H_DIR})
# traverse up to IPPROOT level # traverse up to IPPROOT level
get_filename_component(_FILE_PATH ${item} PATH) get_filename_component(_FILE_PATH ${item} PATH)
get_filename_component(_ROOT_DIR ${_FILE_PATH} PATH) get_filename_component(_ROOT_DIR ${_FILE_PATH} PATH)
# extract IPP version info # extract IPP version info
get_ipp_version(${_ROOT_DIR}) get_ipp_version(${_ROOT_DIR})
# remember the latest version (if many found) # remember the latest version (if many found)
if(${IPP_LATEST_VERSION_STR} VERSION_LESS ${IPP_VERSION_STR}) if(${IPP_LATEST_VERSION_STR} VERSION_LESS ${IPP_VERSION_STR})
set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR}) set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR})
set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR}) set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR})
set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR}) set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR})
set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD}) set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD})
set(IPP_ROOT_DIR ${_ROOT_DIR}) set(IPP_ROOT_DIR ${_ROOT_DIR})
endif() endif()
endforeach() endforeach()
endif() endif()
endforeach() endforeach()
# set IPP INCLUDE, LIB dirs and library names if(IPP_FOUND)
set_ipp_variables(${IPP_LATEST_VERSION_STR}) # 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 # set CACHE variable IPP_H_PATH,
find_path( # path to IPP header files for the latest version
IPP_H_PATH find_path(
NAMES ippversion.h IPP_H_PATH
PATHS ${IPP_ROOT_DIR} NAMES ippversion.h
PATH_SUFFIXES include PATHS ${IPP_ROOT_DIR}
DOC "The path to Intel(R) IPP header files" PATH_SUFFIXES include
NO_DEFAULT_PATH DOC "The path to Intel(R) IPP header files"
NO_CMAKE_PATH) NO_DEFAULT_PATH
NO_CMAKE_PATH)
endif()

View File

@ -1,14 +1,14 @@
# - Find Latex # - Find Latex
# This module finds if Latex is installed and determines where the # This module finds if Latex is installed and determines where the
# executables are. This code sets the following variables: # executables are. This code sets the following variables:
# #
# LATEX_COMPILER: path to the LaTeX compiler # LATEX_COMPILER: path to the LaTeX compiler
# PDFLATEX_COMPILER: path to the PdfLaTeX compiler # PDFLATEX_COMPILER: path to the PdfLaTeX compiler
# BIBTEX_COMPILER: path to the BibTeX compiler # BIBTEX_COMPILER: path to the BibTeX compiler
# MAKEINDEX_COMPILER: path to the MakeIndex compiler # MAKEINDEX_COMPILER: path to the MakeIndex compiler
# DVIPS_CONVERTER: path to the DVIPS converter # DVIPS_CONVERTER: path to the DVIPS converter
# PS2PDF_CONVERTER: path to the PS2PDF converter # PS2PDF_CONVERTER: path to the PS2PDF converter
# LATEX2HTML_CONVERTER: path to the LaTeX2Html converter # LATEX2HTML_CONVERTER: path to the LaTeX2Html converter
# #
IF (WIN32) IF (WIN32)
@ -17,7 +17,7 @@ IF (WIN32)
FIND_PATH(MIKTEX_BINARY_PATH mpm.exe FIND_PATH(MIKTEX_BINARY_PATH mpm.exe
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin"
DOC DOC
"Path to the MikTex binary directory." "Path to the MikTex binary directory."
) )
MARK_AS_ADVANCED(MIKTEX_BINARY_PATH) MARK_AS_ADVANCED(MIKTEX_BINARY_PATH)

View File

@ -4,14 +4,14 @@
# Try to find OpenEXR's libraries, and include path. # Try to find OpenEXR's libraries, and include path.
# Once done this will define: # Once done this will define:
# #
# OPENEXR_FOUND = OpenEXR found. # OPENEXR_FOUND = OpenEXR found.
# OPENEXR_INCLUDE_PATHS = OpenEXR include directories. # OPENEXR_INCLUDE_PATHS = OpenEXR include directories.
# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
# #
SET(OPENEXR_LIBRARIES) SET(OPENEXR_LIBRARIES)
SET(LIBRARY_PATHS SET(LIBRARY_PATHS
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
/sw/lib /sw/lib
@ -25,11 +25,11 @@ FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
/sw/include /sw/include
/opt/local/include) /opt/local/include)
FIND_LIBRARY(OPENEXR_HALF_LIBRARY FIND_LIBRARY(OPENEXR_HALF_LIBRARY
NAMES Half NAMES Half
PATHS ${LIBRARY_PATHS}) PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_IEX_LIBRARY FIND_LIBRARY(OPENEXR_IEX_LIBRARY
NAMES Iex NAMES Iex
PATHS ${LIBRARY_PATHS}) PATHS ${LIBRARY_PATHS})

View File

@ -28,7 +28,7 @@ if(OPENNI_LIBRARY AND OPENNI_INCLUDES)
elseif(UNIX OR APPLE) elseif(UNIX OR APPLE)
find_library(OPENNI_PRIME_SENSOR_MODULE "XnCore" PATHS "/usr/lib" DOC "Core library of PrimeSensor Modules for OpenNI") find_library(OPENNI_PRIME_SENSOR_MODULE "XnCore" PATHS "/usr/lib" DOC "Core library of PrimeSensor Modules for OpenNI")
endif() endif()
if(OPENNI_PRIME_SENSOR_MODULE) if(OPENNI_PRIME_SENSOR_MODULE)
set(HAVE_OPENNI_PRIME_SENSOR_MODULE TRUE) set(HAVE_OPENNI_PRIME_SENSOR_MODULE TRUE)
endif() endif()

View File

@ -77,13 +77,13 @@
# #
# Redistribution and use, with or without modification, are permitted # Redistribution and use, with or without modification, are permitted
# provided that the following conditions are met: # provided that the following conditions are met:
# #
# 1. Redistributions must retain the above copyright notice, this # 1. Redistributions must retain the above copyright notice, this
# list of conditions and the following disclaimer. # list of conditions and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote # 2. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior # products derived from this software without specific prior
# written permission. # written permission.
# #
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -156,7 +156,7 @@ endmacro(_pkgconfig_invoke_dyn)
# Splits given arguments into options and a package list # Splits given arguments into options and a package list
macro(_pkgconfig_parse_options _result _is_req) macro(_pkgconfig_parse_options _result _is_req)
set(${_is_req} 0) set(${_is_req} 0)
foreach(_pkg ${ARGN}) foreach(_pkg ${ARGN})
if (_pkg STREQUAL "REQUIRED") if (_pkg STREQUAL "REQUIRED")
set(${_is_req} 1) set(${_is_req} 1)
@ -203,7 +203,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
message(STATUS "checking for modules '${_pkg_check_modules_list}'") message(STATUS "checking for modules '${_pkg_check_modules_list}'")
endif(_pkg_check_modules_cnt EQUAL 1) endif(_pkg_check_modules_cnt EQUAL 1)
endif(NOT ${_is_silent}) endif(NOT ${_is_silent})
set(_pkg_check_modules_packages) set(_pkg_check_modules_packages)
set(_pkg_check_modules_failed) set(_pkg_check_modules_failed)
@ -230,14 +230,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
if (_pkg_check_modules_pkg_op STREQUAL "=") if (_pkg_check_modules_pkg_op STREQUAL "=")
list(APPEND _pkg_check_modules_exist_query --exact-version) list(APPEND _pkg_check_modules_exist_query --exact-version)
endif(_pkg_check_modules_pkg_op STREQUAL "=") endif(_pkg_check_modules_pkg_op STREQUAL "=")
if (_pkg_check_modules_pkg_op STREQUAL "<=") if (_pkg_check_modules_pkg_op STREQUAL "<=")
list(APPEND _pkg_check_modules_exist_query --max-version) list(APPEND _pkg_check_modules_exist_query --max-version)
endif(_pkg_check_modules_pkg_op STREQUAL "<=") endif(_pkg_check_modules_pkg_op STREQUAL "<=")
# create the final query which is of the format: # create the final query which is of the format:
# * --atleast-version <version> <pkg-name> # * --atleast-version <version> <pkg-name>
# * --exact-version <version> <pkg-name> # * --exact-version <version> <pkg-name>
# * --max-version <version> <pkg-name> # * --max-version <version> <pkg-name>
# * --exists <pkg-name> # * --exists <pkg-name>
if (_pkg_check_modules_pkg_op) if (_pkg_check_modules_pkg_op)
@ -277,7 +277,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
else(_pkg_check_modules_failed) else(_pkg_check_modules_failed)
# when we are here, we checked whether requested modules # when we are here, we checked whether requested modules
# exist. Now, go through them and set variables # exist. Now, go through them and set variables
_pkgconfig_set(${_prefix}_FOUND 1) _pkgconfig_set(${_prefix}_FOUND 1)
list(LENGTH _pkg_check_modules_packages pkg_count) list(LENGTH _pkg_check_modules_packages pkg_count)
@ -289,7 +289,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
else(pkg_count EQUAL 1) else(pkg_count EQUAL 1)
set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}") set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
endif(pkg_count EQUAL 1) endif(pkg_count EQUAL 1)
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix )
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
@ -355,9 +355,9 @@ macro(pkg_search_module _prefix _module0)
message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found") message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found")
endif(${_pkg_is_required}) endif(${_pkg_is_required})
endif(NOT ${_prefix}_FOUND) endif(NOT ${_prefix}_FOUND)
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
endmacro(pkg_search_module) endmacro(pkg_search_module)
### Local Variables: ### Local Variables:

View File

@ -2,10 +2,10 @@
# This module finds if XIMEA Software package is installed # This module finds if XIMEA Software package is installed
# and determines where the binaries and header files are. # and determines where the binaries and header files are.
# This code sets the following variables: # This code sets the following variables:
# #
# XIMEA_FOUND - True if XIMEA API found # XIMEA_FOUND - True if XIMEA API found
# XIMEA_PATH: - Path to the XIMEA API folder # XIMEA_PATH: - Path to the XIMEA API folder
# XIMEA_LIBRARY_DIRS - XIMEA libraries folder # XIMEA_LIBRARY_DIR - XIMEA libraries folder
# #
# Created: 5 Aug 2011 by Marian Zajko (marian.zajko@ximea.com) # Created: 5 Aug 2011 by Marian Zajko (marian.zajko@ximea.com)
# #
@ -14,22 +14,22 @@ set(XIMEA_FOUND)
set(XIMEA_PATH) set(XIMEA_PATH)
set(XIMEA_LIBRARY_DIR) set(XIMEA_LIBRARY_DIR)
# Try to find the XIMEA API path in registry. if(WIN32)
GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE) # Try to find the XIMEA API path in registry.
GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)
if(XIMEA_PATH) if(XIMEA_PATH)
set(XIMEA_FOUND 1) set(XIMEA_FOUND 1)
# set LIB folders # set LIB folders
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}\\x86") set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}\\x86")
else() else()
set(XIMEA_FOUND 0) set(XIMEA_FOUND 0)
endif() endif()
endif()
mark_as_advanced(FORCE XIMEA_FOUND) mark_as_advanced(FORCE XIMEA_FOUND)
mark_as_advanced(FORCE XIMEA_PATH) mark_as_advanced(FORCE XIMEA_PATH)
mark_as_advanced(FORCE XIMEA_LIBRARY_DIR) mark_as_advanced(FORCE XIMEA_LIBRARY_DIR)

View File

@ -9,7 +9,7 @@ macro(add_opencv_precompiled_headers the_target)
SET(pch_name "src/precomp") SET(pch_name "src/precomp")
endif() endif()
set(pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${pch_name}.hpp") set(pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${pch_name}.hpp")
if(PCHSupport_FOUND AND USE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}") if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}")
if(CMAKE_GENERATOR MATCHES Visual) if(CMAKE_GENERATOR MATCHES Visual)
set(${the_target}_pch "${CMAKE_CURRENT_SOURCE_DIR}/${pch_name}.cpp") set(${the_target}_pch "${CMAKE_CURRENT_SOURCE_DIR}/${pch_name}.cpp")
add_native_precompiled_header(${the_target} ${pch_header}) add_native_precompiled_header(${the_target} ${pch_header})
@ -43,7 +43,7 @@ macro(define_opencv_perf_test name)
file(GLOB perf_srcs "${perf_path}/*.cpp") file(GLOB perf_srcs "${perf_path}/*.cpp")
file(GLOB perf_hdrs "${perf_path}/*.h*") file(GLOB perf_hdrs "${perf_path}/*.h*")
source_group("Src" FILES ${perf_srcs}) source_group("Src" FILES ${perf_srcs})
source_group("Include" FILES ${perf_hdrs}) source_group("Include" FILES ${perf_hdrs})
@ -58,7 +58,7 @@ macro(define_opencv_perf_test name)
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "performance tests") set_target_properties(${the_target} PROPERTIES FOLDER "performance tests")
endif() endif()
add_dependencies(${the_target} ${perf_deps}) add_dependencies(${the_target} ${perf_deps})
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${perf_deps}) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${perf_deps})
@ -68,7 +68,7 @@ macro(define_opencv_perf_test name)
if (PYTHON_EXECUTABLE) if (PYTHON_EXECUTABLE)
add_dependencies(perf ${the_target}) add_dependencies(perf ${the_target})
endif() endif()
endif() endif()
endmacro() endmacro()
# this is a template for a OpenCV regression tests # this is a template for a OpenCV regression tests
@ -92,7 +92,7 @@ macro(define_opencv_test name)
file(GLOB test_srcs "${test_path}/*.cpp") file(GLOB test_srcs "${test_path}/*.cpp")
file(GLOB test_hdrs "${test_path}/*.h*") file(GLOB test_hdrs "${test_path}/*.h*")
source_group("Src" FILES ${test_srcs}) source_group("Src" FILES ${test_srcs})
source_group("Include" FILES ${test_hdrs}) source_group("Include" FILES ${test_hdrs})
@ -107,7 +107,7 @@ macro(define_opencv_test name)
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "tests") set_target_properties(${the_target} PROPERTIES FOLDER "tests")
endif() endif()
add_dependencies(${the_target} ${test_deps}) add_dependencies(${the_target} ${test_deps})
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${test_deps}) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${test_deps})
@ -126,13 +126,13 @@ endmacro()
# this is a template for a OpenCV module # this is a template for a OpenCV module
# define_opencv_module(<module_name> <dependencies>) # define_opencv_module(<module_name> <dependencies>)
macro(define_opencv_module name) macro(define_opencv_module name)
project(opencv_${name}) project(opencv_${name})
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/src"
"${CMAKE_CURRENT_BINARY_DIR}") "${CMAKE_CURRENT_BINARY_DIR}")
foreach(d ${ARGN}) foreach(d ${ARGN})
if(d MATCHES "opencv_") if(d MATCHES "opencv_")
string(REPLACE "opencv_" "${OpenCV_SOURCE_DIR}/modules/" d_dir ${d}) string(REPLACE "opencv_" "${OpenCV_SOURCE_DIR}/modules/" d_dir ${d})
@ -153,7 +153,7 @@ macro(define_opencv_module name)
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs}) source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs})
source_group("Include" FILES ${lib_hdrs}) source_group("Include" FILES ${lib_hdrs})
source_group("Include\\detail" FILES ${lib_hdrs_detail}) source_group("Include\\detail" FILES ${lib_hdrs_detail})
list(APPEND lib_hdrs ${lib_hdrs_detail}) list(APPEND lib_hdrs ${lib_hdrs_detail})
set(the_target "opencv_${name}") set(the_target "opencv_${name}")
@ -173,17 +173,17 @@ macro(define_opencv_module name)
) )
endif() endif()
set_target_properties(${the_target} PROPERTIES OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}" ) set_target_properties(${the_target} PROPERTIES OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}" )
if(ENABLE_SOLUTION_FOLDERS) if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "modules") set_target_properties(${the_target} PROPERTIES FOLDER "modules")
endif() endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if(MSVC) if(MSVC)
set_target_properties(${the_target} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS) set_target_properties(${the_target} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
else() else()
add_definitions(-DCVAPI_EXPORTS) add_definitions(-DCVAPI_EXPORTS)
endif() endif()
endif() endif()
@ -222,7 +222,7 @@ macro(define_opencv_module name)
install(FILES ${lib_hdrs} install(FILES ${lib_hdrs}
DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name} DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name}
COMPONENT main) COMPONENT main)
add_opencv_precompiled_headers(${the_target}) add_opencv_precompiled_headers(${the_target})
define_opencv_test(${name}) define_opencv_test(${name})

View File

@ -211,7 +211,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
_PCH_WRITE_PCHDEP_CXX(${_targetName} "${_input}" _pch_dephelp_cxx) _PCH_WRITE_PCHDEP_CXX(${_targetName} "${_input}" _pch_dephelp_cxx)
ADD_LIBRARY(${_targetName}_pch_dephelp STATIC "${_pch_dephelp_cxx}" "${_input}" ) ADD_LIBRARY(${_targetName}_pch_dephelp STATIC "${_pch_dephelp_cxx}" "${_input}" )
set_target_properties(${_targetName}_pch_dephelp PROPERTIES set_target_properties(${_targetName}_pch_dephelp PROPERTIES
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_PATH}" ARCHIVE_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_PATH}"
@ -221,7 +221,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
#MESSAGE("_compile_FLAGS: ${_compile_FLAGS}") #MESSAGE("_compile_FLAGS: ${_compile_FLAGS}")
#message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}") #message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}")
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_name}" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_name}"
COMMAND ${CMAKE_COMMAND} -E copy "${_input}" "${CMAKE_CURRENT_BINARY_DIR}/${_name}" # ensure same directory! Required by gcc COMMAND ${CMAKE_COMMAND} -E copy "${_input}" "${CMAKE_CURRENT_BINARY_DIR}/${_name}" # ensure same directory! Required by gcc
@ -242,7 +242,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
) )
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_input} ${_output} ${_dowarn}) ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_input} ${_output} ${_dowarn})
ENDMACRO(ADD_PRECOMPILED_HEADER) ENDMACRO(ADD_PRECOMPILED_HEADER)
@ -280,7 +280,7 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
ENDIF() ENDIF()
if(CMAKE_GENERATOR MATCHES "^Visual.*$") if(CMAKE_GENERATOR MATCHES "^Visual.*$")
# Auto include the precompile (useful for moc processing, since the use of # Auto include the precompile (useful for moc processing, since the use of
# precompiled is specified at the target level # precompiled is specified at the target level
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt) # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
@ -297,7 +297,7 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
SET_SOURCE_FILES_PROPERTIES(${${_targetName}_pch} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_input}\"") SET_SOURCE_FILES_PROPERTIES(${${_targetName}_pch} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_input}\"")
elseif (CMAKE_GENERATOR MATCHES Xcode) elseif (CMAKE_GENERATOR MATCHES Xcode)
# For Xcode, cmake needs my patch to process # For Xcode, cmake needs my patch to process
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties

118
cmake/OpenCVUtils.cmake Normal file
View File

@ -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()

View File

@ -1,14 +1,14 @@
set(OpenCV_VERSION @OPENCV_VERSION@) set(OpenCV_VERSION @OPENCV_VERSION@)
set(PACKAGE_VERSION ${OpenCV_VERSION}) set(PACKAGE_VERSION ${OpenCV_VERSION})
set(PACKAGE_VERSION_EXACT False) set(PACKAGE_VERSION_EXACT False)
set(PACKAGE_VERSION_COMPATIBLE False) set(PACKAGE_VERSION_COMPATIBLE False)
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT True) set(PACKAGE_VERSION_EXACT True)
set(PACKAGE_VERSION_COMPATIBLE True) set(PACKAGE_VERSION_COMPATIBLE True)
endif() endif()
if(PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION) if(PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION)
set(PACKAGE_VERSION_COMPATIBLE True) set(PACKAGE_VERSION_COMPATIBLE True)
endif() endif()

View File

@ -1,198 +1,198 @@
# =================================================================================== # ===================================================================================
# The OpenCV CMake configuration file # The OpenCV CMake configuration file
# #
# ** File generated automatically, do not modify ** # ** File generated automatically, do not modify **
# #
# Usage from an external project: # Usage from an external project:
# In your CMakeLists.txt, add these lines: # In your CMakeLists.txt, add these lines:
# #
# FIND_PACKAGE(OpenCV REQUIRED ) # FIND_PACKAGE(OpenCV REQUIRED )
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS}) # TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
# #
# This file will define the following variables: # This file will define the following variables:
# - OpenCV_LIBS : The list of libraries to links against. # - OpenCV_LIBS : The list of libraries to links against.
# - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES # - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES
# with this path is NOT needed. # with this path is NOT needed.
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories. # - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability # - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
# - OpenCV_VERSION : The version of this OpenCV build. Example: "@OPENCV_VERSION@" # - 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_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_MINOR : Minor version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MINOR@"
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_PATCH@" # - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_PATCH@"
# #
# Advanced variables: # Advanced variables:
# - OpenCV_SHARED # - OpenCV_SHARED
# - OpenCV_CONFIG_PATH # - OpenCV_CONFIG_PATH
# - OpenCV_INSTALL_PATH # - OpenCV_INSTALL_PATH
# - OpenCV_LIB_COMPONENTS # - OpenCV_LIB_COMPONENTS
# - OpenCV_EXTRA_COMPONENTS # - OpenCV_EXTRA_COMPONENTS
# - OpenCV_USE_MANGLED_PATHS # - OpenCV_USE_MANGLED_PATHS
# - OpenCV_HAVE_ANDROID_CAMERA # - OpenCV_HAVE_ANDROID_CAMERA
# - OpenCV_SOURCE_PATH # - OpenCV_SOURCE_PATH
# #
# ================================================================================================= # =================================================================================================
# ====================================================== # ======================================================
# Version Compute Capability from which library OpenCV # Version Compute Capability from which library OpenCV
# has been compiled is remembered # has been compiled is remembered
# ====================================================== # ======================================================
SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@) SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@)
# Some additional settings are required if OpenCV is built as static libs # Some additional settings are required if OpenCV is built as static libs
set(OpenCV_SHARED @BUILD_SHARED_LIBS@) set(OpenCV_SHARED @BUILD_SHARED_LIBS@)
# Enables mangled install paths, that help with side by side installs # Enables mangled install paths, that help with side by side installs
set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@) set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@)
# Extract the directory where *this* file has been installed (determined at cmake run-time) # 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_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings # Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH) get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH)
# Presence of Android native camera support # Presence of Android native camera support
set (OpenCV_HAVE_ANDROID_CAMERA @WITH_ANDROID_CAMERA@) set (OpenCV_HAVE_ANDROID_CAMERA @WITH_ANDROID_CAMERA@)
# ====================================================== # ======================================================
# Include directories to add to the user project: # Include directories to add to the user project:
# ====================================================== # ======================================================
# Provide the include directories to the caller # Provide the include directories to the caller
SET(OpenCV_INCLUDE_DIRS @CMAKE_INCLUDE_DIRS_CONFIGCMAKE@) SET(OpenCV_INCLUDE_DIRS @CMAKE_INCLUDE_DIRS_CONFIGCMAKE@)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
# ====================================================== # ======================================================
# Link directories to add to the user project: # Link directories to add to the user project:
# ====================================================== # ======================================================
# Provide the libs directory anyway, it may be needed in some cases. # Provide the libs directory anyway, it may be needed in some cases.
SET(OpenCV_LIB_DIR @CMAKE_LIB_DIRS_CONFIGCMAKE@) SET(OpenCV_LIB_DIR @CMAKE_LIB_DIRS_CONFIGCMAKE@)
LINK_DIRECTORIES(${OpenCV_LIB_DIR}) LINK_DIRECTORIES(${OpenCV_LIB_DIR})
# ==================================================================== # ====================================================================
# Link libraries: e.g. libopencv_core.so, opencv_imgproc220d.lib, etc... # Link libraries: e.g. libopencv_core.so, opencv_imgproc220d.lib, etc...
# ==================================================================== # ====================================================================
# OpenCV internal dependencies: # OpenCV internal dependencies:
# opencv_androidcamera -> {} # opencv_androidcamera -> {}
# opencv_core -> {} # opencv_core -> {}
# opencv_flann -> {opencv_core} # opencv_flann -> {opencv_core}
# opencv_imgproc -> {opencv_core} # opencv_imgproc -> {opencv_core}
# opencv_ml -> {opencv_core} # opencv_ml -> {opencv_core}
# opencv_highgui -> {opencv_core, opencv_imgproc, opencv_androidcamera} # opencv_highgui -> {opencv_core, opencv_imgproc, opencv_androidcamera}
# opencv_video -> {opencv_core, opencv_imgproc} # opencv_video -> {opencv_core, opencv_imgproc}
# opencv_features2d -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui} # opencv_features2d -> {opencv_core, opencv_imgproc, opencv_flann, opencv_highgui}
# opencv_calib3d -> {opencv_core, opencv_imgproc, opencv_flann, opencv_features2d} # 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_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_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_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_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} # 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) 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: # remove modules unavailable on current platform:
if(ANDROID) if(ANDROID)
LIST(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_gpu) LIST(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_gpu)
SET(OpenCV_LIB_ANDROID @OpenCV_LIB_ANDROID@) SET(OpenCV_LIB_ANDROID @OpenCV_LIB_ANDROID@)
IF(OpenCV_LIB_ANDROID) IF(OpenCV_LIB_ANDROID)
SET(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS} ${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_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-shlib-undefined")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-shlib-undefined") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-shlib-undefined")
ENDIF() ENDIF()
endif() endif()
if(NOT ANDROID OR OpenCV_SHARED OR NOT OpenCV_HAVE_ANDROID_CAMERA) if(NOT ANDROID OR OpenCV_SHARED OR NOT OpenCV_HAVE_ANDROID_CAMERA)
LIST(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_androidcamera) LIST(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_androidcamera)
endif() endif()
if(OpenCV_USE_MANGLED_PATHS) if(OpenCV_USE_MANGLED_PATHS)
#be explicit about the library names. #be explicit about the library names.
set(OpenCV_LIB_COMPONENTS_ ) set(OpenCV_LIB_COMPONENTS_ )
foreach( CVLib ${OpenCV_LIB_COMPONENTS}) foreach( CVLib ${OpenCV_LIB_COMPONENTS})
list(APPEND OpenCV_LIB_COMPONENTS_ ${OpenCV_LIB_DIR}/lib${CVLib}.so.@OPENCV_VERSION@ ) list(APPEND OpenCV_LIB_COMPONENTS_ ${OpenCV_LIB_DIR}/lib${CVLib}.so.@OPENCV_VERSION@ )
endforeach() endforeach()
set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_})
endif() endif()
SET(OpenCV_LIBS "") SET(OpenCV_LIBS "")
if(WIN32) if(WIN32)
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})
# CMake>=2.6 supports the notation "debug XXd optimized XX" # CMake>=2.6 supports the notation "debug XXd optimized XX"
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4) if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4)
# Modern CMake: # Modern CMake:
SET(OpenCV_LIBS ${OpenCV_LIBS} debug ${__CVLIB}@OPENCV_DLLVERSION@@OPENCV_DEBUG_POSTFIX@ optimized ${__CVLIB}@OPENCV_DLLVERSION@) SET(OpenCV_LIBS ${OpenCV_LIBS} debug ${__CVLIB}@OPENCV_DLLVERSION@@OPENCV_DEBUG_POSTFIX@ optimized ${__CVLIB}@OPENCV_DLLVERSION@)
else() else()
# Old CMake: # Old CMake:
SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}@OPENCV_DLLVERSION@) SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}@OPENCV_DLLVERSION@)
endif() endif()
endforeach() endforeach()
else() else()
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})
SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}) SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB})
endforeach() endforeach()
endif() endif()
# ============================================================== # ==============================================================
# Extra include directories, needed by OpenCV 2 new structure # Extra include directories, needed by OpenCV 2 new structure
# ============================================================== # ==============================================================
SET(OpenCV_SOURCE_PATH "@CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE@") SET(OpenCV_SOURCE_PATH "@CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE@")
if(NOT "${OpenCV_SOURCE_PATH}" STREQUAL "") if(NOT "${OpenCV_SOURCE_PATH}" STREQUAL "")
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS}) foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})
# We only need the "core",... part here: "opencv_core" -> "core" # We only need the "core",... part here: "opencv_core" -> "core"
STRING(REGEX REPLACE "opencv_(.*)" "\\1" __MODNAME ${__CVLIB}) STRING(REGEX REPLACE "opencv_(.*)" "\\1" __MODNAME ${__CVLIB})
INCLUDE_DIRECTORIES("${OpenCV_SOURCE_PATH}/modules/${__MODNAME}/include") INCLUDE_DIRECTORIES("${OpenCV_SOURCE_PATH}/modules/${__MODNAME}/include")
LIST(APPEND OpenCV_INCLUDE_DIRS "${OpenCV_SOURCE_PATH}/modules/${__MODNAME}/include") LIST(APPEND OpenCV_INCLUDE_DIRS "${OpenCV_SOURCE_PATH}/modules/${__MODNAME}/include")
endforeach() endforeach()
endif() endif()
# For OpenCV built as static libs, we need the user to link against # For OpenCV built as static libs, we need the user to link against
# many more dependencies: # many more dependencies:
IF (NOT OpenCV_SHARED) IF (NOT OpenCV_SHARED)
# Under static libs, the user of OpenCV needs access to the 3rdparty libs as well: # Under static libs, the user of OpenCV needs access to the 3rdparty libs as well:
LINK_DIRECTORIES(@CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE@) LINK_DIRECTORIES(@CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE@)
set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS}) 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@) 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) if (WIN32 AND ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4)
# Modern CMake: # Modern CMake:
foreach(__EXTRA_LIB ${OpenCV_EXTRA_COMPONENTS}) foreach(__EXTRA_LIB ${OpenCV_EXTRA_COMPONENTS})
set(OpenCV_LIBS ${OpenCV_LIBS} set(OpenCV_LIBS ${OpenCV_LIBS}
debug ${__EXTRA_LIB}@OPENCV_DEBUG_POSTFIX@ debug ${__EXTRA_LIB}@OPENCV_DEBUG_POSTFIX@
optimized ${__EXTRA_LIB}) optimized ${__EXTRA_LIB})
endforeach() endforeach()
else() else()
# Old CMake: # Old CMake:
set(OpenCV_LIBS ${OpenCV_LIBS} ${OpenCV_EXTRA_COMPONENTS}) set(OpenCV_LIBS ${OpenCV_LIBS} ${OpenCV_EXTRA_COMPONENTS})
endif() endif()
if (APPLE) if (APPLE)
set(OpenCV_LIBS ${OpenCV_LIBS} "-lbz2" "-framework Cocoa" "-framework QuartzCore" "-framework QTKit") set(OpenCV_LIBS ${OpenCV_LIBS} "-lbz2" "-framework Cocoa" "-framework QuartzCore" "-framework QTKit")
endif() endif()
ENDIF() ENDIF()
# ====================================================== # ======================================================
# Android camera helper macro # Android camera helper macro
# ====================================================== # ======================================================
IF (OpenCV_HAVE_ANDROID_CAMERA) IF (OpenCV_HAVE_ANDROID_CAMERA)
macro( COPY_NATIVE_CAMERA_LIBS target ) macro( COPY_NATIVE_CAMERA_LIBS target )
get_target_property(target_location ${target} LOCATION) get_target_property(target_location ${target} LOCATION)
get_filename_component(target_location "${target_location}" PATH) get_filename_component(target_location "${target_location}" PATH)
file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so") file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so")
foreach(wrapper ${camera_wrappers}) foreach(wrapper ${camera_wrappers})
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
TARGET ${target} TARGET ${target}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}" COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}"
) )
endforeach() endforeach()
endmacro() endmacro()
ENDIF() ENDIF()
# ====================================================== # ======================================================
# Version variables: # Version variables:
# ====================================================== # ======================================================
SET(OpenCV_VERSION @OPENCV_VERSION@) SET(OpenCV_VERSION @OPENCV_VERSION@)
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@) SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@)
SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@) SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@)
SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@) SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@)

View File

@ -163,9 +163,6 @@
/* Intel Threading Building Blocks */ /* Intel Threading Building Blocks */
#cmakedefine HAVE_TBB #cmakedefine HAVE_TBB
/* Threading Framework --- temporary decision for ARM instead of Intel TBB */
#cmakedefine HAVE_THREADING_FRAMEWORK
/* Eigen Matrix & Linear Algebra Library */ /* Eigen Matrix & Linear Algebra Library */
#cmakedefine HAVE_EIGEN #cmakedefine HAVE_EIGEN

View File

@ -198,19 +198,6 @@ CV_INLINE IppiSize ippiSize(int width, int height)
int _begin, _end, _grainsize; int _begin, _end, _grainsize;
}; };
#ifdef HAVE_THREADING_FRAMEWORK
#include "opencv2/core/threading_framework.hpp"
template<typename Body>
static void parallel_for( const BlockedRange& range, const Body& body )
{
tf::parallel_for<Body>(range, body);
}
typedef tf::ConcurrentVector<Rect> ConcurrentRectVector;
typedef tf::ConcurrentVector<double> ConcurrentDoubleVector;
#else
template<typename Body> static inline template<typename Body> static inline
void parallel_for( const BlockedRange& range, const Body& body ) void parallel_for( const BlockedRange& range, const Body& body )
{ {
@ -218,7 +205,6 @@ CV_INLINE IppiSize ippiSize(int width, int height)
} }
typedef std::vector<Rect> ConcurrentRectVector; typedef std::vector<Rect> ConcurrentRectVector;
typedef std::vector<double> ConcurrentDoubleVector; typedef std::vector<double> ConcurrentDoubleVector;
#endif
template<typename Iterator, typename Body> static inline template<typename Iterator, typename Body> static inline
void parallel_do( Iterator first, Iterator last, const Body& body ) void parallel_do( Iterator first, Iterator last, const Body& body )

View File

@ -1076,7 +1076,7 @@ void CascadeClassifier::detectMultiScale( const Mat& image, vector<Rect>& object
int stripCount, stripSize; int stripCount, stripSize;
#if defined(HAVE_TBB) || defined(HAVE_THREADING_FRAMEWORK) #ifdef HAVE_TBB
const int PTS_PER_THREAD = 1000; const int PTS_PER_THREAD = 1000;
stripCount = ((processingRectSize.width/yStep)*(processingRectSize.height + yStep-1)/yStep + PTS_PER_THREAD/2)/PTS_PER_THREAD; stripCount = ((processingRectSize.width/yStep)*(processingRectSize.height + yStep-1)/yStep + PTS_PER_THREAD/2)/PTS_PER_THREAD;
stripCount = std::min(std::max(stripCount, 1), 100); stripCount = std::min(std::max(stripCount, 1), 100);

View File

@ -1,3 +1,7 @@
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
return()
endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# CMake file for python support # CMake file for python support
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------