-# ----------------------------------------------------------------------------\r
-# Root CMake file for OpenCV\r
-#\r
-# From the off-tree build directory, invoke:\r
-# $ cmake <PATH_TO_OPENCV_ROOT>\r
-#\r
-#\r
-# - OCT-2008: Initial version <joseluisblancoc@gmail.com>\r
-#\r
-# ----------------------------------------------------------------------------\r
-\r
-set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)\r
-\r
-\r
-# Add these standard paths to the search paths for FIND_LIBRARY\r
-# to find libraries from these locations first\r
-if(UNIX)\r
- set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib /usr/lib)\r
-endif()\r
-\r
-\r
-# it _must_ go before PROJECT(OpenCV) in order to work\r
-if(WIN32)\r
- set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")\r
-else()\r
- set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory")\r
-endif()\r
-\r
-set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")\r
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)\r
-\r
-set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)\r
-set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)\r
-set(CMAKE_VERBOSE OFF CACHE BOOL "Verbose mode")\r
-\r
-if(CMAKE_VERBOSE)\r
- set(CMAKE_VERBOSE_MAKEFILE 1)\r
-endif()\r
-\r
-\r
-project(OpenCV)\r
-\r
-\r
-cmake_minimum_required(VERSION 2.4)\r
-\r
-\r
-if(MSVC)\r
- set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)\r
-endif()\r
-\r
-\r
-# --------------------------------------------------------------\r
-# Indicate CMake 2.7 and above that we don't want to mix relative\r
-# and absolute paths in linker lib lists.\r
-# Run "cmake --help-policy CMP0003" for more information.\r
-# --------------------------------------------------------------\r
-if(COMMAND cmake_policy)\r
- cmake_policy(SET CMP0003 NEW)\r
-endif()\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# Current version number:\r
-# ----------------------------------------------------------------------------\r
-set(OPENCV_VERSION "2.2.9")\r
-\r
-string(REGEX MATCHALL "[0-9]" OPENCV_VERSION_PARTS "${OPENCV_VERSION}")\r
-\r
-list(GET OPENCV_VERSION_PARTS 0 OPENCV_VERSION_MAJOR)\r
-list(GET OPENCV_VERSION_PARTS 1 OPENCV_VERSION_MINOR)\r
-list(GET OPENCV_VERSION_PARTS 2 OPENCV_VERSION_PATCH)\r
-\r
-set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")\r
-\r
-if(WIN32)\r
- # Postfix of DLLs:\r
- set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")\r
- set(OPENCV_DEBUG_POSTFIX d)\r
-else()\r
- # Postfix of so's:\r
- #set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")\r
- set(OPENCV_DLLVERSION "")\r
- set(OPENCV_DEBUG_POSTFIX)\r
-endif()\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# Build static or dynamic libs?\r
-# Default: dynamic libraries:\r
-# ----------------------------------------------------------------------------\r
-set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")\r
-\r
-# ----------------------------------------------------------------------------\r
-# Use statically or dynamically linked CRT?\r
-# Default: dynamic\r
-# ----------------------------------------------------------------------------\r
-if(MSVC AND NOT BUILD_SHARED_LIBS)\r
- option (BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT" OFF)\r
-endif()\r
- \r
-if(MSVC)\r
- if(BUILD_WITH_STATIC_CRT)\r
- foreach(flag_var\r
- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE\r
- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO\r
- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE\r
- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)\r
- if(${flag_var} MATCHES "/MD")\r
- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")\r
- endif(${flag_var} MATCHES "/MD")\r
-\r
- if(${flag_var} MATCHES "/MDd")\r
- string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")\r
- endif(${flag_var} MATCHES "/MDd") \r
- endforeach(flag_var)\r
- \r
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib")\r
- \r
- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib")\r
- set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmtd.lib")\r
- \r
- else(BUILD_WITH_STATIC_CRT)\r
- foreach(flag_var\r
- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE\r
- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO\r
- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE\r
- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)\r
- if(${flag_var} MATCHES "/MT")\r
- string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")\r
- endif(${flag_var} MATCHES "/MT")\r
-\r
- if(${flag_var} MATCHES "/MTd")\r
- string(REGEX REPLACE "/MTd" "/MDd" ${flag_var} "${${flag_var}}")\r
- endif(${flag_var} MATCHES "/MTd") \r
- endforeach(flag_var)\r
-\r
- endif(BUILD_WITH_STATIC_CRT)\r
-endif(MSVC)\r
-\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# Variables for cvconfig.h.cmake\r
-# ----------------------------------------------------------------------------\r
-set(PACKAGE "opencv")\r
-set(PACKAGE_BUGREPORT "opencvlibrary-devel@lists.sourceforge.net")\r
-set(PACKAGE_NAME "opencv")\r
-set(PACKAGE_STRING "${PACKAGE} ${OPENCV_VERSION}")\r
-set(PACKAGE_TARNAME "${PACKAGE}")\r
-set(PACKAGE_VERSION "${OPENCV_VERSION}")\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# Autodetect if we are in a SVN repository\r
-# ----------------------------------------------------------------------------\r
-find_program(SVNVERSION_PATH svnversion)\r
-mark_as_advanced(force SVNVERSION_PATH)\r
-if(SVNVERSION_PATH)\r
- message(STATUS "Extracting svn version, please wait...")\r
- execute_process(COMMAND ${SVNVERSION_PATH} -n ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE SVNVERSION_RESULT)\r
-\r
- if(SVNVERSION_RESULT MATCHES "exported")\r
- # This is NOT a svn repository:\r
- set(OPENCV_SVNVERSION "")\r
- else()\r
- set(OPENCV_SVNVERSION " svn:${SVNVERSION_RESULT}")\r
- endif()\r
-\r
- message(STATUS "SVNVERSION: ${OPENCV_SVNVERSION}")\r
-else()\r
- # We don't have svnversion:\r
- set(OPENCV_SVNVERSION "")\r
-endif()\r
-\r
-# ----------------------------------------------------------------------------\r
-# Detect Microsoft compiler:\r
-# ----------------------------------------------------------------------------\r
-if(CMAKE_CL_64)\r
- set(MSVC64 1)\r
-endif()\r
-\r
-# ----------------------------------------------------------------------------\r
-# Detect GNU version:\r
-# ----------------------------------------------------------------------------\r
-if(CMAKE_COMPILER_IS_GNUCXX)\r
- execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version\r
- OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL\r
- OUTPUT_STRIP_TRAILING_WHITESPACE)\r
-\r
- # Typical output in CMAKE_OPENCV_GCC_VERSION_FULL: "c+//0 (whatever) 4.2.3 (...)"\r
- # Look for the version number\r
- string(REGEX MATCH "[0-9].[0-9].[0-9]" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")\r
-\r
- # Split the three parts:\r
- string(REGEX MATCHALL "[0-9]" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}")\r
-\r
- list(GET CMAKE_OPENCV_GCC_VERSIONS 0 CMAKE_OPENCV_GCC_VERSION_MAJOR)\r
- list(GET CMAKE_OPENCV_GCC_VERSIONS 1 CMAKE_OPENCV_GCC_VERSION_MINOR)\r
-\r
- set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR})\r
- math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}")\r
- message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})")\r
-\r
- if(WIN32)\r
- execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine\r
- OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE\r
- OUTPUT_STRIP_TRAILING_WHITESPACE)\r
- if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")\r
- set(MINGW64 1)\r
- endif()\r
- endif()\r
-\r
-endif()\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):\r
-# see include/opencv/cxtypes.h file for related ICC & CV_ICC defines.\r
-# NOTE: The system needs to determine if the '-fPIC' option needs to be added\r
-# for the 3rdparty static libs being compiled. The CMakeLists.txt files\r
-# in 3rdparty use the CV_ICC definition being set here to determine if\r
-# the -fPIC flag should be used.\r
-# ----------------------------------------------------------------------------\r
-if(UNIX)\r
- if (__ICL)\r
- set(CV_ICC __ICL)\r
- elseif(__ICC)\r
- set(CV_ICC __ICC)\r
- elseif(__ECL)\r
- set(CV_ICC __ECL)\r
- elseif(__ECC)\r
- set(CV_ICC __ECC)\r
- elseif(__INTEL_COMPILER)\r
- set(CV_ICC __INTEL_COMPILER)\r
- elseif(CMAKE_C_COMPILER MATCHES "icc")\r
- set(CV_ICC icc_matches_c_compiler)\r
- endif()\r
-endif()\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..\r
-# ----------------------------------------------------------------------------\r
-\r
-# Build/install (or not) some apps:\r
-# ===================================================\r
-set(BUILD_EXAMPLES OFF CACHE BOOL "Build all examples")\r
-set(INSTALL_C_EXAMPLES OFF CACHE BOOL "Install C examples")\r
-set(INSTALL_PYTHON_EXAMPLES OFF CACHE BOOL "Install Python examples")\r
-\r
-# Build tests:\r
-# ===================================================\r
-set(BUILD_TESTS ON CACHE BOOL "Build tests")\r
-\r
-# Build 3rdparty libraries under unix\r
-# ===================================================\r
-if(WIN32)\r
- set(OPENCV_BUILD_3RDPARTY_LIBS TRUE CACHE BOOL "Build 3rd party libraries")\r
-else()\r
- set(OPENCV_BUILD_3RDPARTY_LIBS FALSE CACHE BOOL "Build 3rd party libraries")\r
-endif()\r
-\r
-include(OpenCVPCHSupport.cmake REQUIRED)\r
-include(OpenCVModule.cmake REQUIRED)\r
-\r
-if(PCHSupport_FOUND)\r
- SET(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Use precompiled headers")\r
-else()\r
- SET(USE_PRECOMPILED_HEADERS OFF CACHE BOOL "Use precompiled headers" FORCE)\r
-endif()\r
-\r
-if(UNIX)\r
- include(OpenCVFindPkgConfig.cmake OPTIONAL)\r
- include(CheckFunctionExists)\r
- include(CheckIncludeFile)\r
-endif()\r
-\r
-#if(MSVC)\r
-# set(DEFAULT_ENABLE_OPENMP ON)\r
-#else()\r
-# set(DEFAULT_ENABLE_OPENMP OFF)\r
-#endif()\r
-#set(ENABLE_OPENMP ${DEFAULT_ENABLE_OPENMP} CACHE BOOL "")\r
-\r
-if(CMAKE_COMPILER_IS_GNUCXX)\r
- set(ENABLE_PROFILING OFF CACHE BOOL "Enable profiling in the GCC compiler (Add flags: -g -pg)")\r
- set(USE_OMIT_FRAME_POINTER ON CACHE BOOL "Enable -fomit-frame-pointer for GCC")\r
-\r
- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*|x86_64*)\r
- set(X86_64 1)\r
- endif()\r
- \r
- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686*|i386*|x86*)\r
- set(X86 1)\r
- endif()\r
-\r
- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES powerpc*)\r
- set(USE_O3 ON CACHE BOOL "Enable -O3 for GCC")\r
- set(ENABLE_POWERPC ON CACHE BOOL "Enable PowerPC for GCC")\r
- endif ()\r
-\r
- if(X86 OR X86_64)\r
- # enable everything, since the available set of instructions is checked at runtime\r
- set(USE_O3 ON CACHE BOOL "Enable -O3")\r
- set(USE_FAST_MATH ON CACHE BOOL "Enable -ffast-math")\r
- set(ENABLE_SSE ON CACHE BOOL "Enable SSE instructions")\r
- set(ENABLE_SSE2 ON CACHE BOOL "Enable SSE2 instructions")\r
- set(ENABLE_SSE3 OFF CACHE BOOL "Enable SSE3 instructions")\r
- set(ENABLE_SSSE3 OFF CACHE BOOL "Enable SSSE3 instructions")\r
- set(ENABLE_SSE41 OFF CACHE BOOL "Enable SSE4.1 instructions")\r
- set(ENABLE_SSE42 OFF CACHE BOOL "Enable SSE4.2 instructions")\r
- endif()\r
-endif()\r
-\r
-if(MSVC)\r
- set(ENABLE_SSE ON CACHE BOOL "Enable SSE instructions for MSVC")\r
- set(ENABLE_SSE2 ON CACHE BOOL "Enable SSE2 instructions for MSVC")\r
- if(CMAKE_C_COMPILER MATCHES "icc")\r
- set(ENABLE_SSE3 OFF CACHE BOOL "Enable SSE3 instructions for ICC")\r
- set(ENABLE_SSE4_1 OFF CACHE BOOL "Enable SSE4.1 instructions for ICC")\r
- endif()\r
-endif()\r
-\r
-# allow fine grained control over which libraries not to link, even if\r
-# they are available on the system\r
-# ====================================================================\r
-set(WITH_PNG ON CACHE BOOL "Include PNG support")\r
-set(WITH_JPEG ON CACHE BOOL "Include JPEG support")\r
-set(WITH_JASPER ON CACHE BOOL "Include JPEG2K support")\r
-set(WITH_TIFF ON CACHE BOOL "Include TIFF support")\r
-set(WITH_OPENEXR ON CACHE BOOL "Include ILM support via OpenEXR")\r
-\r
-if(UNIX)\r
- set(WITH_FFMPEG ON CACHE BOOL "Include FFMPEG support")\r
- if(NOT APPLE)\r
- set(WITH_UNICAP OFF CACHE BOOL "Include Unicap support (GPL)")\r
- set(WITH_GTK ON CACHE BOOL "Include GTK support")\r
- set(WITH_GSTREAMER ON CACHE BOOL "Include Gstreamer support")\r
- set(WITH_V4L ON CACHE BOOL "Include Video 4 Linux support")\r
- set(WITH_XINE OFF CACHE BOOL "Include Xine support (GPL)")\r
- endif()\r
- set(WITH_PVAPI ON CACHE BOOL "Include Prosilica GigE support")\r
- set(WITH_1394 ON CACHE BOOL "Include IEEE1394 support")\r
-endif()\r
-\r
-if(APPLE)\r
- set(WITH_CARBON OFF CACHE BOOL "Use Carbon for UI instead of Cocoa")\r
- set(WITH_QUICKTIME OFF CACHE BOOL "Use QuickTime for Video I/O insted of QTKit")\r
-endif()\r
-\r
-set(WITH_TBB OFF CACHE BOOL "Include Intel TBB support")\r
-set(WITH_IPP OFF CACHE BOOL "Include Intel IPP support")\r
-set(WITH_EIGEN ON CACHE BOOL "Include Eigen2/Eigen3 support")\r
-set(WITH_CUDA OFF CACHE BOOL "Include NVidia Cuda Runtime support")\r
-\r
-if(WIN32)\r
- set(WITH_VIDEOINPUT ON CACHE BOOL "Enable VideoInput support")\r
-endif()\r
-\r
-set(WITH_OPENNI OFF CACHE BOOL "Include OpenNI support")\r
-\r
-# ===================================================\r
-# Macros that checks if module have been installed.\r
-# After it adds module to build and define\r
-# constants passed as second arg\r
-# ===================================================\r
-\r
-macro(CHECK_MODULE module_name define)\r
- set(${define} 0)\r
- if(PKG_CONFIG_FOUND)\r
- set(ALIAS ALIASOF_${module_name})\r
- set(ALIAS_FOUND ${ALIAS}_FOUND)\r
- set(ALIAS_INCLUDE_DIRS ${ALIAS}_INCLUDE_DIRS)\r
- set(ALIAS_LIBRARY_DIRS ${ALIAS}_LIBRARY_DIRS)\r
- set(ALIAS_LIBRARIES ${ALIAS}_LIBRARIES)\r
-\r
- PKG_CHECK_MODULES(${ALIAS} ${module_name})\r
-\r
- if (${ALIAS_FOUND})\r
- set(${define} 1)\r
- foreach(P "${ALIAS_INCLUDE_DIRS}")\r
- if (${P})\r
- list(APPEND HIGHGUI_INCLUDE_DIRS ${${P}})\r
- endif()\r
- endforeach()\r
-\r
- foreach(P "${ALIAS_LIBRARY_DIRS}")\r
- if (${P})\r
- list(APPEND HIGHGUI_LIBRARY_DIRS ${${P}})\r
- endif()\r
- endforeach()\r
-\r
- list(APPEND HIGHGUI_LIBRARIES ${${ALIAS_LIBRARIES}})\r
- endif()\r
- endif()\r
-endmacro()\r
-\r
-if(UNIX)\r
- if(NOT APPLE)\r
- if(WITH_GTK)\r
- CHECK_MODULE(gtk+-2.0 HAVE_GTK)\r
- CHECK_MODULE(gthread-2.0 HAVE_GTHREAD)\r
- else()\r
- set(HAVE_GTK FALSE)\r
- set(HAVE_GTHREAD FALSE)\r
- endif()\r
- if(WITH_GSTREAMER)\r
- CHECK_MODULE(gstreamer-base-0.10 HAVE_GSTREAMER)\r
- CHECK_MODULE(gstreamer-app-0.10 HAVE_GSTREAMER)\r
- CHECK_MODULE(gstreamer-video-0.10 HAVE_GSTREAMER)\r
- else()\r
- set(HAVE_GSTREAMER FALSE)\r
- endif()\r
- endif()\r
-\r
- if(WITH_UNICAP)\r
- CHECK_MODULE(libunicap HAVE_UNICAP_)\r
- CHECK_MODULE(libucil HAVE_UNICAP_UCIL)\r
- if(HAVE_UNICAP_ AND HAVE_UNICAP_UCIL)\r
- set(HAVE_UNICAP 1)\r
- endif()\r
- else()\r
- set(HAVE_UNICAP FALSE)\r
- endif()\r
-\r
- if(WITH_PVAPI)\r
- find_path(PVAPI_INCLUDE_PATH "PvApi.h"\r
- PATHS "/usr/local/include" "/usr/include"\r
- DOC "The path to PvAPI header")\r
- if(PVAPI_INCLUDE_PATH)\r
- set(HAVE_PVAPI 1)\r
- endif()\r
- endif()\r
-\r
- set(HAVE_FFMPEG 0)\r
- if(WITH_FFMPEG)\r
- CHECK_MODULE(libavcodec HAVE_FFMPEG_CODEC)\r
- CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)\r
- CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)\r
- CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)\r
- CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)\r
- CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)\r
- if(NOT HAVE_GENTOO_FFMPEG AND NOT HAVE_FFMPEG_FFMPEG)\r
- if(EXISTS /usr/include/ffmpeg/libavformat/avformat.h OR HAVE_FFMPEG_SWSCALE)\r
- set(HAVE_GENTOO_FFMPEG 1)\r
- endif()\r
- endif()\r
- if(HAVE_FFMPEG_CODEC AND HAVE_FFMPEG_FORMAT AND HAVE_FFMPEG_UTIL)\r
- if(HAVE_FFMPEG_SWSCALE OR NOT HAVE_GENTOO_FFMPEG)\r
- set(HAVE_FFMPEG 1)\r
- endif()\r
- endif()\r
- # Find the bzip2 library because it is required on some systems\r
- FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2)\r
- if(NOT BZIP2_LIBRARIES)\r
- # Do an other trial\r
- FIND_FILE(BZIP2_LIBRARIES NAMES libbz2.so.1 PATHS /lib)\r
- endif()\r
- endif()\r
-\r
- if(WITH_1394)\r
- CHECK_MODULE(libdc1394-2 HAVE_DC1394_2)\r
- if(NOT HAVE_DC1394_2)\r
- CHECK_MODULE(libdc1394 HAVE_DC1394)\r
- endif()\r
- else()\r
- set(HAVE_DC1394_2 FALSE)\r
- set(HAVE_DC1394 FALSE)\r
- endif()\r
-\r
- if(NOT OPENCV_BUILD_3RDPARTY_LIBS)\r
- include(FindZLIB)\r
- if(WITH_PNG)\r
- include(FindPNG)\r
- if(PNG_FOUND)\r
- CHECK_INCLUDE_FILE(${PNG_PNG_INCLUDE_DIR}/png.h HAVE_PNG_H)\r
- CHECK_INCLUDE_FILE(${PNG_PNG_INCLUDE_DIR}/libpng/png.h HAVE_LIBPNG_PNG_H)\r
- endif()\r
- else()\r
- set(PNG_FOUND FALSE)\r
- endif()\r
- if(WITH_TIFF)\r
- include(FindTIFF)\r
- else()\r
- set(TIFF_FOUND FALSE)\r
- endif()\r
- if(WITH_JASPER)\r
- include(FindJasper)\r
- else()\r
- set(JASPER_FOUND FALSE)\r
- endif()\r
- if(WITH_JPEG)\r
- include(FindJPEG)\r
- else()\r
- set(JPEG_FOUND FALSE)\r
- endif()\r
- endif()\r
-\r
- if(NOT APPLE)\r
- CHECK_INCLUDE_FILE(alloca.h HAVE_ALLOCA_H)\r
- CHECK_FUNCTION_EXISTS(alloca HAVE_ALLOCA)\r
- CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)\r
- CHECK_INCLUDE_FILE(pthread.h HAVE_LIBPTHREAD)\r
-\r
- if(WITH_XINE)\r
- CHECK_MODULE(libxine HAVE_XINE)\r
- else()\r
- set(HAVE_XINE FALSE)\r
- endif()\r
- if(WITH_V4L)\r
- CHECK_MODULE(libv4l1 HAVE_LIBV4L)\r
- CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L)\r
- CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2)\r
- else()\r
- set(HAVE_LIBV4L FALSE)\r
- set(HAVE_CAMV4L FALSE)\r
- set(HAVE_CAMV4L2 FALSE)\r
- endif()\r
-\r
- if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" AND NOT ANDROID)\r
- set(OPENCV_LINKER_LIBS m pthread)\r
- elseif(ANDROID)\r
- set(OPENCV_LINKER_LIBS dl m log)\r
- else()\r
- set(OPENCV_LINKER_LIBS dl m pthread rt)\r
- endif()\r
- else()\r
- add_definitions(-DHAVE_ALLOCA -DHAVE_ALLOCA_H -DHAVE_LIBPTHREAD -DHAVE_UNISTD_H)\r
- endif()\r
-endif()\r
-\r
-if(WITH_PNG AND NOT PNG_FOUND)\r
- set(PNG_LIBRARIES libpng)\r
-endif()\r
-\r
-if(WITH_JPEG AND NOT JPEG_FOUND)\r
- set(JPEG_LIBRARIES libjpeg)\r
-endif()\r
-\r
-if(WITH_TIFF AND NOT TIFF_FOUND)\r
- set(TIFF_LIBRARIES libtiff)\r
-endif()\r
-\r
-if(WITH_JASPER AND NOT JASPER_FOUND)\r
- set(JASPER_LIBRARIES libjasper)\r
-endif()\r
-\r
-if (ANDROID)\r
- #android camera support\r
- set(NativeCamera_DIR "${CMAKE_SOURCE_DIR}/android/native-camera/build")\r
- FIND_PACKAGE(NativeCamera QUIET)\r
- if(NativeCamera_FOUND)\r
- set(HAVE_ANDROID_NATIVE_CAMERA TRUE)\r
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${NativeCamera_LIBS})\r
- else()\r
- set(HAVE_ANDROID_NATIVE_CAMERA FALSE)\r
- message(STATUS "Could NOT find NativeCamera for Android")\r
- endif()\r
-endif()\r
-\r
-#message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}")\r
-\r
-if(WITH_OPENEXR)\r
- include(OpenCVFindOpenEXR.cmake)\r
-endif()\r
-\r
-set(BUILD_NEW_PYTHON_SUPPORT ON CACHE BOOL "Build with Python support")\r
-\r
-if(BUILD_NEW_PYTHON_SUPPORT)\r
- find_package(PythonInterp)\r
- find_package(PythonLibs)\r
-\r
- # cmake 2.4 (at least on Ubuntu 8.04 (hardy)) don't define PYTHONLIBS_FOUND\r
- if(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)\r
- set(PYTHONLIBS_FOUND ON)\r
- endif(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)\r
-\r
- execute_process(COMMAND ${PYTHON_EXECUTABLE} --version\r
- ERROR_VARIABLE PYTHON_VERSION_FULL\r
- OUTPUT_STRIP_TRAILING_WHITESPACE)\r
-\r
- string(REGEX MATCH "[0-9].[0-9]" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")\r
- if(UNIX)\r
- set(PYTHON_PLUGIN_INSTALL_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages/opencv)\r
- if(APPLE)\r
- set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages CACHE PATH "Where to install the python packages.")\r
- else() #debian based assumed, install to the dist-packages.\r
- set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/dist-packages CACHE PATH "Where to install the python packages.")\r
- endif()\r
- endif()\r
- if(WIN32)\r
- get_filename_component(PYTHON_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE CACHE)\r
- set(PYTHON_PLUGIN_INSTALL_PATH "${PYTHON_PATH}/Lib/site-packages/opencv")\r
- set(PYTHON_PACKAGES_PATH "${PYTHON_PATH}/Lib/site-packages")\r
- endif()\r
-\r
- # Attempt to discover the NumPy include directory. If this succeeds, build with NumPy\r
-\r
- execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"\r
- RESULT_VARIABLE PYTHON_NUMPY_PROCESS\r
- OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS\r
- OUTPUT_STRIP_TRAILING_WHITESPACE)\r
- if(PYTHON_NUMPY_PROCESS EQUAL 0)\r
- set(PYTHON_USE_NUMPY 1)\r
- add_definitions(-D PYTHON_USE_NUMPY=1)\r
- include_directories(AFTER ${PYTHON_NUMPY_INCLUDE_DIRS})\r
- message(STATUS " Use INCLUDE: ${PYTHON_NUMPY_INCLUDE_DIRS}")\r
- else()\r
- set(PYTHON_USE_NUMPY 0)\r
- endif()\r
- \r
- execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx; print sphinx.__version__"\r
- RESULT_VARIABLE SPHINX_PROCESS\r
- OUTPUT_VARIABLE SPHINX_VERSION\r
- OUTPUT_STRIP_TRAILING_WHITESPACE)\r
- \r
- set(HAVE_SPHINX 0)\r
- if(SPHINX_PROCESS EQUAL 0)\r
- find_program(SPHINX_BUILD sphinx-build)\r
- if(SPHINX_BUILD)\r
- set(HAVE_SPHINX 1)\r
- message(STATUS " Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}")\r
- endif()\r
- endif()\r
-endif()\r
-\r
-#YV\r
-############################### QT ################################\r
-\r
-set(WITH_QT OFF CACHE BOOL "Build with Qt Backend support")\r
-set(WITH_QT_OPENGL OFF CACHE BOOL "Add OpenGL extension to Qt")\r
-\r
-set(HAVE_QT 0)\r
-set(HAVE_QT_OPENGL 0)\r
-\r
-if (WITH_QT)\r
- find_package(Qt4)\r
- if (QT4_FOUND)\r
- set(HAVE_QT 1)\r
- add_definitions(-DHAVE_QT)#We need to define te macro this way, using cvconfig.h.cmake does not work\r
-\r
- find_package (OpenGL QUIET)\r
-\r
-\r
- #if (NOT WIN32)\r
- if (WITH_QT_OPENGL)\r
- if (QT_QTOPENGL_FOUND AND OPENGL_FOUND)\r
- set(HAVE_QT_OPENGL 1)\r
- add_definitions(-DHAVE_QT_OPENGL)\r
- #link_directories("${OPENGL_LIBRARIES}")\r
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${OPENGL_LIBRARIES})\r
- endif()\r
- endif()\r
- #endif()\r
-\r
- endif()\r
-endif()\r
-\r
-############################### TBB ################################\r
-\r
-if (WITH_TBB)\r
- if (UNIX AND NOT APPLE)\r
- PKG_CHECK_MODULES(TBB tbb)\r
- message(STATUS "TBB detected: ${TBBLIB_FOUND}")\r
-\r
- if (TBB_FOUND)\r
- set(HAVE_TBB 1)\r
- if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")\r
- include_directories(${TBB_INCLUDE_DIRS})\r
- endif()\r
- link_directories(${TBB_LIBRARY_DIRS})\r
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES}) \r
- endif()\r
- endif() \r
- \r
- if (NOT HAVE_TBB)\r
- set(TBB_DEFAULT_INCLUDE_DIRS "/opt/intel/tbb" "/usr/local/include" "/usr/include" "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB" "C:/Program Files (x86)/TBB")\r
- \r
- find_path(TBB_INCLUDE_DIR "tbb/tbb.h" PATHS ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")\r
- if (TBB_INCLUDE_DIR)\r
- if (UNIX)\r
- set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")\r
- link_directories("${TBB_LIB_DIR}")\r
- endif()\r
- if (APPLE)\r
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libtbb.dylib)\r
- elseif (UNIX)\r
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)\r
- elseif (WIN32)\r
- if (CMAKE_COMPILER_IS_GNUCXX)\r
- set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")\r
- link_directories("${TBB_LIB_DIR}")\r
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)\r
- else()\r
- get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIR}/../lib" ABSOLUTE) \r
- \r
- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*|x86_64*)\r
- set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")\r
- endif() \r
- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86*|i386*|i686*)\r
- set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32")\r
- endif()\r
-\r
- if (MSVC80)\r
- set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8")\r
- elseif(MSVC90)\r
- set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9") \r
- elseif(MSVC10)\r
- set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10")\r
- endif()\r
- set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")\r
- link_directories("${TBB_LIB_DIR}")\r
- endif()\r
- endif()\r
-\r
- set(HAVE_TBB 1)\r
- if(NOT "${TBB_INCLUDE_DIR}" STREQUAL "")\r
- include_directories("${TBB_INCLUDE_DIR}")\r
- endif()\r
- endif()\r
- endif()\r
-endif(WITH_TBB)\r
-\r
-#Threading Framework -- temporary decision for ARM-s instead of TBB\r
-if (NOT HAVE_TBB)\r
- file(GLOB THREADING_FRAMEWORK_HEADER "${CMAKE_SOURCE_DIR}/modules/core/include/opencv2/core/threading_framework.hpp")\r
- file(GLOB THREADING_FRAMEWORK_SOURCE "${CMAKE_SOURCE_DIR}/modules/core/src/threading_framework.cpp")\r
- if(THREADING_FRAMEWORK_HEADER AND THREADING_FRAMEWORK_SOURCE)\r
- set(HAVE_THREADING_FRAMEWORK 1)\r
- endif()\r
-endif()\r
-\r
-############################ Intel IPP #############################\r
-set(IPP_FOUND)\r
-\r
-if(WITH_IPP)\r
- include(OpenCVFindIPP.cmake)\r
-endif()\r
-\r
-if(IPP_FOUND)\r
- add_definitions(-DHAVE_IPP)\r
- include_directories(${IPP_INCLUDE_DIRS})\r
- link_directories(${IPP_LIBRARY_DIRS})\r
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${IPP_LIBRARIES})\r
-endif()\r
-\r
-\r
-############################### CUDA ################################\r
-\r
-if(WITH_CUDA)\r
- find_package(CUDA 4.0)\r
- \r
- if(CUDA_FOUND)\r
- set(HAVE_CUDA 1)\r
- message(STATUS "CUDA detected: " ${CUDA_VERSION})\r
-\r
- set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")\r
- set(CUDA_ARCH_PTX "1.1 1.3" CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for")\r
- \r
- string(REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}")\r
- string(REGEX REPLACE "\\." "" ARCH_PTX_NO_POINTS "${CUDA_ARCH_PTX}")\r
- \r
- # Ckeck if user specified 1.0 compute capability: we don't support it\r
- string(REGEX MATCH "1.0" HAS_ARCH_10 "${CUDA_ARCH_BIN} ${CUDA_ARCH_PTX}")\r
- set(CUDA_ARCH_BIN_OR_PTX_10 0)\r
- if(NOT ${HAS_ARCH_10} STREQUAL "")\r
- set(CUDA_ARCH_BIN_OR_PTX_10 1)\r
- endif()\r
- \r
- # NVCC flags to be set\r
- set(NVCC_FLAGS_EXTRA "") \r
- \r
- # These vars will be passed into the templates\r
- set(OPENCV_CUDA_ARCH_BIN "") \r
- set(OPENCV_CUDA_ARCH_PTX "") \r
- set(OPENCV_CUDA_ARCH_FEATURES "") \r
- \r
- # Tell NVCC to add binaries for the specified GPUs\r
- string(REGEX MATCHALL "[0-9()]+" ARCH_LIST "${ARCH_BIN_NO_POINTS}")\r
- foreach(ARCH IN LISTS ARCH_LIST)\r
- if (ARCH MATCHES "([0-9]+)\\(([0-9]+)\\)")\r
- # User explicitly specified PTX for the concrete BIN\r
- set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1})\r
- set(OPENCV_CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN} ${CMAKE_MATCH_1}")\r
- set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${CMAKE_MATCH_2}")\r
- else()\r
- # User didn't explicitly specify PTX for the concrete BIN, we assume PTX=BIN \r
- set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=sm_${ARCH})\r
- set(OPENCV_CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN} ${ARCH}")\r
- set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}")\r
- endif()\r
- endforeach()\r
- \r
- # Tell NVCC to add PTX intermediate code for the specified architectures\r
- string(REGEX MATCHALL "[0-9]+" ARCH_LIST "${ARCH_PTX_NO_POINTS}")\r
- foreach(ARCH IN LISTS ARCH_LIST)\r
- set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=compute_${ARCH})\r
- set(OPENCV_CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX} ${ARCH}")\r
- set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}")\r
- endforeach()\r
- \r
- # These vars will be processed in other scripts\r
- set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${NVCC_FLAGS_EXTRA}) \r
- set(OpenCV_CUDA_CC "${NVCC_FLAGS_EXTRA}")\r
- \r
- message(STATUS "CUDA NVCC flags: ${CUDA_NVCC_FLAGS}")\r
- else()\r
- unset(CUDA_ARCH_BIN CACHE)\r
- unset(CUDA_ARCH_PTX CACHE) \r
- endif() \r
-endif()\r
-\r
-\r
-############################### VideoInput ################################\r
-\r
-if (WIN32 AND WITH_VIDEOINPUT)\r
- if(CMAKE_CXX_COMPILER MATCHES "dw2")\r
- else()\r
- if(NOT MINGW64)\r
- set(HAVE_VIDEOINPUT 1)\r
- endif()\r
- endif()\r
-endif()\r
-\r
-############################### OpenNI ################################\r
-set(HAVE_OPENNI FALSE)\r
-set(HAVE_OPENNI_PRIME_SENSOR_MODULE FALSE)\r
-\r
-if(WITH_OPENNI)\r
- include(OpenCVFindOpenNI.cmake)\r
-endif()\r
-\r
-############################## Eigen ##############################\r
-\r
-if(WITH_EIGEN)\r
- find_path(EIGEN_INCLUDE_PATH "Eigen/Core"\r
- PATHS "/usr/local/include/eigen2" "/opt/include/eigen2" "/usr/include/eigen2"\r
- "/usr/local/include/eigen3" "/opt/include/eigen3" "/usr/include/eigen3"\r
- DOC "The path to Eigen2/Eigen3 headers")\r
- if(EIGEN_INCLUDE_PATH)\r
- include_directories(${EIGEN_INCLUDE_PATH})\r
- set(HAVE_EIGEN 1)\r
- endif()\r
-endif()\r
-\r
-\r
-################## Extra HighGUI libs on Windows ###################\r
-\r
-if(WIN32)\r
- set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} comctl32 gdi32 ole32)\r
- \r
- if (MSVC)\r
- set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32)\r
- if (NOT BUILD_SHARED_LIBS)\r
- if (MSVC64)\r
- if(HAVE_VIDEOINPUT)\r
- set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${CMAKE_SOURCE_DIR}/3rdparty/lib/videoInput64.lib strmiids)\r
- endif()\r
- elseif (MSVC)\r
- if(HAVE_VIDEOINPUT)\r
- set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${CMAKE_SOURCE_DIR}/3rdparty/lib/videoInput.lib strmiids)\r
- endif()\r
- endif()\r
- endif()\r
- endif()\r
-\r
- if(MINGW)\r
- if(MINGW64)\r
- set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} msvfw32 avifil32 avicap32 winmm)\r
- if(HAVE_VIDEOINPUT)\r
- set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} videoInput64 strmiids)\r
- endif()\r
- else()\r
- set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32 winmm)\r
- if(HAVE_VIDEOINPUT)\r
- set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} videoInput strmiids)\r
- endif()\r
- endif() \r
- endif()\r
-endif()\r
-\r
-\r
-\r
-################## Reference Manual ##################\r
-set(BUILD_DOCS ON CACHE BOOL "Build OpenCV Reference Manual")\r
-\r
-\r
-################### DOXYGEN ###############\r
-\r
-#find_package(Doxygen)\r
-#\r
-#if(DOXYGEN_FOUND)\r
-# set(BUILD_DOXYGEN_DOCS ON CACHE BOOL "Generate HTML docs using Doxygen")\r
-#endif()\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# UPDATE CONFIG FILES & SCRIPTS:\r
-#\r
-# CONFIGURE_FILE(InputFile OutputFile [COPYONLY] [ESCAPE_QUOTES] [@ONLY])\r
-# If @ONLY is specified, only variables of the form @VAR@ will be\r
-# replaces and ${VAR} will be ignored.\r
-#\r
-# A directory will be created for each platform so the "cvconfig.h" file is\r
-# not overwritten if cmake generates code in the same path.\r
-# ----------------------------------------------------------------------------\r
-add_definitions(-DHAVE_CVCONFIG_H)\r
-\r
-set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")\r
-\r
-message(STATUS "Parsing 'cvconfig.h.cmake'")\r
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")\r
-\r
-\r
-# ---------------------------------------------------------------------------\r
-# The C+//0 include & link directories:\r
-# ---------------------------------------------------------------------------\r
-include_directories("."\r
- "${OPENCV_CONFIG_FILE_INCLUDE_DIR}"\r
- "${CMAKE_CURRENT_SOURCE_DIR}/include"\r
- "${CMAKE_CURRENT_SOURCE_DIR}/include/opencv"\r
- )\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# Set the maximum level of warnings:\r
-# ----------------------------------------------------------------------------\r
-# Should be set to true for development\r
-set(OPENCV_WARNINGS_ARE_ERRORS OFF CACHE BOOL "Treat warnings as errors")\r
-\r
-set(EXTRA_C_FLAGS "")\r
-set(EXTRA_C_FLAGS_RELEASE "")\r
-set(EXTRA_C_FLAGS_DEBUG "")\r
-set(EXTRA_EXE_LINKER_FLAGS "")\r
-set(EXTRA_EXE_LINKER_FLAGS_RELEASE "")\r
-set(EXTRA_EXE_LINKER_FLAGS_DEBUG "")\r
-\r
-if(MSVC)\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")\r
- # 64-bit portability warnings, in MSVC8\r
- if(MSVC80)\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Wp64")\r
-\r
- endif()\r
- #if(MSVC90)\r
- # set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _BIND_TO_CURRENT_CRT_VERSION=1 /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")\r
- #endif()\r
-\r
- set(EXTRA_EXE_LINKER_FLAGS_RELEASE "${EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")\r
-\r
- #if(ENABLE_OPENMP)\r
- # set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /openmp")\r
- #endif()\r
-\r
- # Remove unreferenced functions: function level linking\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Gy")\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Zi")\r
-endif()\r
-\r
-if(CMAKE_COMPILER_IS_GNUCXX)\r
-\r
- # High level of warnings.\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")\r
-\r
- # The -Wno-long-long is required in 64bit systems when including sytem headers.\r
- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")\r
- endif()\r
- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")\r
- endif()\r
-\r
- # We need pthread's\r
- if(UNIX)\r
- if(NOT ANDROID)\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -pthread")\r
- endif()\r
- endif()\r
-\r
- if(OPENCV_WARNINGS_ARE_ERRORS)\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")\r
- endif()\r
-\r
- if(X86)\r
- if(NOT MINGW64)\r
- if(NOT X86_64)\r
- if(NOT APPLE)\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -march=i686")\r
- endif()\r
- endif()\r
- endif()\r
- endif()\r
-\r
- # Other optimizations\r
- if(USE_OMIT_FRAME_POINTER)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer")\r
- endif()\r
- if(USE_O2)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2")\r
- endif()\r
- if(USE_O3)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O3")\r
- endif()\r
- if(USE_FAST_MATH)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math")\r
- endif()\r
- if(ENABLE_POWERPC)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5")\r
- endif()\r
- if(ENABLE_SSE)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse")\r
- endif()\r
- if(ENABLE_SSE2)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse2")\r
- endif()\r
- # SSE3 and further should be disabled under MingW because it generates compiler errors\r
- if(NOT MINGW)\r
- if(ENABLE_SSE3)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse3")\r
- endif()\r
- \r
- if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 402)\r
- set(HAVE_GCC43_OR_NEWER 1)\r
- endif()\r
- if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 401)\r
- set(HAVE_GCC42_OR_NEWER 1)\r
- endif()\r
- \r
- if(HAVE_GCC43_OR_NEWER OR APPLE)\r
- if(ENABLE_SSSE3)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mssse3")\r
- endif()\r
- if(HAVE_GCC42_OR_NEWER)\r
- if(ENABLE_SSE41)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse4.1")\r
- endif()\r
- if(ENABLE_SSE42)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse4.2")\r
- endif()\r
- endif()\r
- endif()\r
- endif()\r
-\r
- if(X86 OR X86_64)\r
- if(NOT APPLE)\r
- if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mfpmath=387")\r
- endif()\r
- endif()\r
- endif()\r
-\r
- # Profiling?\r
- if(ENABLE_PROFILING)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -pg -g")\r
- else()\r
- # Remove unreferenced functions: function level linking\r
- if(NOT APPLE)\r
- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections")\r
- endif()\r
- endif()\r
-\r
- # Parallel mode\r
- #if(ENABLE_OPENMP)\r
- # set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -D_GLIBCXX_PARALLEL -fopenmp")\r
- # set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} gomp)\r
- #endif()\r
-\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG")\r
- set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0 -ggdb3 -DDEBUG -D_DEBUG")\r
-\r
-endif()\r
-\r
-if(MSVC)\r
- if(ENABLE_SSE)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE")\r
- endif()\r
- if(ENABLE_SSE2)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE2")\r
- endif()\r
- if(ENABLE_SSE3)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE3")\r
- endif()\r
- if(ENABLE_SSE4_1)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE4.1")\r
- endif()\r
- if (ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1)\r
- set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Oi")\r
- endif()\r
-endif()\r
-\r
-# Extra link libs if the user selects building static libs:\r
-IF(NOT BUILD_SHARED_LIBS)\r
- if(CMAKE_COMPILER_IS_GNUCXX)\r
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++)\r
- endif()\r
-endif()\r
-\r
-\r
-# Add user supplied extra options (optimization, etc...)\r
-# ==========================================================\r
-set(OPENCV_EXTRA_C_FLAGS "" CACHE STRING "Extra compiler options")\r
-set(OPENCV_EXTRA_C_FLAGS_RELEASE "" CACHE STRING "Extra compiler options for Release build")\r
-set(OPENCV_EXTRA_C_FLAGS_DEBUG "" CACHE STRING "Extra compiler options for Debug build")\r
-set(OPENCV_EXTRA_EXE_LINKER_FLAGS "" CACHE STRING "Extra linker flags" FORCE)\r
-set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING "Extra linker flags for Release build" FORCE)\r
-set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "" CACHE STRING "Extra linker flags for Debug build" FORCE)\r
-\r
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")\r
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")\r
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE} ${OPENCV_EXTRA_C_FLAGS_RELEASE}")\r
-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE} ${OPENCV_EXTRA_C_FLAGS_RELEASE}")\r
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG} ${OPENCV_EXTRA_C_FLAGS_DEBUG}")\r
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG} ${OPENCV_EXTRA_C_FLAGS_DEBUG}")\r
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_EXE_LINKER_FLAGS} ${OPENCV_EXTRA_EXE_LINKER_FLAGS}")\r
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${EXTRA_EXE_LINKER_FLAGS_RELEASE} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}")\r
-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${EXTRA_EXE_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}")\r
-\r
-# In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release:\r
-if (${CMAKE_GENERATOR} MATCHES ".*Makefiles")\r
- if("${CMAKE_BUILD_TYPE}" STREQUAL "")\r
- set(CMAKE_BUILD_TYPE Release)\r
- endif()\r
-endif()\r
-\r
-if (WIN32 AND MSVC)\r
- # avoid warnings from MSVC about overriding the /W* option\r
- # we replace /W3 with /W4 only for C++ files,\r
- # since all the 3rd-party libraries OpenCV uses are in C,\r
- # and we do not care about their warnings.\r
- string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")\r
- string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")\r
- string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")\r
-\r
- # allow extern "C" functions throw exceptions\r
- string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")\r
- string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")\r
- string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")\r
- string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")\r
- string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")\r
- string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")\r
-\r
- string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")\r
- string(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")\r
-endif()\r
-\r
-if("${CMAKE_CONFIGURE_LDFLAGS}")\r
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_CONFIGURE_LDFLAGS}")\r
-endif("${CMAKE_CONFIGURE_LDFLAGS}")\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# PROCESS SUBDIRECTORIES:\r
-# ----------------------------------------------------------------------------\r
-# Save libs and executables in the same place\r
-set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )\r
-set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )\r
-\r
-if(WIN32)\r
-set(OPENCV_DOC_INSTALL_PATH doc)\r
-else()\r
-set(OPENCV_DOC_INSTALL_PATH share/opencv/doc)\r
-endif()\r
-\r
-\r
-# --------------------------------------------------------------------------------------------\r
-# Installation for CMake Module: OpenCVConfig.cmake\r
-# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"\r
-# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use with "make install"\r
-# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages\r
-# -------------------------------------------------------------------------------------------\r
-\r
-# -------------------------------------------------------------------------------------------\r
-# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"\r
-# -------------------------------------------------------------------------------------------\r
-\r
-# Name of libraries is: libcv.so.1.1.0, etc...\r
-# OPENCV_DLLVERSION must be set to "110", etc..\r
-# Already done above.\r
-\r
-# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:\r
-set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${CMAKE_CURRENT_SOURCE_DIR}/include\" \"${CMAKE_CURRENT_SOURCE_DIR}/include/opencv\"")\r
-set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"${CMAKE_CURRENT_SOURCE_DIR}\"")\r
-\r
-set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}")\r
-\r
-if( HAVE_ANDROID_NATIVE_CAMERA )\r
- set(CMAKE_LIB_DIRS_CONFIGCMAKE ${CMAKE_LIB_DIRS_CONFIGCMAKE} ${NativeCamera_LIB_DIR})\r
-endif()\r
-\r
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY)\r
-\r
-# --------------------------------------------------------------------------------------------\r
-# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"\r
-# -------------------------------------------------------------------------------------------\r
-# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:\r
-\r
-set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/include/opencv" "${CMAKE_INSTALL_PREFIX}/include")\r
-set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\"")\r
-\r
-set(CMAKE_LIB_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/lib")\r
-\r
-exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/unix-install/\"" OUTPUT_VARIABLE RET_VAL)\r
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)\r
-\r
-if(UNIX)\r
- # For a command "FIND_PACKAGE(FOO)", CMake will look at the directory /usr/share|lib/FOO/FOOConfig.cmake, so:\r
- install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION share/opencv/)\r
-endif()\r
-\r
-# --------------------------------------------------------------------------------------------\r
-# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages\r
-# -------------------------------------------------------------------------------------------\r
-if(WIN32)\r
- # Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:\r
- # support for 3rdparty libraries.\r
- # This will expand to, for example, <program files>/OpenCV 1.1.0/include\r
- set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/include\" \r
- \"\${THIS_OPENCV_CONFIG_PATH}/include/opencv\" \r
- \"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/include\"")\r
-\r
- set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}\"")\r
-\r
- # This will expand to, for example, <program files>/OpenCV 1.1.0/lib\r
- # support for 3rdparty libraries.\r
- set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/lib\" \r
- \"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/lib\"")\r
-\r
- #exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/win-install/\"")\r
- exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL)\r
- configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)\r
- # Install the OpenCVConfig.cmake file which has the right paths pointing to the install directory \r
- install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/") \r
-\r
- # if videoInput support is enabled (which is by default on WIN32) copy the static library required to the installation path\r
- # DESTINATION could also be "${CMAKE_INSTALL_PREFIX}/lib") to simplify dev environment setup of client applications\r
- IF(HAVE_VIDEOINPUT)\r
- install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/videoInput.lib" "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/videoInput64.lib"\r
- DESTINATION "${CMAKE_INSTALL_PREFIX}/3rdparty/lib")\r
-\r
- install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include/videoInput.h" DESTINATION "${CMAKE_INSTALL_PREFIX}/3rdparty/include")\r
- ENDIF()\r
-\r
- # Add the OpenCV configuration header to the install path\r
- # Useful for instance if a client application checks against the features OpenCV has been compiled with\r
- install(FILES "${CMAKE_BINARY_DIR}/cvconfig.h" DESTINATION "${CMAKE_INSTALL_PREFIX}/include")\r
-endif()\r
-\r
-\r
-# --------------------------------------------------------------------------------------------\r
-# Part 2/2: ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install"\r
-# prefix=/usr\r
-# exec_prefix=${prefix}\r
-# libdir=${exec_prefix}/lib\r
-# includedir=${prefix}/include/opencv\r
-# -------------------------------------------------------------------------------------------\r
-set(prefix ${CMAKE_INSTALL_PREFIX})\r
-set(exec_prefix "\${prefix}")\r
-set(libdir "\${exec_prefix}/lib")\r
-set(includedir "\${prefix}/include")\r
-set(VERSION ${OPENCV_VERSION})\r
-\r
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/opencv.pc" @ONLY IMMEDIATE)\r
-\r
-if(UNIX)\r
- install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION lib/pkgconfig)\r
-endif()\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# Uninstall target, for "make uninstall"\r
-# ----------------------------------------------------------------------------\r
-CONFIGURE_FILE(\r
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"\r
- "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"\r
- IMMEDIATE @ONLY)\r
-\r
-ADD_CUSTOM_TARGET(uninstall\r
- "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# CPack target\r
-# ----------------------------------------------------------------------------\r
-\r
-set(BUILD_PACKAGE OFF CACHE BOOL "Build a installer with the SDK")\r
-\r
-if(BUILD_PACKAGE)\r
-\r
- configure_file(\r
- Package.cmake.in\r
- ${CMAKE_BINARY_DIR}/.cpack/Package.cmake\r
- @ONLY\r
- )\r
-\r
- include(${CMAKE_BINARY_DIR}/.cpack/Package.cmake)\r
-\r
- set(root_files README)\r
-\r
- file(GLOB root_src_files *.in *.cmake CMakeLists.txt)\r
-\r
- if (NOT WIN32)\r
- install(FILES ${root_files}\r
- DESTINATION ${OPENCV_DOC_INSTALL_PATH}\r
- COMPONENT main)\r
- else()\r
- install(FILES ${root_files}\r
- DESTINATION "."\r
- COMPONENT main)\r
- install(FILES ${root_src_files}\r
- DESTINATION "."\r
- COMPONENT src)\r
- # Add the "win-install/OpenCVConfig.cmake" file to the "main" install component\r
- install(FILES\r
- "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake"\r
- DESTINATION "."\r
- COMPONENT main\r
- )\r
- install(FILES\r
- "include/CMakeLists.txt"\r
- DESTINATION "include/"\r
- COMPONENT src\r
- )\r
-\r
- if(CMAKE_INSTALL_DEBUG_LIBRARIES)\r
- foreach(m calib3d core contrib features2d ffmpeg flann gpu highgui imgproc legacy ml objdetect video)\r
- install(FILES ${EXECUTABLE_OUTPUT_PATH}/Debug/opencv_${m}${OPENCV_DLLVERSION}d.dll\r
- DESTINATION bin COMPONENT main)\r
- install(FILES ${LIBRARY_OUTPUT_PATH}/Debug/opencv_${m}${OPENCV_DLLVERSION}d.lib\r
- DESTINATION lib COMPONENT main)\r
- endforeach()\r
- endif()\r
-\r
- install(DIRECTORY data samples DESTINATION "." COMPONENT main PATTERN ".svn" EXCLUDE)\r
- install(DIRECTORY 3rdparty android modules tests DESTINATION "." COMPONENT src PATTERN ".svn" EXCLUDE)\r
- #install(DIRECTORY doc/ DESTINATION doc COMPONENT src FILES_MATCHING PATTERN "*.tex")\r
- #install(DIRECTORY doc/pics DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)\r
- #install(DIRECTORY doc/latex2sphinx DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)\r
-\r
- endif()\r
-endif()\r
-\r
-\r
-#-----------------------------------\r
-# Solution folders:\r
-#-----------------------------------\r
-\r
-if(${CMAKE_VERSION} VERSION_GREATER "2.8.0")\r
- set(ENABLE_SOLUTION_FOLDERS OFF CACHE BOOL "Solution folder in Visual Studio or in other IDEs")\r
-endif()\r
-\r
-if(ENABLE_SOLUTION_FOLDERS)\r
- set_property(GLOBAL PROPERTY USE_FOLDERS ON)\r
- set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")\r
-endif()\r
-\r
-#-----------------------------------\r
-# Subdirectories:\r
-#-----------------------------------\r
-add_subdirectory(include)\r
-add_subdirectory(modules)\r
-\r
-if(BUILD_DOCS)\r
- include(OpenCVFindLATEX.cmake REQUIRED)\r
-\r
- if(PDFLATEX_COMPILER)\r
- message(STATUS "PDF LaTeX found!")\r
- endif()\r
-endif()\r
-\r
-add_subdirectory(doc)\r
-add_subdirectory(data)\r
-\r
-if(BUILD_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)\r
- add_subdirectory(samples)\r
-endif()\r
-\r
-#if(BUILD_TESTS)\r
-# enable_testing()\r
-# add_subdirectory(tests)\r
-#endif()\r
-\r
-add_subdirectory(3rdparty)\r
-\r
-\r
-# ----------------------------------------------------------------------------\r
-# Summary:\r
-# ----------------------------------------------------------------------------\r
-message(STATUS "")\r
-message(STATUS "General configuration for opencv ${OPENCV_VERSION} =====================================")\r
-message(STATUS "")\r
-message(STATUS " Built as dynamic libs?: ${BUILD_SHARED_LIBS}")\r
-message(STATUS " Compiler: ${CMAKE_COMPILER}")\r
-message(STATUS " C++ flags (Release): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")\r
-message(STATUS " C++ flags (Debug): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")\r
-if(WIN32)\r
-message(STATUS " Linker flags (Release): ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")\r
-message(STATUS " Linker flags (Debug): ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")\r
-else()\r
-message(STATUS " Linker flags (Release): ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")\r
-message(STATUS " Linker flags (Debug): ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")\r
-endif()\r
-\r
-#YV\r
-message(STATUS "")\r
-message(STATUS " GUI: ")\r
-\r
-if (HAVE_QT)\r
- message(STATUS " QT 4.x: ${HAVE_QT}")\r
- message(STATUS " QT OpenGL support: ${HAVE_QT_OPENGL}")\r
-else()\r
- if(WIN32)\r
- message(STATUS " Win32 UI: YES")\r
- else()\r
- if(APPLE)\r
- if(WITH_CARBON)\r
- message(STATUS " Carbon: YES")\r
- else()\r
- message(STATUS " Cocoa: YES")\r
- endif()\r
- else()\r
- message(STATUS " GTK+ 2.x: ${HAVE_GTK}")\r
- message(STATUS " GThread: ${HAVE_GTHREAD}")\r
- endif()\r
- endif()\r
-endif()\r
-\r
-message(STATUS "")\r
-message(STATUS " Media I/O: ")\r
-if(ZLIB_FOUND)\r
-message(STATUS " ZLib: ${ZLIB_FOUND}")\r
-else()\r
-message(STATUS " ZLib: build")\r
-endif()\r
-\r
-if(NOT WITH_JPEG OR JPEG_FOUND)\r
-message(STATUS " JPEG: ${JPEG_FOUND}")\r
-else()\r
-message(STATUS " JPEG: build")\r
-endif()\r
-\r
-if(NOT WITH_PNG OR PNG_FOUND)\r
-message(STATUS " PNG: ${PNG_FOUND}")\r
-else()\r
-message(STATUS " PNG: build")\r
-endif()\r
-\r
-if(NOT WITH_TIFF OR TIFF_FOUND)\r
-message(STATUS " TIFF: ${TIFF_FOUND}")\r
-else()\r
-message(STATUS " TIFF: build")\r
-endif()\r
-\r
-if(NOT WITH_JASPER OR JASPER_FOUND)\r
-message(STATUS " JPEG 2000: ${JASPER_FOUND}")\r
-else()\r
-message(STATUS " JPEG 2000: build")\r
-endif()\r
-\r
-if(WITH_OPENEXR AND OPENEXR_FOUND)\r
-message(STATUS " OpenEXR: YES")\r
-else()\r
-message(STATUS " OpenEXR: NO")\r
-endif()\r
-\r
-if(NOT HAVE_OPENNI OR HAVE_OPENNI_PRIME_SENSOR_MODULE)\r
-message(STATUS " OpenNI: ${HAVE_OPENNI}")\r
-else()\r
-message(STATUS " OpenNI: ${HAVE_OPENNI} (WARNING: PrimeSensor Modules for OpenNI are not installed (not found in OPENNI_PRIME_SENSOR_MODULE_BIN_DIR).)")\r
-endif()\r
-\r
-if(UNIX AND NOT APPLE)\r
-message(STATUS "")\r
-message(STATUS " Video I/O: ")\r
-message(STATUS " DC1394 1.x: ${HAVE_DC1394}")\r
-message(STATUS " DC1394 2.x: ${HAVE_DC1394_2}")\r
-message(STATUS " FFMPEG: ${HAVE_FFMPEG}")\r
-message(STATUS " codec: ${HAVE_FFMPEG_CODEC}")\r
-message(STATUS " format: ${HAVE_FFMPEG_FORMAT}")\r
-message(STATUS " util: ${HAVE_FFMPEG_UTIL}")\r
-message(STATUS " swscale: ${HAVE_FFMPEG_SWSCALE}")\r
-message(STATUS " gentoo-style: ${HAVE_GENTOO_FFMPEG}")\r
-message(STATUS " GStreamer: ${HAVE_GSTREAMER}")\r
-message(STATUS " UniCap: ${HAVE_UNICAP}")\r
-message(STATUS " PvAPI: ${HAVE_PVAPI}")\r
-if(HAVE_LIBV4L)\r
-message(STATUS " V4L/V4L2: Using libv4l")\r
-else()\r
-message(STATUS " V4L/V4L2: ${HAVE_CAMV4L}/${HAVE_CAMV4L2}")\r
-endif()\r
-message(STATUS " Xine: ${HAVE_XINE}")\r
-if(ANDROID)\r
-message(STATUS " AndroidNativeCamera: ${HAVE_ANDROID_NATIVE_CAMERA}")\r
-endif()\r
-endif() #if(UNIX AND NOT APPLE)\r
-\r
-if(APPLE)\r
-message(STATUS "")\r
-if(WITH_QUICKTIME)\r
-message(STATUS " Video I/O: QuickTime")\r
-else()\r
-message(STATUS " Video I/O: QTKit")\r
-endif()\r
-endif()\r
-\r
-if(WIN32)\r
-message(STATUS "")\r
-message(STATUS " Video I/O: ")\r
-if(HAVE_VIDEOINPUT)\r
-message(STATUS " VideoInput: YES")\r
-else()\r
-message(STATUS " VideoInput: NO")\r
-endif()\r
-endif()\r
-\r
-message(STATUS "")\r
-message(STATUS " Interfaces: ")\r
-message(STATUS " Python: ${BUILD_NEW_PYTHON_SUPPORT}")\r
-message(STATUS " Python interpreter: ${PYTHON_EXECUTABLE}")\r
-if (PYTHON_USE_NUMPY)\r
-message(STATUS " Python numpy: YES")\r
-else()\r
-message(STATUS " Python numpy: NO (Python interface will not cover OpenCV 2.x API)")\r
-endif()\r
-\r
-if(WITH_IPP AND IPP_FOUND)\r
-message(STATUS " Use IPP: ${IPP_LATEST_VERSION_STR} [${IPP_LATEST_VERSION_MAJOR}.${IPP_LATEST_VERSION_MINOR}.${IPP_LATEST_VERSION_BUILD}]")\r
-message(STATUS " at: ${IPP_ROOT_DIR}")\r
-elseif(WITH_IPP AND NOT IPP_FOUND)\r
-message(STATUS " Use IPP: IPP not found")\r
-else()\r
-message(STATUS " Use IPP: NO")\r
-endif()\r
-\r
-if(HAVE_TBB)\r
-message(STATUS " Use TBB: YES")\r
-else()\r
-message(STATUS " Use TBB: NO")\r
-if(HAVE_THREADING_FRAMEWORK)\r
-message(STATUS " Use ThreadingFramework: YES")\r
-else()\r
-message(STATUS " Use ThreadingFramework: NO")\r
-endif()\r
-endif()\r
-\r
-if (HAVE_CUDA)\r
-message(STATUS " Use Cuda: YES")\r
-else()\r
-message(STATUS " Use Cuda: NO")\r
-endif()\r
-\r
-if(HAVE_EIGEN)\r
-message(STATUS " Use Eigen: YES")\r
-else()\r
-message(STATUS " Use Eigen: NO")\r
-endif()\r
-\r
-message(STATUS "")\r
-message(STATUS " Documentation: ")\r
-\r
-if(BUILD_DOCS AND PDFLATEX_COMPILER AND HAVE_SPHINX)\r
-message(STATUS " Build Documentation: YES")\r
-else()\r
-message(STATUS " Build Documentation: NO")\r
-endif()\r
-\r
-#if(BUILD_DOXYGEN_DOCS AND DOXYGEN_FOUND)\r
-#message(STATUS " Doxygen HTMLs YES")\r
-#else()\r
-#message(STATUS " Doxygen HTMLs NO")\r
-#endif()\r
-\r
-message(STATUS "")\r
-message(STATUS " Install path: ${CMAKE_INSTALL_PREFIX}")\r
-message(STATUS "")\r
-message(STATUS " cvconfig.h is in: ${OPENCV_CONFIG_FILE_INCLUDE_DIR}")\r
-message(STATUS "-----------------------------------------------------------------")\r
-message(STATUS "")\r
-\r
-#----------------------------------------------------------------------------\r
-# Generate the OpenCVConfig.cmake file for unix\r
-# installation in CMAKE_INSTALL_PREFIX\r
-#----------------------------------------------------------------------------\r
+# ----------------------------------------------------------------------------
+# Root CMake file for OpenCV
+#
+# From the off-tree build directory, invoke:
+# $ cmake <PATH_TO_OPENCV_ROOT>
+#
+#
+# - OCT-2008: Initial version <joseluisblancoc@gmail.com>
+#
+# ----------------------------------------------------------------------------
+
+set(OPENCV_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+
+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+
+# Add these standard paths to the search paths for FIND_LIBRARY
+# to find libraries from these locations first
+if(UNIX)
+ set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib /usr/lib)
+endif()
+
+
+# it _must_ go before PROJECT(OpenCV) in order to work
+if(WIN32)
+ set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
+else()
+ set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory")
+endif()
+
+set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
+set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
+set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
+set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
+set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
+set(CMAKE_VERBOSE OFF CACHE BOOL "Verbose mode")
+
+if(CMAKE_VERBOSE)
+ set(CMAKE_VERBOSE_MAKEFILE 1)
+endif()
+
+
+project(OpenCV)
+
+
+cmake_minimum_required(VERSION 2.4)
+
+
+if(MSVC)
+ set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
+endif()
+
+
+# --------------------------------------------------------------
+# 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()
+
+
+# ----------------------------------------------------------------------------
+# Current version number:
+# ----------------------------------------------------------------------------
+set(OPENCV_VERSION "2.2.9")
+
+string(REGEX MATCHALL "[0-9]" OPENCV_VERSION_PARTS "${OPENCV_VERSION}")
+
+list(GET OPENCV_VERSION_PARTS 0 OPENCV_VERSION_MAJOR)
+list(GET OPENCV_VERSION_PARTS 1 OPENCV_VERSION_MINOR)
+list(GET OPENCV_VERSION_PARTS 2 OPENCV_VERSION_PATCH)
+
+set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
+
+if(WIN32)
+ # Postfix of DLLs:
+ set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
+ set(OPENCV_DEBUG_POSTFIX d)
+else()
+ # Postfix of so's:
+ #set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
+ set(OPENCV_DLLVERSION "")
+ set(OPENCV_DEBUG_POSTFIX)
+endif()
+
+
+# ----------------------------------------------------------------------------
+# Build static or dynamic libs?
+# Default: dynamic libraries:
+# ----------------------------------------------------------------------------
+set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
+
+# ----------------------------------------------------------------------------
+# Use statically or dynamically linked CRT?
+# Default: dynamic
+# ----------------------------------------------------------------------------
+if(MSVC AND NOT BUILD_SHARED_LIBS)
+ option (BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT" OFF)
+endif()
+
+if(MSVC)
+ if(BUILD_WITH_STATIC_CRT)
+ foreach(flag_var
+ CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+ CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ if(${flag_var} MATCHES "/MD")
+ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+ endif(${flag_var} MATCHES "/MD")
+
+ if(${flag_var} MATCHES "/MDd")
+ string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
+ endif(${flag_var} MATCHES "/MDd")
+ endforeach(flag_var)
+
+ 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_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmtd.lib")
+
+ else(BUILD_WITH_STATIC_CRT)
+ foreach(flag_var
+ CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+ CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ if(${flag_var} MATCHES "/MT")
+ string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
+ endif(${flag_var} MATCHES "/MT")
+
+ if(${flag_var} MATCHES "/MTd")
+ string(REGEX REPLACE "/MTd" "/MDd" ${flag_var} "${${flag_var}}")
+ endif(${flag_var} MATCHES "/MTd")
+ endforeach(flag_var)
+
+ endif(BUILD_WITH_STATIC_CRT)
+endif(MSVC)
+
+
+
+# ----------------------------------------------------------------------------
+# Variables for cvconfig.h.cmake
+# ----------------------------------------------------------------------------
+set(PACKAGE "opencv")
+set(PACKAGE_BUGREPORT "opencvlibrary-devel@lists.sourceforge.net")
+set(PACKAGE_NAME "opencv")
+set(PACKAGE_STRING "${PACKAGE} ${OPENCV_VERSION}")
+set(PACKAGE_TARNAME "${PACKAGE}")
+set(PACKAGE_VERSION "${OPENCV_VERSION}")
+
+
+# ----------------------------------------------------------------------------
+# Autodetect if we are in a SVN repository
+# ----------------------------------------------------------------------------
+find_program(SVNVERSION_PATH svnversion)
+mark_as_advanced(force SVNVERSION_PATH)
+if(SVNVERSION_PATH)
+ message(STATUS "Extracting svn version, please wait...")
+ execute_process(COMMAND ${SVNVERSION_PATH} -n ${OPENCV_SOURCE_DIR} OUTPUT_VARIABLE SVNVERSION_RESULT)
+
+ if(SVNVERSION_RESULT MATCHES "exported")
+ # This is NOT a svn repository:
+ set(OPENCV_SVNVERSION "")
+ else()
+ set(OPENCV_SVNVERSION " svn:${SVNVERSION_RESULT}")
+ endif()
+
+ message(STATUS "SVNVERSION: ${OPENCV_SVNVERSION}")
+else()
+ # We don't have svnversion:
+ set(OPENCV_SVNVERSION "")
+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)
+
+ # 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..
+# ----------------------------------------------------------------------------
+
+# Build/install (or not) some apps:
+# ===================================================
+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")
+
+# Build tests:
+# ===================================================
+set(BUILD_TESTS ON CACHE BOOL "Build tests")
+
+# Build 3rdparty libraries under unix
+# ===================================================
+if(WIN32)
+ set(OPENCV_BUILD_3RDPARTY_LIBS TRUE CACHE BOOL "Build 3rd party libraries")
+else()
+ set(OPENCV_BUILD_3RDPARTY_LIBS FALSE CACHE BOOL "Build 3rd party libraries")
+endif()
+
+include(OpenCVPCHSupport.cmake REQUIRED)
+include(OpenCVModule.cmake REQUIRED)
+
+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()
+
+if(UNIX)
+ include(OpenCVFindPkgConfig.cmake OPTIONAL)
+ include(CheckFunctionExists)
+ include(CheckIncludeFile)
+endif()
+
+#if(MSVC)
+# set(DEFAULT_ENABLE_OPENMP ON)
+#else()
+# set(DEFAULT_ENABLE_OPENMP OFF)
+#endif()
+#set(ENABLE_OPENMP ${DEFAULT_ENABLE_OPENMP} CACHE BOOL "")
+
+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(USE_O3 ON CACHE BOOL "Enable -O3 for GCC")
+ 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
+ set(USE_O3 ON CACHE BOOL "Enable -O3")
+ set(USE_FAST_MATH ON CACHE BOOL "Enable -ffast-math")
+ 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
+# ====================================================================
+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()
+
+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()
+
+set(WITH_TBB OFF CACHE BOOL "Include Intel TBB support")
+set(WITH_IPP OFF CACHE BOOL "Include Intel IPP support")
+set(WITH_EIGEN ON CACHE BOOL "Include Eigen2/Eigen3 support")
+set(WITH_CUDA OFF CACHE BOOL "Include NVidia Cuda Runtime support")
+
+if(WIN32)
+ set(WITH_VIDEOINPUT ON CACHE BOOL "Enable VideoInput support")
+endif()
+
+set(WITH_OPENNI OFF CACHE BOOL "Include OpenNI support")
+
+# ===================================================
+# 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(NOT APPLE)
+ if(WITH_GTK)
+ CHECK_MODULE(gtk+-2.0 HAVE_GTK)
+ CHECK_MODULE(gthread-2.0 HAVE_GTHREAD)
+ else()
+ set(HAVE_GTK FALSE)
+ set(HAVE_GTHREAD FALSE)
+ endif()
+ if(WITH_GSTREAMER)
+ CHECK_MODULE(gstreamer-base-0.10 HAVE_GSTREAMER)
+ CHECK_MODULE(gstreamer-app-0.10 HAVE_GSTREAMER)
+ CHECK_MODULE(gstreamer-video-0.10 HAVE_GSTREAMER)
+ else()
+ set(HAVE_GSTREAMER FALSE)
+ endif()
+ endif()
+
+ if(WITH_UNICAP)
+ CHECK_MODULE(libunicap HAVE_UNICAP_)
+ CHECK_MODULE(libucil HAVE_UNICAP_UCIL)
+ if(HAVE_UNICAP_ AND HAVE_UNICAP_UCIL)
+ set(HAVE_UNICAP 1)
+ endif()
+ else()
+ set(HAVE_UNICAP FALSE)
+ endif()
+
+ if(WITH_PVAPI)
+ find_path(PVAPI_INCLUDE_PATH "PvApi.h"
+ PATHS "/usr/local/include" "/usr/include"
+ DOC "The path to PvAPI header")
+ if(PVAPI_INCLUDE_PATH)
+ set(HAVE_PVAPI 1)
+ endif()
+ endif()
+
+ set(HAVE_FFMPEG 0)
+ if(WITH_FFMPEG)
+ CHECK_MODULE(libavcodec HAVE_FFMPEG_CODEC)
+ CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)
+ CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)
+ CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)
+ CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)
+ CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)
+ if(NOT HAVE_GENTOO_FFMPEG AND NOT HAVE_FFMPEG_FFMPEG)
+ if(EXISTS /usr/include/ffmpeg/libavformat/avformat.h OR HAVE_FFMPEG_SWSCALE)
+ set(HAVE_GENTOO_FFMPEG 1)
+ endif()
+ endif()
+ if(HAVE_FFMPEG_CODEC AND HAVE_FFMPEG_FORMAT AND HAVE_FFMPEG_UTIL)
+ if(HAVE_FFMPEG_SWSCALE OR NOT HAVE_GENTOO_FFMPEG)
+ set(HAVE_FFMPEG 1)
+ endif()
+ endif()
+ # Find the bzip2 library because it is required on some systems
+ FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2)
+ if(NOT BZIP2_LIBRARIES)
+ # Do an other trial
+ FIND_FILE(BZIP2_LIBRARIES NAMES libbz2.so.1 PATHS /lib)
+ endif()
+ endif()
+
+ if(WITH_1394)
+ CHECK_MODULE(libdc1394-2 HAVE_DC1394_2)
+ if(NOT HAVE_DC1394_2)
+ CHECK_MODULE(libdc1394 HAVE_DC1394)
+ endif()
+ else()
+ set(HAVE_DC1394_2 FALSE)
+ set(HAVE_DC1394 FALSE)
+ endif()
+
+ if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
+ include(FindZLIB)
+ if(WITH_PNG)
+ include(FindPNG)
+ if(PNG_FOUND)
+ CHECK_INCLUDE_FILE(${PNG_PNG_INCLUDE_DIR}/png.h HAVE_PNG_H)
+ CHECK_INCLUDE_FILE(${PNG_PNG_INCLUDE_DIR}/libpng/png.h HAVE_LIBPNG_PNG_H)
+ endif()
+ else()
+ set(PNG_FOUND FALSE)
+ endif()
+ if(WITH_TIFF)
+ include(FindTIFF)
+ else()
+ set(TIFF_FOUND FALSE)
+ endif()
+ if(WITH_JASPER)
+ include(FindJasper)
+ else()
+ set(JASPER_FOUND FALSE)
+ endif()
+ if(WITH_JPEG)
+ include(FindJPEG)
+ else()
+ set(JPEG_FOUND FALSE)
+ endif()
+ endif()
+
+ if(NOT APPLE)
+ CHECK_INCLUDE_FILE(alloca.h HAVE_ALLOCA_H)
+ CHECK_FUNCTION_EXISTS(alloca HAVE_ALLOCA)
+ CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
+ CHECK_INCLUDE_FILE(pthread.h HAVE_LIBPTHREAD)
+
+ if(WITH_XINE)
+ CHECK_MODULE(libxine HAVE_XINE)
+ else()
+ set(HAVE_XINE FALSE)
+ endif()
+ if(WITH_V4L)
+ CHECK_MODULE(libv4l1 HAVE_LIBV4L)
+ CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L)
+ CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2)
+ else()
+ set(HAVE_LIBV4L FALSE)
+ set(HAVE_CAMV4L FALSE)
+ set(HAVE_CAMV4L2 FALSE)
+ endif()
+
+ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" AND NOT ANDROID)
+ set(OPENCV_LINKER_LIBS m pthread)
+ elseif(ANDROID)
+ set(OPENCV_LINKER_LIBS dl m log)
+ else()
+ set(OPENCV_LINKER_LIBS dl m pthread rt)
+ endif()
+ else()
+ add_definitions(-DHAVE_ALLOCA -DHAVE_ALLOCA_H -DHAVE_LIBPTHREAD -DHAVE_UNISTD_H)
+ endif()
+endif()
+
+if(WITH_PNG AND NOT PNG_FOUND)
+ set(PNG_LIBRARIES libpng)
+endif()
+
+if(WITH_JPEG AND NOT JPEG_FOUND)
+ set(JPEG_LIBRARIES libjpeg)
+endif()
+
+if(WITH_TIFF AND NOT TIFF_FOUND)
+ set(TIFF_LIBRARIES libtiff)
+endif()
+
+if(WITH_JASPER AND NOT JASPER_FOUND)
+ set(JASPER_LIBRARIES libjasper)
+endif()
+
+if (ANDROID)
+ #android camera support
+ set(NativeCamera_DIR "${OPENCV_SOURCE_DIR}/android/native-camera/build")
+ FIND_PACKAGE(NativeCamera QUIET)
+ if(NativeCamera_FOUND)
+ set(HAVE_ANDROID_NATIVE_CAMERA TRUE)
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${NativeCamera_LIBS})
+ else()
+ set(HAVE_ANDROID_NATIVE_CAMERA FALSE)
+ message(STATUS "Could NOT find NativeCamera for Android")
+ endif()
+endif()
+
+#message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}")
+
+if(WITH_OPENEXR)
+ include(OpenCVFindOpenEXR.cmake)
+endif()
+
+set(BUILD_NEW_PYTHON_SUPPORT ON CACHE BOOL "Build with Python support")
+
+if(BUILD_NEW_PYTHON_SUPPORT)
+ find_package(PythonInterp)
+ find_package(PythonLibs)
+
+ # cmake 2.4 (at least on Ubuntu 8.04 (hardy)) don't define PYTHONLIBS_FOUND
+ if(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
+ set(PYTHONLIBS_FOUND ON)
+ endif(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
+
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
+ ERROR_VARIABLE PYTHON_VERSION_FULL
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REGEX MATCH "[0-9].[0-9]" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
+ if(UNIX)
+ set(PYTHON_PLUGIN_INSTALL_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages/opencv)
+ if(APPLE)
+ set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages CACHE PATH "Where to install the python packages.")
+ else() #debian based assumed, install to the dist-packages.
+ set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/dist-packages CACHE PATH "Where to install the python packages.")
+ endif()
+ endif()
+ if(WIN32)
+ get_filename_component(PYTHON_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE CACHE)
+ set(PYTHON_PLUGIN_INSTALL_PATH "${PYTHON_PATH}/Lib/site-packages/opencv")
+ set(PYTHON_PACKAGES_PATH "${PYTHON_PATH}/Lib/site-packages")
+ endif()
+
+ # Attempt to discover the NumPy include directory. If this succeeds, build with NumPy
+
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
+ RESULT_VARIABLE PYTHON_NUMPY_PROCESS
+ OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(PYTHON_NUMPY_PROCESS EQUAL 0)
+ set(PYTHON_USE_NUMPY 1)
+ add_definitions(-D PYTHON_USE_NUMPY=1)
+ include_directories(AFTER ${PYTHON_NUMPY_INCLUDE_DIRS})
+ message(STATUS " Use INCLUDE: ${PYTHON_NUMPY_INCLUDE_DIRS}")
+ else()
+ set(PYTHON_USE_NUMPY 0)
+ endif()
+
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx; print sphinx.__version__"
+ RESULT_VARIABLE SPHINX_PROCESS
+ OUTPUT_VARIABLE SPHINX_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set(HAVE_SPHINX 0)
+ if(SPHINX_PROCESS EQUAL 0)
+ find_program(SPHINX_BUILD sphinx-build)
+ if(SPHINX_BUILD)
+ set(HAVE_SPHINX 1)
+ message(STATUS " Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}")
+ endif()
+ endif()
+endif()
+
+#YV
+############################### QT ################################
+
+set(WITH_QT OFF CACHE BOOL "Build with Qt Backend support")
+set(WITH_QT_OPENGL OFF CACHE BOOL "Add OpenGL extension to Qt")
+
+set(HAVE_QT 0)
+set(HAVE_QT_OPENGL 0)
+
+if (WITH_QT)
+ find_package(Qt4)
+ if (QT4_FOUND)
+ set(HAVE_QT 1)
+ add_definitions(-DHAVE_QT)#We need to define te macro this way, using cvconfig.h.cmake does not work
+
+ find_package (OpenGL QUIET)
+
+
+ #if (NOT WIN32)
+ if (WITH_QT_OPENGL)
+ if (QT_QTOPENGL_FOUND AND OPENGL_FOUND)
+ set(HAVE_QT_OPENGL 1)
+ add_definitions(-DHAVE_QT_OPENGL)
+ #link_directories("${OPENGL_LIBRARIES}")
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${OPENGL_LIBRARIES})
+ endif()
+ endif()
+ #endif()
+
+ endif()
+endif()
+
+############################### TBB ################################
+
+if (WITH_TBB)
+ if (UNIX AND NOT APPLE)
+ PKG_CHECK_MODULES(TBB tbb)
+ message(STATUS "TBB detected: ${TBBLIB_FOUND}")
+
+ if (TBB_FOUND)
+ set(HAVE_TBB 1)
+ if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
+ include_directories(${TBB_INCLUDE_DIRS})
+ endif()
+ link_directories(${TBB_LIBRARY_DIRS})
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES})
+ endif()
+ endif()
+
+ if (NOT HAVE_TBB)
+ set(TBB_DEFAULT_INCLUDE_DIRS "/opt/intel/tbb" "/usr/local/include" "/usr/include" "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB" "C:/Program Files (x86)/TBB")
+
+ find_path(TBB_INCLUDE_DIR "tbb/tbb.h" PATHS ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")
+ if (TBB_INCLUDE_DIR)
+ if (UNIX)
+ set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")
+ link_directories("${TBB_LIB_DIR}")
+ endif()
+ if (APPLE)
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libtbb.dylib)
+ elseif (UNIX)
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
+ elseif (WIN32)
+ if (CMAKE_COMPILER_IS_GNUCXX)
+ set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")
+ link_directories("${TBB_LIB_DIR}")
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
+ else()
+ get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIR}/../lib" ABSOLUTE)
+
+ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*|x86_64*)
+ set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")
+ endif()
+ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86*|i386*|i686*)
+ set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32")
+ endif()
+
+ if (MSVC80)
+ set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8")
+ elseif(MSVC90)
+ set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9")
+ elseif(MSVC10)
+ set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10")
+ endif()
+ set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")
+ link_directories("${TBB_LIB_DIR}")
+ endif()
+ endif()
+
+ set(HAVE_TBB 1)
+ if(NOT "${TBB_INCLUDE_DIR}" STREQUAL "")
+ include_directories("${TBB_INCLUDE_DIR}")
+ endif()
+ endif()
+ endif()
+endif(WITH_TBB)
+
+#Threading Framework -- temporary decision for ARM-s instead of TBB
+if (NOT HAVE_TBB)
+ 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()
+endif()
+
+############################ Intel IPP #############################
+set(IPP_FOUND)
+
+if(WITH_IPP)
+ include(OpenCVFindIPP.cmake)
+endif()
+
+if(IPP_FOUND)
+ add_definitions(-DHAVE_IPP)
+ include_directories(${IPP_INCLUDE_DIRS})
+ link_directories(${IPP_LIBRARY_DIRS})
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${IPP_LIBRARIES})
+endif()
+
+
+############################### CUDA ################################
+
+if(WITH_CUDA)
+ find_package(CUDA 4.0)
+
+ if(CUDA_FOUND)
+ set(HAVE_CUDA 1)
+ message(STATUS "CUDA detected: " ${CUDA_VERSION})
+
+ set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
+ set(CUDA_ARCH_PTX "1.1 1.3" CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for")
+
+ string(REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}")
+ string(REGEX REPLACE "\\." "" ARCH_PTX_NO_POINTS "${CUDA_ARCH_PTX}")
+
+ # Ckeck if user specified 1.0 compute capability: we don't support it
+ string(REGEX MATCH "1.0" HAS_ARCH_10 "${CUDA_ARCH_BIN} ${CUDA_ARCH_PTX}")
+ set(CUDA_ARCH_BIN_OR_PTX_10 0)
+ if(NOT ${HAS_ARCH_10} STREQUAL "")
+ set(CUDA_ARCH_BIN_OR_PTX_10 1)
+ endif()
+
+ # NVCC flags to be set
+ set(NVCC_FLAGS_EXTRA "")
+
+ # These vars will be passed into the templates
+ set(OPENCV_CUDA_ARCH_BIN "")
+ set(OPENCV_CUDA_ARCH_PTX "")
+ set(OPENCV_CUDA_ARCH_FEATURES "")
+
+ # Tell NVCC to add binaries for the specified GPUs
+ string(REGEX MATCHALL "[0-9()]+" ARCH_LIST "${ARCH_BIN_NO_POINTS}")
+ foreach(ARCH IN LISTS ARCH_LIST)
+ if (ARCH MATCHES "([0-9]+)\\(([0-9]+)\\)")
+ # User explicitly specified PTX for the concrete BIN
+ set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1})
+ set(OPENCV_CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN} ${CMAKE_MATCH_1}")
+ set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${CMAKE_MATCH_2}")
+ else()
+ # User didn't explicitly specify PTX for the concrete BIN, we assume PTX=BIN
+ set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=sm_${ARCH})
+ set(OPENCV_CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN} ${ARCH}")
+ set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}")
+ endif()
+ endforeach()
+
+ # Tell NVCC to add PTX intermediate code for the specified architectures
+ string(REGEX MATCHALL "[0-9]+" ARCH_LIST "${ARCH_PTX_NO_POINTS}")
+ foreach(ARCH IN LISTS ARCH_LIST)
+ set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=compute_${ARCH})
+ set(OPENCV_CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX} ${ARCH}")
+ set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}")
+ endforeach()
+
+ # These vars will be processed in other scripts
+ set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${NVCC_FLAGS_EXTRA})
+ set(OpenCV_CUDA_CC "${NVCC_FLAGS_EXTRA}")
+
+ message(STATUS "CUDA NVCC flags: ${CUDA_NVCC_FLAGS}")
+ else()
+ unset(CUDA_ARCH_BIN CACHE)
+ unset(CUDA_ARCH_PTX CACHE)
+ endif()
+endif()
+
+
+############################### VideoInput ################################
+
+if (WIN32 AND WITH_VIDEOINPUT)
+ if(CMAKE_CXX_COMPILER MATCHES "dw2")
+ else()
+ if(NOT MINGW64)
+ set(HAVE_VIDEOINPUT 1)
+ endif()
+ endif()
+endif()
+
+############################### OpenNI ################################
+set(HAVE_OPENNI FALSE)
+set(HAVE_OPENNI_PRIME_SENSOR_MODULE FALSE)
+
+if(WITH_OPENNI)
+ include(OpenCVFindOpenNI.cmake)
+endif()
+
+############################## Eigen ##############################
+
+if(WITH_EIGEN)
+ find_path(EIGEN_INCLUDE_PATH "Eigen/Core"
+ PATHS "/usr/local/include/eigen2" "/opt/include/eigen2" "/usr/include/eigen2"
+ "/usr/local/include/eigen3" "/opt/include/eigen3" "/usr/include/eigen3"
+ DOC "The path to Eigen2/Eigen3 headers")
+ if(EIGEN_INCLUDE_PATH)
+ include_directories(${EIGEN_INCLUDE_PATH})
+ set(HAVE_EIGEN 1)
+ endif()
+endif()
+
+
+################## Extra HighGUI libs on Windows ###################
+
+if(WIN32)
+ set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} comctl32 gdi32 ole32)
+
+ if (MSVC)
+ set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32)
+ if (NOT BUILD_SHARED_LIBS)
+ if (MSVC64)
+ if(HAVE_VIDEOINPUT)
+ set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${OPENCV_SOURCE_DIR}/3rdparty/lib/videoInput64.lib strmiids)
+ endif()
+ elseif (MSVC)
+ if(HAVE_VIDEOINPUT)
+ set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${OPENCV_SOURCE_DIR}/3rdparty/lib/videoInput.lib strmiids)
+ endif()
+ endif()
+ endif()
+ endif()
+
+ if(MINGW)
+ if(MINGW64)
+ set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} msvfw32 avifil32 avicap32 winmm)
+ if(HAVE_VIDEOINPUT)
+ set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} videoInput64 strmiids)
+ endif()
+ else()
+ set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32 winmm)
+ if(HAVE_VIDEOINPUT)
+ set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} videoInput strmiids)
+ endif()
+ endif()
+ endif()
+endif()
+
+
+
+################## Reference Manual ##################
+set(BUILD_DOCS ON CACHE BOOL "Build OpenCV Reference Manual")
+
+
+################### DOXYGEN ###############
+
+#find_package(Doxygen)
+#
+#if(DOXYGEN_FOUND)
+# set(BUILD_DOXYGEN_DOCS ON CACHE BOOL "Generate HTML docs using Doxygen")
+#endif()
+
+
+# ----------------------------------------------------------------------------
+# UPDATE CONFIG FILES & SCRIPTS:
+#
+# CONFIGURE_FILE(InputFile OutputFile [COPYONLY] [ESCAPE_QUOTES] [@ONLY])
+# If @ONLY is specified, only variables of the form @VAR@ will be
+# replaces and ${VAR} will be ignored.
+#
+# A directory will be created for each platform so the "cvconfig.h" file is
+# not overwritten if cmake generates code in the same path.
+# ----------------------------------------------------------------------------
+add_definitions(-DHAVE_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'")
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
+
+
+# ---------------------------------------------------------------------------
+# The C+//0 include & link directories:
+# ---------------------------------------------------------------------------
+include_directories("."
+ "${OPENCV_CONFIG_FILE_INCLUDE_DIR}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/include"
+ "${CMAKE_CURRENT_SOURCE_DIR}/include/opencv"
+ )
+
+
+# ----------------------------------------------------------------------------
+# Set the maximum level of warnings:
+# ----------------------------------------------------------------------------
+# Should be set to true for development
+set(OPENCV_WARNINGS_ARE_ERRORS OFF CACHE BOOL "Treat warnings as errors")
+
+set(EXTRA_C_FLAGS "")
+set(EXTRA_C_FLAGS_RELEASE "")
+set(EXTRA_C_FLAGS_DEBUG "")
+set(EXTRA_EXE_LINKER_FLAGS "")
+set(EXTRA_EXE_LINKER_FLAGS_RELEASE "")
+set(EXTRA_EXE_LINKER_FLAGS_DEBUG "")
+
+if(MSVC)
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")
+ # 64-bit portability warnings, in MSVC8
+ if(MSVC80)
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Wp64")
+
+ endif()
+ #if(MSVC90)
+ # set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _BIND_TO_CURRENT_CRT_VERSION=1 /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
+ #endif()
+
+ set(EXTRA_EXE_LINKER_FLAGS_RELEASE "${EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
+
+ #if(ENABLE_OPENMP)
+ # set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /openmp")
+ #endif()
+
+ # Remove unreferenced functions: function level linking
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Gy")
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Zi")
+endif()
+
+if(CMAKE_COMPILER_IS_GNUCXX)
+
+ # High level of warnings.
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")
+
+ # The -Wno-long-long is required in 64bit systems when including sytem headers.
+ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
+ endif()
+ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
+ endif()
+
+ # We need pthread's
+ if(UNIX)
+ if(NOT ANDROID)
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -pthread")
+ endif()
+ endif()
+
+ if(OPENCV_WARNINGS_ARE_ERRORS)
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
+ endif()
+
+ if(X86)
+ if(NOT MINGW64)
+ if(NOT X86_64)
+ if(NOT APPLE)
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -march=i686")
+ endif()
+ endif()
+ endif()
+ endif()
+
+ # Other optimizations
+ if(USE_OMIT_FRAME_POINTER)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer")
+ endif()
+ if(USE_O2)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2")
+ endif()
+ if(USE_O3)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O3")
+ endif()
+ if(USE_FAST_MATH)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math")
+ endif()
+ if(ENABLE_POWERPC)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5")
+ endif()
+ if(ENABLE_SSE)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse")
+ endif()
+ if(ENABLE_SSE2)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse2")
+ endif()
+ # SSE3 and further should be disabled under MingW because it generates compiler errors
+ if(NOT MINGW)
+ if(ENABLE_SSE3)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse3")
+ endif()
+
+ if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 402)
+ set(HAVE_GCC43_OR_NEWER 1)
+ endif()
+ if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 401)
+ set(HAVE_GCC42_OR_NEWER 1)
+ endif()
+
+ if(HAVE_GCC43_OR_NEWER OR APPLE)
+ if(ENABLE_SSSE3)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mssse3")
+ endif()
+ if(HAVE_GCC42_OR_NEWER)
+ if(ENABLE_SSE41)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse4.1")
+ endif()
+ if(ENABLE_SSE42)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse4.2")
+ endif()
+ endif()
+ endif()
+ endif()
+
+ if(X86 OR X86_64)
+ if(NOT APPLE)
+ if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mfpmath=387")
+ endif()
+ endif()
+ endif()
+
+ # Profiling?
+ if(ENABLE_PROFILING)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -pg -g")
+ else()
+ # Remove unreferenced functions: function level linking
+ if(NOT APPLE)
+ set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections")
+ endif()
+ endif()
+
+ # Parallel mode
+ #if(ENABLE_OPENMP)
+ # set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -D_GLIBCXX_PARALLEL -fopenmp")
+ # set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} gomp)
+ #endif()
+
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG")
+ set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0 -ggdb3 -DDEBUG -D_DEBUG")
+
+endif()
+
+if(MSVC)
+ if(ENABLE_SSE)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE")
+ endif()
+ if(ENABLE_SSE2)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE2")
+ endif()
+ if(ENABLE_SSE3)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE3")
+ endif()
+ if(ENABLE_SSE4_1)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE4.1")
+ endif()
+ if (ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1)
+ set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Oi")
+ endif()
+endif()
+
+# Extra link libs if the user selects building static libs:
+IF(NOT BUILD_SHARED_LIBS)
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++)
+ endif()
+endif()
+
+
+# Add user supplied extra options (optimization, etc...)
+# ==========================================================
+set(OPENCV_EXTRA_C_FLAGS "" CACHE STRING "Extra compiler options")
+set(OPENCV_EXTRA_C_FLAGS_RELEASE "" CACHE STRING "Extra compiler options for Release build")
+set(OPENCV_EXTRA_C_FLAGS_DEBUG "" CACHE STRING "Extra compiler options for Debug build")
+set(OPENCV_EXTRA_EXE_LINKER_FLAGS "" CACHE STRING "Extra linker flags" FORCE)
+set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING "Extra linker flags for Release build" FORCE)
+set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "" CACHE STRING "Extra linker flags for Debug build" FORCE)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE} ${OPENCV_EXTRA_C_FLAGS_RELEASE}")
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE} ${OPENCV_EXTRA_C_FLAGS_RELEASE}")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG} ${OPENCV_EXTRA_C_FLAGS_DEBUG}")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG} ${OPENCV_EXTRA_C_FLAGS_DEBUG}")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_EXE_LINKER_FLAGS} ${OPENCV_EXTRA_EXE_LINKER_FLAGS}")
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${EXTRA_EXE_LINKER_FLAGS_RELEASE} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}")
+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:
+if (${CMAKE_GENERATOR} MATCHES ".*Makefiles")
+ if("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ set(CMAKE_BUILD_TYPE Release)
+ endif()
+endif()
+
+if (WIN32 AND MSVC)
+ # avoid warnings from MSVC about overriding the /W* option
+ # we replace /W3 with /W4 only for C++ files,
+ # since all the 3rd-party libraries OpenCV uses are in C,
+ # and we do not care about their warnings.
+ string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+ string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+
+ # allow extern "C" functions throw exceptions
+ string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+ string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
+ string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+ string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+
+ string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ string(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+endif()
+
+if("${CMAKE_CONFIGURE_LDFLAGS}")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_CONFIGURE_LDFLAGS}")
+endif("${CMAKE_CONFIGURE_LDFLAGS}")
+
+
+# ----------------------------------------------------------------------------
+# PROCESS SUBDIRECTORIES:
+# ----------------------------------------------------------------------------
+# Save libs and executables in the same place
+set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
+set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
+
+if(WIN32)
+set(OPENCV_DOC_INSTALL_PATH doc)
+else()
+set(OPENCV_DOC_INSTALL_PATH share/opencv/doc)
+endif()
+
+
+# --------------------------------------------------------------------------------------------
+# Installation for CMake Module: OpenCVConfig.cmake
+# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
+# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use with "make install"
+# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
+# -------------------------------------------------------------------------------------------
+
+# -------------------------------------------------------------------------------------------
+# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
+# -------------------------------------------------------------------------------------------
+
+# Name of libraries is: libcv.so.1.1.0, etc...
+# OPENCV_DLLVERSION must be set to "110", etc..
+# Already done above.
+
+# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
+set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${CMAKE_CURRENT_SOURCE_DIR}/include\" \"${CMAKE_CURRENT_SOURCE_DIR}/include/opencv\"")
+set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"${CMAKE_CURRENT_SOURCE_DIR}\"")
+
+set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}")
+
+if( HAVE_ANDROID_NATIVE_CAMERA )
+ set(CMAKE_LIB_DIRS_CONFIGCMAKE ${CMAKE_LIB_DIRS_CONFIGCMAKE} ${NativeCamera_LIB_DIR})
+endif()
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY)
+
+# --------------------------------------------------------------------------------------------
+# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
+# -------------------------------------------------------------------------------------------
+# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
+
+set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/include/opencv" "${CMAKE_INSTALL_PREFIX}/include")
+set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
+
+set(CMAKE_LIB_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/lib")
+
+exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/unix-install/\"" OUTPUT_VARIABLE RET_VAL)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
+
+if(UNIX)
+ # For a command "FIND_PACKAGE(FOO)", CMake will look at the directory /usr/share|lib/FOO/FOOConfig.cmake, so:
+ install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION share/opencv/)
+endif()
+
+# --------------------------------------------------------------------------------------------
+# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
+# -------------------------------------------------------------------------------------------
+if(WIN32)
+ # Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
+ # support for 3rdparty libraries.
+ # This will expand to, for example, <program files>/OpenCV 1.1.0/include
+ set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/include\"
+ \"\${THIS_OPENCV_CONFIG_PATH}/include/opencv\"
+ \"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/include\"")
+
+ set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}\"")
+
+ # This will expand to, for example, <program files>/OpenCV 1.1.0/lib
+ # support for 3rdparty libraries.
+ set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/lib\"
+ \"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/lib\"")
+
+ #exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/win-install/\"")
+ 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)
+ # 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}/")
+
+ # if videoInput support is enabled (which is by default on WIN32) copy the static library required to the installation path
+ # DESTINATION could also be "${CMAKE_INSTALL_PREFIX}/lib") to simplify dev environment setup of client applications
+ IF(HAVE_VIDEOINPUT)
+ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/videoInput.lib" "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/videoInput64.lib"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/3rdparty/lib")
+
+ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include/videoInput.h" DESTINATION "${CMAKE_INSTALL_PREFIX}/3rdparty/include")
+ ENDIF()
+
+ # Add the OpenCV configuration header to the install path
+ # Useful for instance if a client application checks against the features OpenCV has been compiled with
+ install(FILES "${CMAKE_BINARY_DIR}/cvconfig.h" DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
+endif()
+
+
+# --------------------------------------------------------------------------------------------
+# Part 2/2: ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install"
+# prefix=/usr
+# exec_prefix=${prefix}
+# libdir=${exec_prefix}/lib
+# includedir=${prefix}/include/opencv
+# -------------------------------------------------------------------------------------------
+set(prefix ${CMAKE_INSTALL_PREFIX})
+set(exec_prefix "\${prefix}")
+set(libdir "\${exec_prefix}/lib")
+set(includedir "\${prefix}/include")
+set(VERSION ${OPENCV_VERSION})
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/opencv.pc" @ONLY IMMEDIATE)
+
+if(UNIX)
+ install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION lib/pkgconfig)
+endif()
+
+
+# ----------------------------------------------------------------------------
+# Uninstall target, for "make uninstall"
+# ----------------------------------------------------------------------------
+CONFIGURE_FILE(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+
+ADD_CUSTOM_TARGET(uninstall
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+
+
+# ----------------------------------------------------------------------------
+# CPack target
+# ----------------------------------------------------------------------------
+
+set(BUILD_PACKAGE OFF CACHE BOOL "Build a installer with the SDK")
+
+if(BUILD_PACKAGE)
+
+ configure_file(
+ Package.cmake.in
+ ${CMAKE_BINARY_DIR}/.cpack/Package.cmake
+ @ONLY
+ )
+
+ include(${CMAKE_BINARY_DIR}/.cpack/Package.cmake)
+
+ set(root_files README)
+
+ file(GLOB root_src_files *.in *.cmake CMakeLists.txt)
+
+ if (NOT WIN32)
+ install(FILES ${root_files}
+ DESTINATION ${OPENCV_DOC_INSTALL_PATH}
+ COMPONENT main)
+ else()
+ install(FILES ${root_files}
+ DESTINATION "."
+ COMPONENT main)
+ install(FILES ${root_src_files}
+ DESTINATION "."
+ COMPONENT src)
+ # Add the "win-install/OpenCVConfig.cmake" file to the "main" install component
+ install(FILES
+ "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake"
+ DESTINATION "."
+ COMPONENT main
+ )
+ install(FILES
+ "include/CMakeLists.txt"
+ DESTINATION "include/"
+ COMPONENT src
+ )
+
+ if(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ foreach(m calib3d core contrib features2d ffmpeg flann gpu highgui imgproc legacy ml objdetect video)
+ install(FILES ${EXECUTABLE_OUTPUT_PATH}/Debug/opencv_${m}${OPENCV_DLLVERSION}d.dll
+ DESTINATION bin COMPONENT main)
+ install(FILES ${LIBRARY_OUTPUT_PATH}/Debug/opencv_${m}${OPENCV_DLLVERSION}d.lib
+ DESTINATION lib COMPONENT main)
+ endforeach()
+ endif()
+
+ install(DIRECTORY data samples DESTINATION "." COMPONENT main PATTERN ".svn" EXCLUDE)
+ install(DIRECTORY 3rdparty android modules tests DESTINATION "." COMPONENT src PATTERN ".svn" EXCLUDE)
+ #install(DIRECTORY doc/ DESTINATION doc COMPONENT src FILES_MATCHING PATTERN "*.tex")
+ #install(DIRECTORY doc/pics DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)
+ #install(DIRECTORY doc/latex2sphinx DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)
+
+ endif()
+endif()
+
+
+#-----------------------------------
+# 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)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
+endif()
+
+#-----------------------------------
+# Subdirectories:
+#-----------------------------------
+add_subdirectory(include)
+add_subdirectory(modules)
+
+if(BUILD_DOCS)
+ include(OpenCVFindLATEX.cmake REQUIRED)
+
+ if(PDFLATEX_COMPILER)
+ message(STATUS "PDF LaTeX found!")
+ endif()
+endif()
+
+add_subdirectory(doc)
+add_subdirectory(data)
+
+if(BUILD_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
+ add_subdirectory(samples)
+endif()
+
+#if(BUILD_TESTS)
+# enable_testing()
+# add_subdirectory(tests)
+#endif()
+
+add_subdirectory(3rdparty)
+
+
+# ----------------------------------------------------------------------------
+# Summary:
+# ----------------------------------------------------------------------------
+message(STATUS "")
+message(STATUS "General configuration for opencv ${OPENCV_VERSION} =====================================")
+message(STATUS "")
+message(STATUS " Built as dynamic libs?: ${BUILD_SHARED_LIBS}")
+message(STATUS " Compiler: ${CMAKE_COMPILER}")
+message(STATUS " C++ flags (Release): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
+message(STATUS " C++ flags (Debug): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
+if(WIN32)
+message(STATUS " Linker flags (Release): ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
+message(STATUS " Linker flags (Debug): ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
+else()
+message(STATUS " Linker flags (Release): ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
+message(STATUS " Linker flags (Debug): ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
+endif()
+
+#YV
+message(STATUS "")
+message(STATUS " GUI: ")
+
+if (HAVE_QT)
+ message(STATUS " QT 4.x: ${HAVE_QT}")
+ message(STATUS " QT OpenGL support: ${HAVE_QT_OPENGL}")
+else()
+ if(WIN32)
+ message(STATUS " Win32 UI: YES")
+ else()
+ if(APPLE)
+ if(WITH_CARBON)
+ message(STATUS " Carbon: YES")
+ else()
+ message(STATUS " Cocoa: YES")
+ endif()
+ else()
+ message(STATUS " GTK+ 2.x: ${HAVE_GTK}")
+ message(STATUS " GThread: ${HAVE_GTHREAD}")
+ endif()
+ endif()
+endif()
+
+message(STATUS "")
+message(STATUS " Media I/O: ")
+if(ZLIB_FOUND)
+message(STATUS " ZLib: ${ZLIB_FOUND}")
+else()
+message(STATUS " ZLib: build")
+endif()
+
+if(NOT WITH_JPEG OR JPEG_FOUND)
+message(STATUS " JPEG: ${JPEG_FOUND}")
+else()
+message(STATUS " JPEG: build")
+endif()
+
+if(NOT WITH_PNG OR PNG_FOUND)
+message(STATUS " PNG: ${PNG_FOUND}")
+else()
+message(STATUS " PNG: build")
+endif()
+
+if(NOT WITH_TIFF OR TIFF_FOUND)
+message(STATUS " TIFF: ${TIFF_FOUND}")
+else()
+message(STATUS " TIFF: build")
+endif()
+
+if(NOT WITH_JASPER OR JASPER_FOUND)
+message(STATUS " JPEG 2000: ${JASPER_FOUND}")
+else()
+message(STATUS " JPEG 2000: build")
+endif()
+
+if(WITH_OPENEXR AND OPENEXR_FOUND)
+message(STATUS " OpenEXR: YES")
+else()
+message(STATUS " OpenEXR: NO")
+endif()
+
+if(NOT HAVE_OPENNI OR HAVE_OPENNI_PRIME_SENSOR_MODULE)
+message(STATUS " OpenNI: ${HAVE_OPENNI}")
+else()
+message(STATUS " OpenNI: ${HAVE_OPENNI} (WARNING: PrimeSensor Modules for OpenNI are not installed (not found in OPENNI_PRIME_SENSOR_MODULE_BIN_DIR).)")
+endif()
+
+if(UNIX AND NOT APPLE)
+message(STATUS "")
+message(STATUS " Video I/O: ")
+message(STATUS " DC1394 1.x: ${HAVE_DC1394}")
+message(STATUS " DC1394 2.x: ${HAVE_DC1394_2}")
+message(STATUS " FFMPEG: ${HAVE_FFMPEG}")
+message(STATUS " codec: ${HAVE_FFMPEG_CODEC}")
+message(STATUS " format: ${HAVE_FFMPEG_FORMAT}")
+message(STATUS " util: ${HAVE_FFMPEG_UTIL}")
+message(STATUS " swscale: ${HAVE_FFMPEG_SWSCALE}")
+message(STATUS " gentoo-style: ${HAVE_GENTOO_FFMPEG}")
+message(STATUS " GStreamer: ${HAVE_GSTREAMER}")
+message(STATUS " UniCap: ${HAVE_UNICAP}")
+message(STATUS " PvAPI: ${HAVE_PVAPI}")
+if(HAVE_LIBV4L)
+message(STATUS " V4L/V4L2: Using libv4l")
+else()
+message(STATUS " V4L/V4L2: ${HAVE_CAMV4L}/${HAVE_CAMV4L2}")
+endif()
+message(STATUS " Xine: ${HAVE_XINE}")
+if(ANDROID)
+message(STATUS " AndroidNativeCamera: ${HAVE_ANDROID_NATIVE_CAMERA}")
+endif()
+endif() #if(UNIX AND NOT APPLE)
+
+if(APPLE)
+message(STATUS "")
+if(WITH_QUICKTIME)
+message(STATUS " Video I/O: QuickTime")
+else()
+message(STATUS " Video I/O: QTKit")
+endif()
+endif()
+
+if(WIN32)
+message(STATUS "")
+message(STATUS " Video I/O: ")
+if(HAVE_VIDEOINPUT)
+message(STATUS " VideoInput: YES")
+else()
+message(STATUS " VideoInput: NO")
+endif()
+endif()
+
+message(STATUS "")
+message(STATUS " Interfaces: ")
+message(STATUS " Python: ${BUILD_NEW_PYTHON_SUPPORT}")
+message(STATUS " Python interpreter: ${PYTHON_EXECUTABLE}")
+if (PYTHON_USE_NUMPY)
+message(STATUS " Python numpy: YES")
+else()
+message(STATUS " Python numpy: NO (Python interface will not cover OpenCV 2.x API)")
+endif()
+
+if(WITH_IPP AND IPP_FOUND)
+message(STATUS " Use IPP: ${IPP_LATEST_VERSION_STR} [${IPP_LATEST_VERSION_MAJOR}.${IPP_LATEST_VERSION_MINOR}.${IPP_LATEST_VERSION_BUILD}]")
+message(STATUS " at: ${IPP_ROOT_DIR}")
+elseif(WITH_IPP AND NOT IPP_FOUND)
+message(STATUS " Use IPP: IPP not found")
+else()
+message(STATUS " Use IPP: NO")
+endif()
+
+if(HAVE_TBB)
+message(STATUS " Use TBB: YES")
+else()
+message(STATUS " Use TBB: NO")
+if(HAVE_THREADING_FRAMEWORK)
+message(STATUS " Use ThreadingFramework: YES")
+else()
+message(STATUS " Use ThreadingFramework: NO")
+endif()
+endif()
+
+if (HAVE_CUDA)
+message(STATUS " Use Cuda: YES")
+else()
+message(STATUS " Use Cuda: NO")
+endif()
+
+if(HAVE_EIGEN)
+message(STATUS " Use Eigen: YES")
+else()
+message(STATUS " Use Eigen: NO")
+endif()
+
+message(STATUS "")
+message(STATUS " Documentation: ")
+
+if(BUILD_DOCS AND PDFLATEX_COMPILER AND HAVE_SPHINX)
+message(STATUS " Build Documentation: YES")
+else()
+message(STATUS " Build Documentation: NO")
+endif()
+
+#if(BUILD_DOXYGEN_DOCS AND DOXYGEN_FOUND)
+#message(STATUS " Doxygen HTMLs YES")
+#else()
+#message(STATUS " Doxygen HTMLs NO")
+#endif()
+
+message(STATUS "")
+message(STATUS " Install path: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "")
+message(STATUS " cvconfig.h is in: ${OPENCV_CONFIG_FILE_INCLUDE_DIR}")
+message(STATUS "-----------------------------------------------------------------")
+message(STATUS "")
+
+#----------------------------------------------------------------------------
+# Generate the OpenCVConfig.cmake file for unix
+# installation in CMAKE_INSTALL_PREFIX
+#----------------------------------------------------------------------------