2011-06-14 18:11:16 +08:00
# ----------------------------------------------------------------------------
# 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 ( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
2011-06-29 14:27:08 +08:00
2012-01-03 21:48:12 +08:00
# --------------------------------------------------------------
# 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 ( )
2011-07-02 23:12:07 +08:00
# Following block can broke build in case of cross-compilng
# but CMAKE_CROSSCOMPILING variable will be set only on project(OpenCV) command
# so we will try to detect crosscompiling by presense of CMAKE_TOOLCHAIN_FILE
if ( NOT CMAKE_TOOLCHAIN_FILE )
# 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 ( )
2011-06-14 18:11:16 +08:00
2011-07-02 23:12:07 +08:00
# 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 ( )
if ( MSVC )
set ( CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE )
endif ( )
endif ( NOT CMAKE_TOOLCHAIN_FILE )
# --------------------------------------------------------------
# Top level OpenCV project
# --------------------------------------------------------------
2011-09-01 02:42:44 +08:00
if ( NOT IOS )
2011-11-28 16:23:26 +08:00
cmake_minimum_required ( VERSION 2.6.3 )
2011-09-01 02:42:44 +08:00
else ( )
2011-11-28 16:23:26 +08:00
cmake_minimum_required ( VERSION 2.8 )
2011-09-01 02:42:44 +08:00
endif ( )
2011-07-02 23:12:07 +08:00
project ( OpenCV )
2011-06-14 18:11:16 +08:00
set ( CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE )
2011-09-18 23:30:36 +08:00
if ( DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8" )
2011-06-28 15:20:30 +08:00
set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${ CMAKE_CONFIGURATION_TYPES } )
endif ( )
2011-06-28 13:18:53 +08:00
2011-06-14 18:11:16 +08:00
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 )
2011-06-28 13:18:53 +08:00
set ( CMAKE_VERBOSE OFF CACHE BOOL "Verbose mode" )
if ( CMAKE_VERBOSE )
set ( CMAKE_VERBOSE_MAKEFILE 1 )
endif ( )
2011-06-18 21:09:57 +08:00
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVUtils.cmake REQUIRED )
# ----------------------------------------------------------------------------
# Detect Microsoft compiler:
# ----------------------------------------------------------------------------
if ( CMAKE_CL_64 )
set ( MSVC64 1 )
2011-06-14 18:11:16 +08:00
endif ( )
2011-06-29 14:27:08 +08:00
# ----------------------------------------------------------------------------
2012-01-03 21:48:12 +08:00
# 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.
2011-06-29 14:27:08 +08:00
# ----------------------------------------------------------------------------
2012-01-03 21:48:12 +08:00
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 ( )
if ( MSVC AND CMAKE_C_COMPILER MATCHES "icc" )
set ( CV_ICC __INTEL_COMPILER_FOR_WINDOWS )
2011-08-23 19:19:58 +08:00
endif ( )
2012-01-03 21:48:12 +08:00
2011-07-05 00:18:12 +08:00
# ----------------------------------------------------------------------------
2012-01-03 21:48:12 +08:00
# Detect GNU version:
2011-07-05 00:18:12 +08:00
# ----------------------------------------------------------------------------
2012-01-03 21:48:12 +08:00
if ( CMAKE_COMPILER_IS_GNUCXX )
execute_process ( COMMAND ${ CMAKE_CXX_COMPILER } --version
O U T P U T _ V A R I A B L E C M A K E _ O P E N C V _ G C C _ V E R S I O N _ F U L L
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
execute_process ( COMMAND ${ CMAKE_CXX_COMPILER } -v
E R R O R _ V A R I A B L E C M A K E _ O P E N C V _ G C C _ I N F O _ F U L L
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
# 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
O U T P U T _ V A R I A B L E C M A K E _ O P E N C V _ G C C _ T A R G E T _ M A C H I N E
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
if ( CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64" )
set ( MINGW64 1 )
endif ( )
endif ( )
endif ( )
if ( CMAKE_SYSTEM_PROCESSOR MATCHES amd64.*|x86_64.* )
set ( X86_64 1 )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES i686.*|i386.*|x86.* )
set ( X86 1 )
endif ( )
# Optional 3rd party components
# ===================================================
OCV_OPTION ( WITH_1394 "Include IEEE1394 support" ON IF ( UNIX AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_ANDROID_CAMERA "Build with native Android camera support" ON IF ( ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7 ) )
OCV_OPTION ( WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS )
OCV_OPTION ( WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE )
OCV_OPTION ( WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF ( CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_CUDA "Include NVidia Cuda Runtime support" ON IF ( CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF ( CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_EIGEN "Include Eigen2/Eigen3 support" ON )
OCV_OPTION ( WITH_FFMPEG "Include FFMPEG support" ON IF ( UNIX AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_GSTREAMER "Include Gstreamer support" ON IF ( UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_GTK "Include GTK support" ON IF ( UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_IPP "Include Intel IPP support" OFF IF ( MSVC OR X86 OR X86_64 ) )
OCV_OPTION ( WITH_JASPER "Include JPEG2K support" ON IF ( NOT IOS ) )
OCV_OPTION ( WITH_JPEG "Include JPEG support" ON IF ( NOT IOS ) )
OCV_OPTION ( WITH_OPENEXR "Include ILM support via OpenEXR" ON IF ( NOT IOS ) )
OCV_OPTION ( WITH_OPENGL "Include OpenGL support" OFF IF ( NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_OPENNI "Include OpenNI support" OFF IF ( NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_PNG "Include PNG support" ON IF ( NOT IOS ) )
OCV_OPTION ( WITH_PVAPI "Include Prosilica GigE support" ON IF ( UNIX AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_QT "Build with Qt Backend support" OFF IF ( NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF IF APPLE )
OCV_OPTION ( WITH_TBB "Include Intel TBB support" OFF IF ( NOT IOS ) )
OCV_OPTION ( WITH_TIFF "Include TIFF support" ON IF ( NOT IOS ) )
OCV_OPTION ( WITH_UNICAP "Include Unicap support (GPL)" OFF IF ( UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_V4L "Include Video 4 Linux support" ON IF ( UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( WITH_VIDEOINPUT "Build HighGUI with DirectShow support" ON IF WIN32 )
OCV_OPTION ( WITH_XIMEA "Include XIMEA cameras support" OFF IF WIN32 )
OCV_OPTION ( WITH_XINE "Include Xine support (GPL)" OFF IF ( UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS ) )
# OpenCV build components
# ===================================================
if ( ANDROID OR IOS )
OCV_OPTION ( BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF )
else ( )
OCV_OPTION ( BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" ON )
endif ( )
OCV_OPTION ( BUILD_ANDROID_EXAMPLES "Build examples for Android platform" ON IF ANDROID )
OCV_OPTION ( BUILD_DOCS "Create build rules for OpenCV Documentation" ON )
OCV_OPTION ( BUILD_JAVA_SUPPORT "Build with Java support" ON IF ( ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7 ) )
OCV_OPTION ( BUILD_EXAMPLES "Build all examples" OFF )
OCV_OPTION ( BUILD_NEW_PYTHON_SUPPORT "Build with Python support" ON IF ( NOT ANDROID AND NOT IOS ) )
OCV_OPTION ( BUILD_PACKAGE "Enables 'make package_source' command" ON )
OCV_OPTION ( BUILD_PERF_TESTS "Build performance tests" ON IF ( NOT IOS ) )
OCV_OPTION ( BUILD_TESTS "Build accuracy & regression tests" ON IF ( NOT IOS ) )
OCV_OPTION ( BUILD_WITH_DEBUG_INFO "Include debug info into debug libs" ON )
OCV_OPTION ( BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
if ( WIN32 OR ANDROID )
set ( OPENCV_BUILD_3RDPARTY_LIBS TRUE CACHE INTERNAL "Build 3rd party libraries" )
else ( )
# Build 3rdparty libraries under unix
set ( OPENCV_BUILD_3RDPARTY_LIBS FALSE CACHE BOOL "Build 3rd party libraries" )
endif ( )
# OpenCV installation options
# ===================================================
OCV_OPTION ( INSTALL_C_EXAMPLES "Install C examples" OFF )
OCV_OPTION ( INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
OCV_OPTION ( INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )
OCV_OPTION ( INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF ( UNIX AND NOT ANDROID AND NOT IOS ) )
# OpenCV build options
# ===================================================
OCV_OPTION ( ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF ( NOT IOS ) )
OCV_OPTION ( ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" OFF IF ( CMAKE_VERSION VERSION_GREATER "2.8.0" ) )
OCV_OPTION ( ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION ( ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION ( ENABLE_POWERPC "Enable PowerPC for GCC" ON IF ( CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.* ) )
OCV_OPTION ( ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF ( CMAKE_COMPILER_IS_GNUCXX AND ( X86 OR X86_64 ) ) )
OCV_OPTION ( ENABLE_SSE "Enable SSE instructions" ON IF ( MSVC OR CMAKE_COMPILER_IS_GNUCXX AND ( X86 OR X86_64 ) ) )
OCV_OPTION ( ENABLE_SSE2 "Enable SSE2 instructions" ON IF ( MSVC OR CMAKE_COMPILER_IS_GNUCXX AND ( X86 OR X86_64 ) ) )
OCV_OPTION ( ENABLE_SSE3 "Enable SSE3 instructions" OFF IF ( CV_ICC OR CMAKE_COMPILER_IS_GNUCXX AND ( X86 OR X86_64 ) ) )
OCV_OPTION ( ENABLE_SSSE3 "Enable SSSE3 instructions" OFF IF ( CMAKE_COMPILER_IS_GNUCXX AND ( X86 OR X86_64 ) ) )
OCV_OPTION ( ENABLE_SSE41 "Enable SSE4.1 instructions" OFF IF ( CV_ICC OR CMAKE_COMPILER_IS_GNUCXX AND ( X86 OR X86_64 ) ) )
OCV_OPTION ( ENABLE_SSE42 "Enable SSE4.2 instructions" OFF IF ( CMAKE_COMPILER_IS_GNUCXX AND ( X86 OR X86_64 ) ) )
2011-07-05 00:18:12 +08:00
2011-06-14 18:11:16 +08:00
# ----------------------------------------------------------------------------
2011-06-30 15:24:35 +08:00
# Get actual OpenCV version number from sources
2011-06-14 18:11:16 +08:00
# ----------------------------------------------------------------------------
2011-07-22 05:44:48 +08:00
SET ( OPENCV_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/modules/core/include/opencv2/core/version.hpp" )
FILE ( STRINGS "${OPENCV_VERSION_FILE}" OPENCV_VERSION_PARTS REGEX "#define CV_.+OR_VERSION[ ]+[0-9]+" )
2011-06-30 15:24:35 +08:00
string ( REGEX REPLACE ".+CV_MAJOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJOR "${OPENCV_VERSION_PARTS}" )
string ( REGEX REPLACE ".+CV_MINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}" )
string ( REGEX REPLACE ".+CV_SUBMINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}" )
set ( OPENCV_VERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}" )
2011-06-14 18:11:16 +08:00
set ( OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}" )
2011-07-22 05:44:48 +08:00
# create a dependency on version file
2012-01-03 21:48:12 +08:00
# we never use output of the following command but cmake will rerun if version file changes
2011-07-22 05:44:48 +08:00
configure_file ( "${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY )
2011-06-14 18:11:16 +08:00
if ( WIN32 )
# Postfix of DLLs:
2011-07-01 20:14:51 +08:00
set ( OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}" )
2011-06-14 18:11:16 +08:00
set ( OPENCV_DEBUG_POSTFIX d )
else ( )
# Postfix of so's:
set ( OPENCV_DLLVERSION "" )
set ( OPENCV_DEBUG_POSTFIX )
endif ( )
2011-06-29 00:02:09 +08:00
#name mangling
2011-06-29 14:27:08 +08:00
set ( OPENCV_INCLUDE_PREFIX include )
2012-01-03 21:48:12 +08:00
if ( INSTALL_TO_MANGLED_PATHS AND BUILD_SHARED_LIBS )
SET ( OPENCV_MANGLED_INSTALL_PATHS ${ INSTALL_TO_MANGLED_PATHS } )
2011-06-29 00:02:09 +08:00
if ( OPENCV_MANGLED_INSTALL_PATHS )
set ( OPENCV_INCLUDE_PREFIX include/opencv- ${ OPENCV_VERSION } )
endif ( )
endif ( )
2011-06-29 14:27:08 +08:00
# SUBDIRECTORIES:
# Save libs and executables in the same place
2011-07-12 15:40:29 +08:00
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" )
2011-06-29 14:27:08 +08:00
2011-06-30 15:24:35 +08:00
if ( ANDROID OR WIN32 )
2011-06-29 14:27:08 +08:00
set ( OPENCV_DOC_INSTALL_PATH doc )
2011-06-30 15:24:35 +08:00
elseif ( OPENCV_MANGLED_INSTALL_PATHS )
set ( OPENCV_DOC_INSTALL_PATH share/OpenCV- ${ OPENCV_VERSION } /doc )
2011-06-29 14:27:08 +08:00
else ( )
2011-06-30 15:24:35 +08:00
set ( OPENCV_DOC_INSTALL_PATH share/OpenCV/doc )
2011-06-29 14:27:08 +08:00
endif ( )
if ( ANDROID )
2011-11-16 22:32:10 +08:00
set ( OPENCV_LIB_INSTALL_PATH libs/ ${ ANDROID_NDK_ABI_NAME } )
2011-06-29 14:27:08 +08:00
else ( )
2011-08-10 20:49:52 +08:00
set ( OPENCV_LIB_INSTALL_PATH lib ${ LIB_SUFFIX } )
2011-06-29 14:27:08 +08:00
endif ( )
set ( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}" )
set ( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
2011-06-14 18:11:16 +08:00
# ----------------------------------------------------------------------------
# Use statically or dynamically linked CRT?
# Default: dynamic
# ----------------------------------------------------------------------------
if ( MSVC )
2012-01-03 21:48:12 +08:00
if ( NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT )
2011-06-17 23:02:10 +08:00
foreach ( flag_var
C M A K E _ C _ F L A G S C M A K E _ C _ F L A G S _ D E B U G C M A K E _ C _ F L A G S _ R E L E A S E
C M A K E _ C _ F L A G S _ M I N S I Z E R E L C M A K E _ C _ F L A G S _ R E L W I T H D E B I N F O
C M A K E _ C X X _ F L A G S C M A K E _ C X X _ F L A G S _ D E B U G C M A K E _ C X X _ F L A G S _ R E L E A S E
C M A K E _ C X X _ F L A G S _ M I N S I Z E R E L C M A K E _ C X X _ F L A G S _ R E L W I T H D E B I N F O )
if ( ${ flag_var } MATCHES "/MD" )
string ( REGEX REPLACE "/MD" "/MT" ${ flag_var } "${${flag_var}}" )
2011-06-28 13:18:53 +08:00
endif ( )
2011-06-17 23:02:10 +08:00
if ( ${ flag_var } MATCHES "/MDd" )
string ( REGEX REPLACE "/MDd" "/MTd" ${ flag_var } "${${flag_var}}" )
2011-06-28 13:18:53 +08:00
endif ( )
2011-06-17 23:02:10 +08:00
endforeach ( flag_var )
2011-11-28 16:23:26 +08:00
2011-06-17 23:02:10 +08:00
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" )
2012-01-03 21:48:12 +08:00
else ( )
2011-06-17 23:02:10 +08:00
foreach ( flag_var
C M A K E _ C _ F L A G S C M A K E _ C _ F L A G S _ D E B U G C M A K E _ C _ F L A G S _ R E L E A S E
C M A K E _ C _ F L A G S _ M I N S I Z E R E L C M A K E _ C _ F L A G S _ R E L W I T H D E B I N F O
C M A K E _ C X X _ F L A G S C M A K E _ C X X _ F L A G S _ D E B U G C M A K E _ C X X _ F L A G S _ R E L E A S E
C M A K E _ C X X _ F L A G S _ M I N S I Z E R E L C M A K E _ C X X _ F L A G S _ R E L W I T H D E B I N F O )
if ( ${ flag_var } MATCHES "/MT" )
string ( REGEX REPLACE "/MT" "/MD" ${ flag_var } "${${flag_var}}" )
2011-06-28 13:18:53 +08:00
endif ( )
2011-06-17 23:02:10 +08:00
if ( ${ flag_var } MATCHES "/MTd" )
string ( REGEX REPLACE "/MTd" "/MDd" ${ flag_var } "${${flag_var}}" )
2011-06-28 13:18:53 +08:00
endif ( )
2011-06-17 23:02:10 +08:00
endforeach ( flag_var )
2012-01-03 21:48:12 +08:00
endif ( )
2011-07-05 00:18:12 +08:00
2011-12-19 21:20:34 +08:00
if ( NOT ${ CMAKE_MAJOR_VERSION } . ${ CMAKE_MINOR_VERSION } LESS 2.8 AND NOT ${ CMAKE_MINOR_VERSION } . ${ CMAKE_PATCH_VERSION } LESS 8.6 )
include ( ProcessorCount )
ProcessorCount ( N )
if ( NOT N EQUAL 0 )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${N} " )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${N} " )
endif ( )
2011-12-16 15:14:55 +08:00
endif ( )
2011-07-05 00:18:12 +08:00
if ( NOT BUILD_WITH_DEBUG_INFO )
string ( REPLACE "/debug" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/DEBUG" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/debug" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/DEBUG" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/debug" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/DEBUG" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" )
string ( REPLACE "/Zi" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" )
string ( REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" )
endif ( )
2011-06-14 18:11:16 +08:00
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
# ----------------------------------------------------------------------------
2011-06-22 18:38:57 +08:00
find_host_program ( SVNVERSION_PATH svnversion )
2011-06-14 18:11:16 +08:00
mark_as_advanced ( force SVNVERSION_PATH )
if ( SVNVERSION_PATH )
message ( STATUS "Extracting svn version, please wait..." )
2011-06-14 18:19:56 +08:00
execute_process ( COMMAND ${ SVNVERSION_PATH } -n ${ OpenCV_SOURCE_DIR } OUTPUT_VARIABLE SVNVERSION_RESULT )
2011-06-14 18:11:16 +08:00
if ( SVNVERSION_RESULT MATCHES "exported" )
2011-07-01 03:45:52 +08:00
# This is NOT a svn repository:
set ( OPENCV_SVNVERSION "" )
message ( STATUS "SVNVERSION: exported" )
2011-06-14 18:11:16 +08:00
else ( )
set ( OPENCV_SVNVERSION " svn:${SVNVERSION_RESULT}" )
2011-06-30 15:24:35 +08:00
message ( STATUS "SVNVERSION: ${OPENCV_SVNVERSION}" )
2011-06-14 18:11:16 +08:00
endif ( )
else ( )
# We don't have svnversion:
set ( OPENCV_SVNVERSION "" )
endif ( )
# ----------------------------------------------------------------------------
# CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
# ----------------------------------------------------------------------------
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVPCHSupport.cmake REQUIRED )
include ( cmake/OpenCVModule.cmake REQUIRED )
2011-06-14 18:11:16 +08:00
2011-07-25 04:44:20 +08:00
if ( ANDROID )
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVAndroidProject.cmake REQUIRED )
2011-06-14 18:11:16 +08:00
endif ( )
if ( UNIX )
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVFindPkgConfig.cmake OPTIONAL )
2011-06-14 18:11:16 +08:00
include ( CheckFunctionExists )
include ( CheckIncludeFile )
endif ( )
2011-11-21 19:58:52 +08:00
set ( HAVE_OPENGL 0 )
2011-06-14 18:11:16 +08:00
if ( UNIX )
if ( NOT APPLE )
if ( WITH_GTK )
CHECK_MODULE ( gtk+-2.0 HAVE_GTK )
CHECK_MODULE ( gthread-2.0 HAVE_GTHREAD )
2011-11-28 16:23:26 +08:00
if ( WITH_OPENGL )
CHECK_MODULE ( gtkglext-1.0 HAVE_GTKGLEXT )
if ( HAVE_GTKGLEXT )
find_package ( OpenGL QUIET )
if ( OPENGL_FOUND )
set ( HAVE_OPENGL 1 )
set ( OPENCV_LINKER_LIBS ${ OPENCV_LINKER_LIBS } ${ OPENGL_LIBRARIES } )
include_directories ( ${ OPENGL_INCLUDE_DIR } )
endif ( )
endif ( )
endif ( )
2011-06-14 18:11:16 +08:00
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"
P A T H S " / u s r / l o c a l / i n c l u d e " " / u s r / i n c l u d e "
D O C " T h e p a t h t o P v A P I h e a d e r " )
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 ( )
2011-11-28 16:23:26 +08:00
if ( NOT APPLE )
2011-06-14 18:11:16 +08:00
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 ( )
2011-07-12 15:40:29 +08:00
if ( ANDROID )
2011-06-14 18:11:16 +08:00
set ( OPENCV_LINKER_LIBS dl m log )
2011-07-12 15:40:29 +08:00
elseif ( ${ CMAKE_SYSTEM_NAME } MATCHES "FreeBSD" OR ${ CMAKE_SYSTEM_NAME } MATCHES "NetBSD" )
set ( OPENCV_LINKER_LIBS m pthread )
2011-06-14 18:11:16 +08:00
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 ( )
2011-10-04 00:59:24 +08:00
if ( UNIX OR WIN32 )
2011-11-28 16:23:26 +08:00
if ( NOT OPENCV_BUILD_3RDPARTY_LIBS )
message ( STATUS "NOT OPENCV_BUILD_3RDPARTY_LIBS **************************************************" )
2011-10-04 00:59:24 +08:00
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 )
2011-11-28 16:23:26 +08:00
include ( FindJPEG )
2011-10-04 00:59:24 +08:00
else ( )
2011-11-28 16:23:26 +08:00
set ( JPEG_FOUND FALSE )
2011-10-04 00:59:24 +08:00
endif ( )
endif ( )
endif ( )
2011-06-14 18:11:16 +08:00
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 ( )
2011-06-27 21:59:03 +08:00
if ( NOT ZLIB_FOUND )
set ( ZLIB_LIBRARY zlib )
endif ( )
2011-06-14 18:11:16 +08:00
#message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}")
if ( WITH_OPENEXR )
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVFindOpenEXR.cmake )
2011-06-14 18:11:16 +08:00
endif ( )
2011-06-22 19:53:15 +08:00
if ( BUILD_DOCS )
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVFindLATEX.cmake REQUIRED )
2011-06-22 18:38:57 +08:00
endif ( )
2011-06-14 18:11:16 +08:00
2011-06-22 18:38:57 +08:00
# Always try to find python
# ===================================================
find_host_package ( PythonInterp )
find_host_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 )
2011-06-28 13:18:53 +08:00
endif ( )
2011-06-22 18:38:57 +08:00
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } --version
E R R O R _ V A R I A B L E P Y T H O N _ V E R S I O N _ F U L L
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
2011-06-28 13:18:53 +08:00
string ( REGEX MATCH "[0-9]+.[0-9]+" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}" )
2011-07-02 23:12:07 +08:00
if ( CMAKE_HOST_UNIX )
2011-07-08 06:10:13 +08:00
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "from distutils.sysconfig import *; print get_python_lib()"
R E S U L T _ V A R I A B L E P Y T H O N _ C V P Y _ P R O C E S S
O U T P U T _ V A R I A B L E P Y T H O N _ S T D _ P A C K A G E S _ P A T H
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
if ( "${PYTHON_STD_PACKAGES_PATH}" MATCHES "site-packages" )
2011-06-22 18:38:57 +08:00
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.
2011-07-08 06:10:13 +08:00
set ( PYTHON_PACKAGES_PATH lib/python ${ PYTHON_VERSION_MAJOR_MINOR } /dist-packages CACHE PATH "Where to install the python packages." )
2011-06-14 18:11:16 +08:00
endif ( )
2011-06-22 18:38:57 +08:00
endif ( )
2011-07-02 23:12:07 +08:00
if ( CMAKE_HOST_WIN32 )
2011-06-22 18:38:57 +08:00
get_filename_component ( PYTHON_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE CACHE )
set ( PYTHON_PACKAGES_PATH "${PYTHON_PATH}/Lib/site-packages" )
endif ( )
2011-07-12 15:40:29 +08:00
IF ( "${PYTHON_VERSION_MAJOR_MINOR}" VERSION_GREATER 2.4 )
2011-06-27 16:24:10 +08:00
SET ( PYTHON_EXECUTABLE ${ PYTHON_EXECUTABLE } -B )
ENDIF ( )
2011-06-22 18:38:57 +08:00
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
2011-06-23 17:16:55 +08:00
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
2011-06-22 18:38:57 +08:00
R E S U L T _ V A R I A B L E P Y T H O N _ N U M P Y _ P R O C E S S
O U T P U T _ V A R I A B L E P Y T H O N _ N U M P Y _ I N C L U D E _ D I R S
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
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 } )
2011-06-22 19:53:15 +08:00
message ( STATUS " Use NumPy headers from: ${PYTHON_NUMPY_INCLUDE_DIRS}" )
2011-06-22 18:38:57 +08:00
else ( )
set ( PYTHON_USE_NUMPY 0 )
endif ( )
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "import sphinx; print sphinx.__version__"
R E S U L T _ V A R I A B L E S P H I N X _ P R O C E S S
O U T P U T _ V A R I A B L E S P H I N X _ V E R S I O N
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
set ( HAVE_SPHINX 0 )
if ( SPHINX_PROCESS EQUAL 0 )
find_host_program ( SPHINX_BUILD sphinx-build )
if ( SPHINX_BUILD )
2011-06-14 18:11:16 +08:00
set ( HAVE_SPHINX 1 )
message ( STATUS " Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}" )
endif ( )
endif ( )
2011-06-24 15:48:04 +08:00
# Java support
# ===================================================
2012-01-03 21:48:12 +08:00
if ( BUILD_JAVA_SUPPORT AND PYTHON_EXECUTABLE )
2011-06-30 15:24:35 +08:00
file ( TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH )
file ( TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH )
if ( ANDROID )
file ( TO_CMAKE_PATH "$ENV{ANDROID_SDK}" ANDROID_SDK_ENV_PATH )
2011-11-28 16:23:26 +08:00
2011-06-30 15:24:35 +08:00
#find android SDK
find_host_program ( ANDROID_EXECUTABLE
N A M E S a n d r o i d . b a t a n d r o i d
P A T H S " $ { A N D R O I D _ S D K _ E N V _ P A T H } / t o o l s / "
" $ { P r o g r a m F i l e s _ E N V _ P A T H } / A n d r o i d / a n d r o i d - s d k / t o o l s / "
" / o p t / a n d r o i d - s d k / t o o l s / "
" / o p t / a n d r o i d - s d k - l i n u x _ x 8 6 / t o o l s / "
" / o p t / a n d r o i d - s d k - m a c _ x 8 6 / t o o l s / "
" / o p t / a n d r o i d - s d k - l i n u x _ 8 6 / t o o l s / "
" / o p t / a n d r o i d - s d k - m a c _ 8 6 / t o o l s / "
)
if ( ANDROID_EXECUTABLE )
2011-07-13 17:10:21 +08:00
message ( STATUS " Found android tool: ${ANDROID_EXECUTABLE}" )
2011-07-12 23:59:31 +08:00
get_filename_component ( ANDROID_SDK_TOOLS_PATH "${ANDROID_EXECUTABLE}" PATH )
#read source.properties
2011-07-13 17:10:21 +08:00
if ( EXISTS "${ANDROID_SDK_TOOLS_PATH}/source.properties" )
file ( STRINGS "${ANDROID_SDK_TOOLS_PATH}/source.properties" ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES REGEX "^[ ]*[^#].*$" )
foreach ( line ${ ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES } )
string ( REPLACE "\\:" ":" line ${ line } )
string ( REPLACE "=" ";" line ${ line } )
list ( GET line 0 line_name )
list ( GET line 1 line_value )
string ( REPLACE "." "_" line_name ${ line_name } )
SET ( ANDROID_TOOLS_ ${ line_name } "${line_value}" )
MARK_AS_ADVANCED ( ANDROID_TOOLS_ ${ line_name } )
endforeach ( )
2011-07-13 17:17:41 +08:00
endif ( )
if ( NOT ANDROID_TOOLS_Pkg_Revision )
SET ( ANDROID_TOOLS_Pkg_Revision "Unknown" )
MARK_AS_ADVANCED ( ANDROID_TOOLS_Pkg_Revision )
endif ( )
if ( NOT ANDROID_TOOLS_Pkg_Desc )
SET ( ANDROID_TOOLS_Pkg_Desc "Android SDK Tools, revision ${ANDROID_TOOLS_Pkg_Revision}." )
if ( NOT ANDROID_TOOLS_Pkg_Revision GREATER 11 )
SET ( ANDROID_TOOLS_Pkg_Desc "${ANDROID_TOOLS_Pkg_Desc} It is recommended to update your SDK tools to revision 12 or newer." )
endif ( )
2011-07-13 17:10:21 +08:00
MARK_AS_ADVANCED ( ANDROID_TOOLS_Pkg_Desc )
endif ( )
2011-07-12 23:59:31 +08:00
#get installed targets
2011-07-13 21:06:14 +08:00
execute_process ( COMMAND ${ ANDROID_EXECUTABLE } list target
2011-07-12 23:59:31 +08:00
R E S U L T _ V A R I A B L E A N D R O I D _ P R O C E S S
2011-07-13 21:06:14 +08:00
O U T P U T _ V A R I A B L E A N D R O I D _ S D K _ T A R G E T S _ F U L L
2011-07-13 17:10:21 +08:00
E R R O R _ V A R I A B L E A N D R O I D _ P R O C E S S _ E R R O R S
2011-07-12 23:59:31 +08:00
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
2011-07-13 21:06:14 +08:00
string ( REGEX MATCHALL "(^|\n)id: [0-9]+ or \" ( [^\n]+[0-9+] ) \"(\n|$)" ANDROID_SDK_TARGETS_FULL "${ANDROID_SDK_TARGETS_FULL}" )
SET ( ANDROID_SDK_TARGETS )
if ( ANDROID_PROCESS EQUAL 0 )
foreach ( line ${ ANDROID_SDK_TARGETS_FULL } )
string ( REGEX REPLACE "(^|\n)id: [0-9]+ or \" ( [^\n]+[0-9+] ) \"(\n|$)" "\\2" line "${line}" )
list ( APPEND ANDROID_SDK_TARGETS "${line}" )
endforeach ( )
endif ( )
2011-07-13 17:10:21 +08:00
# detect ANDROID_SDK_TARGET if no target is provided by user
2011-07-12 23:59:31 +08:00
if ( NOT ANDROID_SDK_TARGET )
2011-11-16 22:32:10 +08:00
set ( desired_android_target_level ${ ANDROID_NATIVE_API_LEVEL } )
2011-07-13 21:06:14 +08:00
if ( desired_android_target_level LESS 8 )
set ( desired_android_target_level 8 )
endif ( )
if ( ANDROID_PROCESS EQUAL 0 )
math ( EXPR desired_android_target_level_1 "${desired_android_target_level}-1" )
2011-07-13 17:10:21 +08:00
foreach ( target ${ ANDROID_SDK_TARGETS } )
string ( REGEX MATCH "[0-9]+$" target_level "${target}" )
2011-07-13 21:06:14 +08:00
if ( target_level GREATER desired_android_target_level_1 )
2011-07-13 17:10:21 +08:00
set ( ANDROID_SDK_TARGET "${target}" )
break ( )
endif ( )
endforeach ( )
2011-07-13 21:06:14 +08:00
else ( )
set ( ANDROID_SDK_TARGET android- ${ desired_android_target_level } )
message ( WARNING "Could not retrieve list of installed Android targets. Will try to use \" ${ ANDROID_SDK_TARGET } \" target " )
2011-07-13 17:10:21 +08:00
endif ( )
2011-07-12 23:59:31 +08:00
endif ( )
SET ( ANDROID_SDK_TARGET ${ ANDROID_SDK_TARGET } CACHE STRING "SDK target for Android tests and samples" )
2011-09-18 23:30:36 +08:00
if ( ANDROID_PROCESS EQUAL 0 AND CMAKE_VERSION VERSION_GREATER "2.8" )
2011-07-13 17:10:21 +08:00
set_property ( CACHE ANDROID_SDK_TARGET PROPERTY STRINGS ${ ANDROID_SDK_TARGETS } )
endif ( )
2011-07-12 23:59:31 +08:00
string ( REGEX MATCH "[0-9]+$" ANDROID_SDK_TARGET_LEVEL "${ANDROID_SDK_TARGET}" )
2011-06-30 15:24:35 +08:00
endif ( )
endif ( )
#find apache ant
find_host_program ( ANT_EXECUTABLE NAMES ant.bat ant
P A T H S " $ { A N T _ D I R _ E N V _ P A T H } / b i n "
" $ { P r o g r a m F i l e s _ E N V _ P A T H } / a p a c h e - a n t / b i n "
)
if ( ANT_EXECUTABLE )
execute_process ( COMMAND ${ ANT_EXECUTABLE } -version
O U T P U T _ V A R I A B L E A N T _ V E R S I O N _ F U L L
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
string ( REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" ANT_VERSION "${ANT_VERSION_FULL}" )
2011-06-30 21:37:56 +08:00
2011-06-30 15:24:35 +08:00
message ( STATUS " Found apache ant ${ANT_VERSION}: ${ANT_EXECUTABLE}" )
endif ( )
2011-07-12 23:59:31 +08:00
if ( ANDROID_EXECUTABLE AND ANT_EXECUTABLE AND ( ANT_VERSION VERSION_GREATER 1.7 ) AND ( ANDROID_SDK_TARGET_LEVEL GREATER 7 ) )
2011-06-30 15:24:35 +08:00
SET ( CAN_BUILD_ANDROID_PROJECTS TRUE )
else ( )
SET ( CAN_BUILD_ANDROID_PROJECTS FALSE )
endif ( )
endif ( )
2012-01-03 21:48:12 +08:00
if ( NOT CAN_BUILD_ANDROID_PROJECTS )
UNSET ( BUILD_ANDROID_EXAMPLES CACHE )
2011-07-04 16:18:02 +08:00
endif ( )
2011-06-14 18:11:16 +08:00
#YV
############################### QT ################################
set ( HAVE_QT 0 )
set ( HAVE_QT_OPENGL 0 )
if ( WITH_QT )
find_package ( Qt4 )
if ( QT4_FOUND )
set ( HAVE_QT 1 )
2011-12-12 20:52:06 +08:00
add_definitions ( -DHAVE_QT ) #We need to define te macro this way, using cvconfig.h.cmake does not work
2011-06-14 18:11:16 +08:00
2011-11-21 19:58:52 +08:00
if ( WITH_OPENGL )
2011-12-12 20:52:06 +08:00
find_package ( OpenGL QUIET )
2011-07-12 15:40:29 +08:00
if ( QT_QTOPENGL_FOUND AND OPENGL_FOUND )
2011-12-12 20:52:06 +08:00
set ( HAVE_OPENGL 1 )
2011-07-12 15:40:29 +08:00
set ( HAVE_QT_OPENGL 1 )
add_definitions ( -DHAVE_QT_OPENGL )
set ( OPENCV_LINKER_LIBS ${ OPENCV_LINKER_LIBS } ${ OPENGL_LIBRARIES } )
endif ( )
2011-06-14 18:11:16 +08:00
endif ( )
endif ( )
endif ( )
############################### TBB ################################
if ( WITH_TBB )
2011-06-17 02:00:41 +08:00
if ( UNIX AND NOT APPLE AND NOT ANDROID )
2011-06-14 18:11:16 +08:00
PKG_CHECK_MODULES ( TBB tbb )
if ( TBB_FOUND )
set ( HAVE_TBB 1 )
if ( NOT ${ TBB_INCLUDE_DIRS } STREQUAL "" )
include_directories ( ${ TBB_INCLUDE_DIRS } )
endif ( )
link_directories ( ${ TBB_LIBRARY_DIRS } )
2011-11-28 16:23:26 +08:00
set ( OPENCV_LINKER_LIBS ${ OPENCV_LINKER_LIBS } ${ TBB_LIBRARIES } )
2011-06-14 18:11:16 +08:00
endif ( )
2011-11-28 16:23:26 +08:00
endif ( )
2011-06-14 18:11:16 +08:00
if ( NOT HAVE_TBB )
2011-06-17 02:00:41 +08:00
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" "${CMAKE_INSTALL_PREFIX}/include" )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
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 )
2011-06-17 02:00:41 +08:00
elseif ( ANDROID )
2011-11-01 00:22:05 +08:00
set ( OPENCV_LINKER_LIBS ${ OPENCV_LINKER_LIBS } tbb )
2011-06-17 02:00:41 +08:00
add_definitions ( -DTBB_USE_GCC_BUILTINS )
2011-06-14 18:11:16 +08:00
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 ( )
2011-11-28 16:23:26 +08:00
get_filename_component ( _TBB_LIB_PATH "${TBB_INCLUDE_DIR}/../lib" ABSOLUTE )
2011-07-05 00:18:12 +08:00
if ( ${ CMAKE_SYSTEM_PROCESSOR } MATCHES amd64*|x86_64* OR MSVC64 )
2011-06-14 18:11:16 +08:00
set ( _TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64" )
2011-07-05 00:18:12 +08:00
elseif ( ${ CMAKE_SYSTEM_PROCESSOR } MATCHES x86*|i386*|i686* )
2011-06-14 18:11:16 +08:00
set ( _TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32" )
endif ( )
if ( MSVC80 )
set ( _TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8" )
elseif ( MSVC90 )
2011-11-28 16:23:26 +08:00
set ( _TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9" )
2011-06-14 18:11:16 +08:00
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 )
############################ Intel IPP #############################
set ( IPP_FOUND )
if ( WITH_IPP )
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVFindIPP.cmake )
2011-06-14 18:11:16 +08:00
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 )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
if ( CUDA_FOUND )
set ( HAVE_CUDA 1 )
2011-10-19 17:53:22 +08:00
if ( WITH_CUFFT )
set ( HAVE_CUFFT 1 )
endif ( )
if ( WITH_CUBLAS )
set ( HAVE_CUBLAS 1 )
endif ( )
2011-06-14 18:11:16 +08:00
message ( STATUS "CUDA detected: " ${ CUDA_VERSION } )
2011-06-15 16:05:34 +08:00
set ( CUDA_ARCH_BIN "1.1 1.2 1.3 2.0 2.1(2.0)" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported" )
set ( CUDA_ARCH_PTX "2.0" CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for" )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
string ( REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}" )
string ( REGEX REPLACE "\\." "" ARCH_PTX_NO_POINTS "${CUDA_ARCH_PTX}" )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
# 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 ( )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
# NVCC flags to be set
2011-11-28 16:23:26 +08:00
set ( NVCC_FLAGS_EXTRA "" )
2011-06-14 18:11:16 +08:00
# These vars will be passed into the templates
2011-11-28 16:23:26 +08:00
set ( OPENCV_CUDA_ARCH_BIN "" )
set ( OPENCV_CUDA_ARCH_PTX "" )
set ( OPENCV_CUDA_ARCH_FEATURES "" )
2011-06-14 18:11:16 +08:00
# 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 ( )
2011-11-28 16:23:26 +08:00
# User didn't explicitly specify PTX for the concrete BIN, we assume PTX=BIN
2011-06-14 18:11:16 +08:00
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 ( )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
# 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 ( )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
# These vars will be processed in other scripts
2011-11-28 16:23:26 +08:00
set ( CUDA_NVCC_FLAGS ${ CUDA_NVCC_FLAGS } ${ NVCC_FLAGS_EXTRA } )
2011-06-14 18:11:16 +08:00
set ( OpenCV_CUDA_CC "${NVCC_FLAGS_EXTRA}" )
2011-11-28 16:23:26 +08:00
2011-06-15 16:05:34 +08:00
message ( STATUS "CUDA NVCC target flags: ${CUDA_NVCC_FLAGS}" )
2011-06-14 18:11:16 +08:00
else ( )
2011-06-17 23:02:10 +08:00
unset ( CUDA_ARCH_BIN CACHE )
2011-11-28 16:23:26 +08:00
unset ( CUDA_ARCH_PTX CACHE )
endif ( )
2011-06-14 18:11:16 +08:00
endif ( )
############################### OpenNI ################################
set ( HAVE_OPENNI FALSE )
set ( HAVE_OPENNI_PRIME_SENSOR_MODULE FALSE )
if ( WITH_OPENNI )
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVFindOpenNI.cmake )
2011-06-14 18:11:16 +08:00
endif ( )
2011-08-12 01:59:30 +08:00
############################### XIMEA ################################
set ( HAVE_XIMEA FALSE )
2011-11-28 16:23:26 +08:00
2011-08-12 01:59:30 +08:00
if ( WITH_XIMEA )
2012-01-03 21:48:12 +08:00
include ( cmake/OpenCVFindXimea.cmake )
2011-08-12 01:59:30 +08:00
endif ( )
if ( XIMEA_FOUND )
set ( HAVE_XIMEA TRUE )
endif ( )
2011-06-14 18:11:16 +08:00
############################## Eigen ##############################
if ( WITH_EIGEN )
2011-06-28 13:18:53 +08:00
find_path ( EIGEN_INCLUDE_PATH "Eigen/Core"
2011-06-14 18:11:16 +08:00
P A T H S " / u s r / l o c a l / i n c l u d e / e i g e n 2 " " / o p t / i n c l u d e / e i g e n 2 " " / u s r / i n c l u d e / e i g e n 2 "
" / u s r / l o c a l / i n c l u d e / e i g e n 3 " " / o p t / i n c l u d e / e i g e n 3 " " / u s r / i n c l u d e / e i g e n 3 "
D O C " T h e p a t h t o E i g e n 2 / E i g e n 3 h e a d e r s " )
if ( EIGEN_INCLUDE_PATH )
include_directories ( ${ EIGEN_INCLUDE_PATH } )
set ( HAVE_EIGEN 1 )
endif ( )
endif ( )
################## Extra HighGUI libs on Windows ###################
if ( WIN32 )
2011-06-16 17:51:34 +08:00
set ( HIGHGUI_LIBRARIES ${ HIGHGUI_LIBRARIES } comctl32 gdi32 ole32 )
if ( WITH_VIDEOINPUT )
set ( HAVE_VIDEOINPUT 1 )
endif ( )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
if ( MSVC )
set ( HIGHGUI_LIBRARIES ${ HIGHGUI_LIBRARIES } vfw32 )
endif ( )
if ( MINGW )
if ( MINGW64 )
set ( HIGHGUI_LIBRARIES ${ HIGHGUI_LIBRARIES } msvfw32 avifil32 avicap32 winmm )
else ( )
set ( HIGHGUI_LIBRARIES ${ HIGHGUI_LIBRARIES } vfw32 winmm )
2011-11-28 16:23:26 +08:00
endif ( )
2011-06-14 18:11:16 +08:00
endif ( )
2011-11-21 19:58:52 +08:00
2011-11-28 16:23:26 +08:00
if ( WITH_OPENGL AND NOT HAVE_QT_OPENGL )
2011-11-21 19:58:52 +08:00
find_package ( OpenGL QUIET )
2011-11-28 16:23:26 +08:00
if ( OPENGL_FOUND )
2011-11-21 19:58:52 +08:00
set ( HAVE_OPENGL 1 )
set ( OPENCV_LINKER_LIBS ${ OPENCV_LINKER_LIBS } ${ OPENGL_LIBRARIES } )
include_directories ( ${ OPENGL_INCLUDE_DIR } )
endif ( )
endif ( )
2011-06-14 18:11:16 +08:00
endif ( )
2011-06-17 21:52:55 +08:00
############## Android source tree for native camera ###############
2011-11-16 22:32:10 +08:00
if ( ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7 )
2011-11-28 16:23:26 +08:00
SET ( ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH
2011-06-17 21:52:55 +08:00
" P a t h t o A n d r o i d s o u r c e t r e e .
S e t t h i s v a r i a b l e t o p a t h t o y o u r A n d r o i d s o u r c e s t o c o m p i l e
l i b n a t i v e _ c a m e r a _ r x . x . x . s o f o r y o u r A n d r o i d " )
SET ( BUILD_ANDROID_CAMERA_WRAPPER OFF )
if ( ANDROID_SOURCE_TREE )
2011-09-01 22:39:26 +08:00
FILE ( STRINGS "${ANDROID_SOURCE_TREE}/development/sdk/platform_source.properties" ANDROID_VERSION REGEX "Platform\\.Version=[0-9]+\\.[0-9]+(\\.[0-9]+)?" )
string ( REGEX REPLACE "Platform\\.Version=([0-9]+\\.[0-9]+(\\.[0-9]+)?)" "\\1" ANDROID_VERSION "${ANDROID_VERSION}" )
if ( ANDROID_VERSION MATCHES "^[0-9]+\\.[0-9]+$" )
SET ( ANDROID_VERSION "${ANDROID_VERSION}.0" )
endif ( )
2011-06-17 21:52:55 +08:00
if ( NOT "${ANDROID_VERSION}" STREQUAL "" )
SET ( BUILD_ANDROID_CAMERA_WRAPPER ON )
endif ( )
endif ( )
2011-07-12 23:59:31 +08:00
MARK_AS_ADVANCED ( ANDROID_SOURCE_TREE )
2011-06-17 21:52:55 +08:00
endif ( )
2011-06-14 18:11:16 +08:00
# ----------------------------------------------------------------------------
# UPDATE CONFIG FILES & SCRIPTS:
#
# CONFIGURE_FILE(InputFile OutputFile [COPYONLY] [ESCAPE_QUOTES] [@ONLY])
2011-06-28 13:18:53 +08:00
# If @ONLY is specified, only variables of the form @VAR@ will be
2011-06-14 18:11:16 +08:00
# replaces and ${VAR} will be ignored.
#
# A directory will be created for each platform so the "cvconfig.h" file is
2011-06-28 13:18:53 +08:00
# not overwritten if cmake generates code in the same path.
2011-06-14 18:11:16 +08:00
# ----------------------------------------------------------------------------
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'" )
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h" )
2011-06-14 18:11:16 +08:00
# ---------------------------------------------------------------------------
# The C+//0 include & link directories:
# ---------------------------------------------------------------------------
include_directories ( "."
" $ { O P E N C V _ C O N F I G _ F I L E _ I N C L U D E _ D I R } "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / i n c l u d e "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / i n c l u d e / o p e n c v "
)
# ----------------------------------------------------------------------------
# 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" )
2011-06-30 15:24:35 +08:00
if ( WIN32 AND ${ CMAKE_GENERATOR } MATCHES "(MinGW)|(MSYS)" )
set ( CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG" CACHE STRING "" )
endif ( )
2011-06-14 18:11:16 +08:00
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()
2011-07-05 00:18:12 +08:00
if ( BUILD_WITH_DEBUG_INFO )
set ( EXTRA_EXE_LINKER_FLAGS_RELEASE "${EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug" )
endif ( )
2011-06-14 18:11:16 +08:00
# Remove unreferenced functions: function level linking
set ( EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Gy" )
2011-07-05 00:18:12 +08:00
if ( BUILD_WITH_DEBUG_INFO )
set ( EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Zi" )
endif ( )
2011-06-14 18:11:16 +08:00
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.
2011-07-12 15:40:29 +08:00
if ( X86_64 )
2011-06-28 13:18:53 +08:00
set ( EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long" )
2011-06-14 18:11:16 +08:00
endif ( )
# We need pthread's
2011-06-28 13:18:53 +08:00
if ( UNIX AND NOT ANDROID )
2011-06-14 18:11:16 +08:00
set ( EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -pthread" )
endif ( )
if ( OPENCV_WARNINGS_ARE_ERRORS )
set ( EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror" )
endif ( )
2011-06-28 13:18:53 +08:00
if ( X86 AND NOT MINGW64 AND NOT X86_64 AND NOT APPLE )
set ( EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -march=i686" )
2011-06-14 18:11:16 +08:00
endif ( )
# Other optimizations
2012-01-03 21:48:12 +08:00
if ( ENABLE_OMIT_FRAME_POINTER )
2011-06-14 18:11:16 +08:00
set ( EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer" )
2012-01-03 21:48:12 +08:00
else ( )
set ( EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fno-omit-frame-pointer" )
2011-06-14 18:11:16 +08:00
endif ( )
2012-01-03 21:48:12 +08:00
if ( ENABLE_FAST_MATH )
2011-06-14 18:11:16 +08:00
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 ( )
2011-11-28 16:23:26 +08:00
2011-06-14 18:11:16 +08:00
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 ( )
2011-11-28 16:23:26 +08:00
2011-07-12 15:40:29 +08:00
if ( HAVE_GCC42_OR_NEWER OR APPLE )
2011-06-14 18:11:16 +08:00
if ( ENABLE_SSSE3 )
set ( EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mssse3" )
endif ( )
2011-07-12 15:40:29 +08:00
if ( HAVE_GCC43_OR_NEWER )
2011-06-14 18:11:16 +08:00
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 )
2011-08-18 04:12:11 +08:00
if ( NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4 )
2011-06-28 13:18:53 +08:00
set ( EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mfpmath=387" )
2011-06-14 18:11:16 +08:00
endif ( )
endif ( )
# Profiling?
if ( ENABLE_PROFILING )
set ( EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -pg -g" )
2011-06-28 13:18:53 +08:00
elseif ( NOT APPLE )
2011-06-30 15:24:35 +08:00
# Remove unreferenced functions: function level linking
2011-06-28 13:18:53 +08:00
set ( EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections" )
2011-06-14 18:11:16 +08:00
endif ( )
set ( EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG" )
2011-07-05 00:18:12 +08:00
set ( EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG" )
if ( BUILD_WITH_DEBUG_INFO )
set ( EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -ggdb3" )
endif ( )
2011-06-14 18:11:16 +08:00
endif ( )
if ( MSVC )
2011-07-05 00:18:12 +08:00
# 64-bit MSVC compiler uses SSE/SSE2 by default
if ( NOT MSVC64 )
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 ( )
2011-06-14 18:11:16 +08:00
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:
2011-06-28 13:18:53 +08:00
if ( NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID )
# Android does not need these settings because they are already set by toolchain file
set ( OPENCV_LINKER_LIBS ${ OPENCV_LINKER_LIBS } stdc++ )
set ( OPENCV_EXTRA_C_FLAGS "-fPIC ${OPENCV_EXTRA_C_FLAGS}" )
2011-06-14 18:11:16 +08:00
endif ( )
# Add user supplied extra options (optimization, etc...)
# ==========================================================
2011-06-27 21:59:03 +08:00
set ( OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS}" CACHE STRING "Extra compiler options" )
set ( OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE}" CACHE STRING "Extra compiler options for Release build" )
set ( OPENCV_EXTRA_C_FLAGS_DEBUG "${OPENCV_EXTRA_C_FLAGS_DEBUG}" CACHE STRING "Extra compiler options for Debug build" )
set ( OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS}" CACHE STRING "Extra linker flags" FORCE )
set ( OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Extra linker flags for Release build" FORCE )
set ( OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING "Extra linker flags for Debug build" FORCE )
2011-06-14 18:11:16 +08:00
2011-06-28 13:18:53 +08:00
#combine all "extra" options
2011-06-14 18:11:16 +08:00
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:
2012-01-03 21:48:12 +08:00
if ( CMAKE_GENERATOR MATCHES ".*Makefiles" AND "${CMAKE_BUILD_TYPE}" STREQUAL "" )
2011-06-28 13:18:53 +08:00
set ( CMAKE_BUILD_TYPE Release )
2011-06-14 18:11:16 +08:00
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}" )
2011-06-28 13:18:53 +08:00
string ( REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
string ( REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" )
2011-06-14 18:11:16 +08:00
endif ( )
if ( "${CMAKE_CONFIGURE_LDFLAGS}" )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_CONFIGURE_LDFLAGS}" )
endif ( "${CMAKE_CONFIGURE_LDFLAGS}" )
# --------------------------------------------------------------------------------------------
2011-06-28 13:18:53 +08:00
# Installation for CMake Module: OpenCVConfig.cmake
2011-06-14 18:11:16 +08:00
# 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"
# -------------------------------------------------------------------------------------------
set ( CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\" ${ OPENCV_CONFIG_FILE_INCLUDE_DIR } \" \"${CMAKE_CURRENT_SOURCE_DIR}/include\" \"${CMAKE_CURRENT_SOURCE_DIR}/include/opencv\"")
2011-06-27 21:59:03 +08:00
set ( CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "${CMAKE_CURRENT_SOURCE_DIR}" )
2011-06-14 18:11:16 +08:00
set ( CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}" )
2011-06-27 21:59:03 +08:00
set ( CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\" ${ CMAKE_BINARY_DIR } /3rdparty/ ${ OPENCV_LIB_INSTALL_PATH } \"")
2011-06-14 18:11:16 +08:00
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY )
2011-06-29 03:24:31 +08:00
#support for version checking when finding opencv. find_package(OpenCV 2.3.1 EXACT) should now work.
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig-version.cmake" IMMEDIATE @ONLY )
2011-06-14 18:11:16 +08:00
# --------------------------------------------------------------------------------------------
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
# -------------------------------------------------------------------------------------------
2011-06-29 00:02:09 +08:00
set ( CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\" \${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_PREFIX}/opencv" "\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_PREFIX}\" " )
2011-06-27 21:59:03 +08:00
set ( CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "" )
if ( ANDROID )
2011-11-16 22:32:10 +08:00
set ( CMAKE_LIB_DIRS_CONFIGCMAKE "\" \${OpenCV_INSTALL_PATH}/libs/\${ANDROID_NDK_ABI_NAME}\"")
set ( CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\" \${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/libs/\${ANDROID_NDK_ABI_NAME}\"")
2011-06-27 21:59:03 +08:00
else ( )
set ( CMAKE_LIB_DIRS_CONFIGCMAKE "\" \${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"")
set ( CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\" \${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
2011-06-29 03:24:31 +08:00
if ( OPENCV_MANGLED_INSTALL_PATHS )
set ( CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\" \${OpenCV_INSTALL_PATH}/share/OpenCV-${OPENCV_VERSION}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
endif ( )
2011-06-27 21:59:03 +08:00
endif ( )
2011-06-14 18:11:16 +08:00
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY )
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake" IMMEDIATE @ONLY )
2011-06-14 18:11:16 +08:00
if ( UNIX )
2011-06-29 00:02:09 +08:00
#http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference
# For a command "find_package(<name> [major[.minor]] [EXACT] [REQUIRED|QUIET])"
# cmake will look in the following dir on unix:
# <prefix>/(share|lib)/cmake/<name>*/ (U)
# <prefix>/(share|lib)/<name>*/ (U)
# <prefix>/(share|lib)/<name>*/(cmake|CMake)/ (U)
if ( OPENCV_MANGLED_INSTALL_PATHS )
install ( FILES ${ CMAKE_BINARY_DIR } /unix-install/OpenCVConfig.cmake DESTINATION share/OpenCV- ${ OPENCV_VERSION } / )
install ( FILES ${ CMAKE_BINARY_DIR } /unix-install/OpenCVConfig-version.cmake DESTINATION share/OpenCV- ${ OPENCV_VERSION } / )
else ( )
2011-06-28 13:18:53 +08:00
install ( FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION share/OpenCV/ )
2011-06-29 03:24:31 +08:00
install ( FILES ${ CMAKE_BINARY_DIR } /unix-install/OpenCVConfig-version.cmake DESTINATION share/OpenCV/ )
2011-06-29 00:02:09 +08:00
endif ( )
2011-06-28 13:18:53 +08:00
endif ( )
if ( ANDROID )
install ( FILES "${CMAKE_CURRENT_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION share/OpenCV )
2011-06-14 18:11:16 +08:00
endif ( )
# --------------------------------------------------------------------------------------------
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
# -------------------------------------------------------------------------------------------
if ( WIN32 )
2011-06-28 00:55:10 +08:00
set ( CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\" \${OpenCV_CONFIG_PATH}/include\" \"\${OpenCV_CONFIG_PATH}/include/opencv\"")
set ( CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "" )
set ( CMAKE_LIB_DIRS_CONFIGCMAKE "\" \${OpenCV_CONFIG_PATH}/${OPENCV_LIB_INSTALL_PATH}\"")
set ( CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\" \${OpenCV_CONFIG_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
2011-06-14 18:11:16 +08:00
exec_program ( mkdir ARGS "-p \" ${ CMAKE_BINARY_DIR } /win-install/\ "" OUTPUT_VARIABLE RET_VAL )
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY )
2011-06-27 21:59:03 +08:00
2011-11-28 16:23:26 +08:00
# 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}/" )
2011-06-14 18:11:16 +08:00
endif ( )
2011-06-20 23:35:05 +08:00
# --------------------------------------------------------------------------------------------
# Installation for Android ndk-build makefile: OpenCV.mk
# Part 1/2: ${BIN_DIR}/OpenCV.mk -> For use *without* "make install"
# Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install"
# -------------------------------------------------------------------------------------------
if ( ANDROID )
if ( BUILD_SHARED_LIBS )
SET ( OPENCV_LIBTYPE_CONFIGMAKE "SHARED" )
else ( )
SET ( OPENCV_LIBTYPE_CONFIGMAKE "STATIC" )
endif ( )
2011-06-28 16:48:23 +08:00
if ( BUILD_ANDROID_CAMERA_WRAPPER )
set ( CMAKE_CAMERA_LIBS_CONFIGCMAKE "native_camera_r${ANDROID_VERSION}" )
2011-07-04 19:41:39 +08:00
elseif ( WITH_ANDROID_CAMERA )
2011-06-28 16:48:23 +08:00
SET ( CMAKE_CAMERA_LIBS_CONFIGCMAKE "" )
2011-11-16 22:32:10 +08:00
file ( GLOB CMAKE_CAMERA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}/libnative_camera_r*.so" )
2011-06-28 16:48:23 +08:00
foreach ( cam_lib ${ CMAKE_CAMERA_LIBS } )
get_filename_component ( cam_lib "${cam_lib}" NAME )
string ( REGEX REPLACE "lib(native_camera_r[0-9]+\\.[0-9]+\\.[0-9]+)\\.so" "\\1" cam_lib "${cam_lib}" )
SET ( CMAKE_CAMERA_LIBS_CONFIGCMAKE "${CMAKE_CAMERA_LIBS_CONFIGCMAKE} ${cam_lib}" )
endforeach ( )
2011-06-20 23:35:05 +08:00
endif ( )
endif ( ANDROID )
2011-06-28 13:18:53 +08:00
2011-06-20 23:35:05 +08:00
# -------------------------------------------------------------------------------------------
# Part 1/2: ${BIN_DIR}/OpenCV.mk -> For use *without* "make install"
# -------------------------------------------------------------------------------------------
if ( ANDROID )
2011-06-28 16:48:23 +08:00
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_DIR_CONFIGCMAKE "\" ${ CMAKE_CURRENT_SOURCE_DIR } \"")
set ( CMAKE_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)" )
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" IMMEDIATE @ONLY )
2011-06-20 23:35:05 +08:00
endif ( ANDROID )
# -------------------------------------------------------------------------------------------
# Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install"
# -------------------------------------------------------------------------------------------
if ( ANDROID )
2011-06-28 16:48:23 +08:00
set ( CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\" \$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/../../include/opencv\" \"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/../../include\"")
set ( CMAKE_BASE_INCLUDE_DIR_CONFIGCMAKE "" )
set ( CMAKE_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../.." )
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" IMMEDIATE @ONLY )
2011-06-27 21:59:03 +08:00
install ( FILES ${ CMAKE_BINARY_DIR } /unix-install/OpenCV.mk DESTINATION share/OpenCV/ )
2011-06-20 23:35:05 +08:00
endif ( ANDROID )
2011-06-14 18:11:16 +08:00
# --------------------------------------------------------------------------------------------
2011-06-29 03:24:31 +08:00
#according to man pkg-config
# The package name specified on the pkg-config command line is defined to
# be the name of the metadata file, minus the .pc extension. If a library
# can install multiple versions simultaneously, it must give each version
2011-06-29 14:27:08 +08:00
# its own name (for example, GTK 1.2 might have the package name "gtk+"
2011-06-29 03:24:31 +08:00
# while GTK 2.0 has "gtk+-2.0").
2011-06-14 18:11:16 +08:00
# 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 } )
2011-06-28 13:18:53 +08:00
set ( exec_prefix "\${prefix}" )
2011-08-10 20:49:52 +08:00
set ( libdir "\${exec_prefix}/lib${LIB_SUFFIX}" )
2011-06-29 14:27:08 +08:00
set ( includedir "\${prefix}/${OPENCV_INCLUDE_PREFIX}" )
set ( VERSION ${ OPENCV_VERSION } )
2011-06-14 18:11:16 +08:00
2011-07-01 08:14:09 +08:00
set ( OPENCV_PC_FILE_NAME opencv.pc )
2011-06-29 03:24:31 +08:00
#need to be explicit with naming the pc file and version number for side by side installs to work.
if ( OPENCV_MANGLED_INSTALL_PATHS )
2011-07-01 08:14:09 +08:00
SET ( OpenCV_LIB_COMPONENTS opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core )
#be explicit about the library names.
set ( OpenCV_LIB_COMPONENTS_ )
foreach ( CVLib ${ OpenCV_LIB_COMPONENTS } )
set ( OpenCV_LIB_COMPONENTS_ "${OpenCV_LIB_COMPONENTS_} ${libdir}/lib${CVLib}.so.${OPENCV_VERSION}" )
endforeach ( )
set ( OpenCV_LIB_COMPONENTS ${ OpenCV_LIB_COMPONENTS_ } )
2011-06-29 03:24:31 +08:00
set ( OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc" )
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv-XXX.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}" @ONLY IMMEDIATE )
2011-07-01 08:14:09 +08:00
else ( )
2012-01-03 21:48:12 +08:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}" @ONLY IMMEDIATE )
2011-06-29 03:24:31 +08:00
endif ( )
2011-06-24 23:40:27 +08:00
if ( UNIX AND NOT ANDROID )
2011-06-29 03:24:31 +08:00
install ( FILES ${ CMAKE_BINARY_DIR } /unix-install/ ${ OPENCV_PC_FILE_NAME } DESTINATION ${ OPENCV_LIB_INSTALL_PATH } /pkgconfig )
2011-06-14 18:11:16 +08:00
endif ( )
# ----------------------------------------------------------------------------
# Uninstall target, for "make uninstall"
# ----------------------------------------------------------------------------
CONFIGURE_FILE (
2012-01-03 21:48:12 +08:00
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / t e m p l a t e s / c m a k e _ u n i n s t a l l . c m a k e . i n "
2011-06-14 18:11:16 +08:00
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
2011-06-28 13:18:53 +08:00
ADD_CUSTOM_TARGET ( uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
2011-06-14 18:11:16 +08:00
2011-07-08 15:08:59 +08:00
#-----------------------------------
# Source package:
#-----------------------------------
2011-06-14 18:11:16 +08:00
if ( BUILD_PACKAGE )
2011-07-08 15:08:59 +08:00
set ( TARBALL_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}" )
2011-06-14 18:11:16 +08:00
if ( NOT WIN32 )
2011-08-18 04:12:11 +08:00
if ( APPLE )
set ( TAR_CMD gnutar )
else ( )
set ( TAR_CMD tar )
endif ( )
set ( TAR_TRANSFORM "\" s,^, ${ TARBALL_NAME } /,\ "" )
2011-07-08 15:08:59 +08:00
add_custom_target ( package_source
#TODO: maybe we should not remove dll's
2011-08-18 04:12:11 +08:00
C O M M A N D $ { T A R _ C M D } - - t r a n s f o r m $ { T A R _ T R A N S F O R M } - c j p f $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { T A R B A L L _ N A M E } . t a r . b z 2 - - e x c l u d e = " . s v n " - - e x c l u d e = " * . p y c " - - e x c l u d e = " * . v c p r o j " - - e x c l u d e = " * / l i b / * " - - e x c l u d e = " * . d l l " . /
2011-07-08 15:08:59 +08:00
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } )
2011-06-14 18:11:16 +08:00
else ( )
2011-07-08 15:08:59 +08:00
add_custom_target ( package_source
C O M M A N D z i p - 9 - r $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { T A R B A L L _ N A M E } . z i p . - x ' * / . s v n / * ' ' * . v c p r o j ' ' * . p y c '
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } )
2011-06-14 18:11:16 +08:00
endif ( )
endif ( )
2011-07-08 15:08:59 +08:00
2011-06-14 18:11:16 +08:00
#-----------------------------------
# Solution folders:
#-----------------------------------
if ( ENABLE_SOLUTION_FOLDERS )
set_property ( GLOBAL PROPERTY USE_FOLDERS ON )
set_property ( GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets" )
endif ( )
2011-09-06 23:30:28 +08:00
#-----------------------------------
# performance tests
#-----------------------------------
if ( BUILD_PERF_TESTS AND PYTHON_EXECUTABLE )
2011-11-18 15:57:14 +08:00
if ( CMAKE_VERSION VERSION_GREATER "2.8.2" )
2011-11-28 16:23:26 +08:00
add_custom_target ( perf
2011-11-18 15:57:14 +08:00
$ { P Y T H O N _ E X E C U T A B L E } " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / m o d u l e s / t s / m i s c / r u n . p y " - - c o n f i g u r a t i o n $ < C O N F I G U R A T I O N > " $ { C M A K E _ B I N A R Y _ D I R } "
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ B I N A R Y _ D I R } "
D E P E N D S " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / m o d u l e s / t s / m i s c / r u n . p y "
)
else ( )
2011-11-28 16:23:26 +08:00
add_custom_target ( perf
2011-11-18 15:57:14 +08:00
$ { P Y T H O N _ E X E C U T A B L E } " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / m o d u l e s / t s / m i s c / r u n . p y " " $ { C M A K E _ B I N A R Y _ D I R } "
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ B I N A R Y _ D I R } "
D E P E N D S " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / m o d u l e s / t s / m i s c / r u n . p y "
)
endif ( )
2011-09-06 23:30:28 +08:00
endif ( )
2011-06-14 18:11:16 +08:00
#-----------------------------------
# Subdirectories:
#-----------------------------------
add_subdirectory ( include )
add_subdirectory ( modules )
add_subdirectory ( doc )
add_subdirectory ( data )
2011-06-28 13:18:53 +08:00
add_subdirectory ( 3rdparty )
2011-06-14 18:11:16 +08:00
2011-07-04 16:18:02 +08:00
if ( BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES )
2011-06-14 18:11:16 +08:00
add_subdirectory ( samples )
endif ( )
# ----------------------------------------------------------------------------
# Summary:
# ----------------------------------------------------------------------------
2011-07-01 20:23:03 +08:00
status ( "" )
status ( "General configuration for opencv ${OPENCV_VERSION} =====================================" )
status ( "" )
status ( " Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO )
2012-01-03 21:48:12 +08:00
status ( " C++ Compiler:" CMAKE_COMPILER THEN "${CMAKE_COMPILER}" ELSE "${CMAKE_CXX_COMPILER}" )
2011-07-01 20:23:03 +08:00
status ( " C++ flags (Release):" ${ CMAKE_CXX_FLAGS } ${ CMAKE_CXX_FLAGS_RELEASE } )
status ( " C++ flags (Debug):" ${ CMAKE_CXX_FLAGS } ${ CMAKE_CXX_FLAGS_DEBUG } )
2011-06-14 18:11:16 +08:00
if ( WIN32 )
2011-07-01 20:23:03 +08:00
status ( " Linker flags (Release):" ${ CMAKE_EXE_LINKER_FLAGS } ${ CMAKE_EXE_LINKER_FLAGS_RELEASE } )
status ( " Linker flags (Debug):" ${ CMAKE_EXE_LINKER_FLAGS } ${ CMAKE_EXE_LINKER_FLAGS_DEBUG } )
2011-06-14 18:11:16 +08:00
else ( )
2011-07-01 20:23:03 +08:00
status ( " Linker flags (Release):" ${ CMAKE_SHARED_LINKER_FLAGS } ${ CMAKE_SHARED_LINKER_FLAGS_RELEASE } )
status ( " Linker flags (Debug):" ${ CMAKE_SHARED_LINKER_FLAGS } ${ CMAKE_SHARED_LINKER_FLAGS_DEBUG } )
2011-06-14 18:11:16 +08:00
endif ( )
2011-07-04 16:18:02 +08:00
if ( ANDROID )
2011-11-18 16:14:42 +08:00
status ( "" )
status ( " Android: " )
2011-11-16 22:32:10 +08:00
status ( " Android ABI:" ${ ANDROID_ABI } )
status ( " Native API level:" android- ${ ANDROID_NATIVE_API_LEVEL } )
2011-07-12 23:59:31 +08:00
status ( " SDK target:" "${ANDROID_SDK_TARGET}" )
2011-11-18 16:14:42 +08:00
if ( BUILD_WITH_ANDROID_NDK )
status ( " Android NDK:" "${ANDROID_NDK} (toolchain: ${ANDROID_TOOLCHAIN_NAME})" )
elseif ( BUILD_WITH_STANDALONE_TOOLCHAIN )
status ( " Android toolchain:" "${ANDROID_STANDALONE_TOOLCHAIN}" )
endif ( )
2012-01-03 21:48:12 +08:00
status ( " android tool:" ANDROID_EXECUTABLE THEN "${ANDROID_EXECUTABLE} (${ANDROID_TOOLS_Pkg_Desc})" ELSE NO )
status ( " ant:" ANT_EXECUTABLE THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})" ELSE NO )
2011-07-04 16:18:02 +08:00
endif ( )
2011-06-14 18:11:16 +08:00
#YV
2011-07-01 20:23:03 +08:00
status ( "" )
status ( " GUI: " )
2011-06-14 18:11:16 +08:00
if ( HAVE_QT )
2011-07-01 20:23:03 +08:00
status ( " QT 4.x:" HAVE_QT THEN YES ELSE NO )
status ( " QT OpenGL support:" HAVE_QT_OPENGL THEN YES ELSE NO )
2011-06-14 18:11:16 +08:00
else ( )
if ( WIN32 )
2011-07-01 20:23:03 +08:00
status ( " Win32 UI:" YES )
2011-06-14 18:11:16 +08:00
else ( )
if ( APPLE )
if ( WITH_CARBON )
2011-07-01 20:23:03 +08:00
status ( " Carbon:" YES )
2011-06-14 18:11:16 +08:00
else ( )
2011-07-01 20:23:03 +08:00
status ( " Cocoa:" YES )
2011-06-14 18:11:16 +08:00
endif ( )
else ( )
2012-01-03 21:48:12 +08:00
status ( " GTK+ 2.x:" HAVE_GTK THEN YES ELSE NO )
status ( " GThread :" HAVE_GTHREAD THEN YES ELSE NO )
2011-11-28 16:23:26 +08:00
status ( " GtkGlExt:" HAVE_GTKGLEXT THEN YES ELSE NO )
2011-06-14 18:11:16 +08:00
endif ( )
endif ( )
endif ( )
2011-11-21 19:58:52 +08:00
status ( " OpenGL support:" HAVE_OPENGL THEN YES ELSE NO )
2011-07-01 20:23:03 +08:00
# media
status ( "" )
status ( " Media I/O: " )
2012-01-03 21:48:12 +08:00
status ( " ZLib:" ZLIB_FOUND THEN ${ ZLIB_FOUND } ELSE build )
2011-07-01 20:23:03 +08:00
status ( " JPEG:" NOT WITH_JPEG OR JPEG_FOUND THEN ${ JPEG_FOUND } ELSE build )
status ( " PNG:" NOT WITH_PNG OR PNG_FOUND THEN ${ PNG_FOUND } ELSE build )
status ( " TIFF:" NOT WITH_TIFF OR TIFF_FOUND THEN ${ TIFF_FOUND } ELSE build )
status ( " JPEG 2000:" NOT WITH_JASPER OR JASPER_FOUND THEN ${ JASPER_FOUND } ELSE build )
2011-07-28 04:53:19 +08:00
status ( " OpenEXR:" WITH_OPENEXR AND OPENEXR_FOUND THEN YES ELSE NO )
2011-06-14 18:11:16 +08:00
2011-08-10 22:58:55 +08:00
status ( " OpenNI:" HAVE_OPENNI THEN YES ELSE NO )
status ( " OpenNI PrimeSensor Modules:"
H A V E _ O P E N N I _ P R I M E _ S E N S O R _ M O D U L E T H E N Y E S E L S E N O )
2012-01-03 21:48:12 +08:00
if ( WIN32 )
status ( " XIMEA:" HAVE_XIMEA THEN YES ELSE NO )
endif ( )
2011-06-14 18:11:16 +08:00
2011-07-01 20:23:03 +08:00
# video
status ( "" )
if ( UNIX AND NOT APPLE )
status ( " Video I/O:" )
status ( " DC1394 1.x:" HAVE_DC1394 THEN YES ELSE NO )
status ( " DC1394 2.x:" HAVE_DC1394_2 THEN YES ELSE NO )
status ( " FFMPEG:" HAVE_FFMPEG THEN YES ELSE NO )
status ( " codec:" HAVE_FFMPEG_CODEC THEN YES ELSE NO )
status ( " format:" HAVE_FFMPEG_FORMAT THEN YES ELSE NO )
status ( " util:" HAVE_FFMPEG_UTIL THEN YES ELSE NO )
status ( " swscale:" HAVE_FFMPEG_SWSCALE THEN YES ELSE NO )
status ( " gentoo-style:" HAVE_GENTOO_FFMPEG THEN YES ELSE NO )
status ( " GStreamer:" HAVE_GSTREAMER THEN YES ELSE NO )
status ( " UniCap:" HAVE_UNICAP THEN YES ELSE NO )
status ( " PvAPI:" HAVE_PVAPI THEN YES ELSE NO )
2012-01-03 21:48:12 +08:00
status ( " V4L/V4L2:" HAVE_LIBV4L THEN "Using libv4l" ELSE ${ HAVE_CAMV4L } / ${ HAVE_CAMV4L2 } )
2011-07-01 20:23:03 +08:00
status ( " Xine:" HAVE_XINE THEN YES ELSE NO )
2011-06-14 18:11:16 +08:00
2011-07-01 20:23:03 +08:00
if ( ANDROID )
2011-07-04 19:41:39 +08:00
if ( WITH_ANDROID_CAMERA )
2011-11-16 22:32:10 +08:00
status ( " AndroidNativeCamera:" BUILD_ANDROID_CAMERA_WRAPPER THEN "YES, build for Android ${ANDROID_VERSION}" ELSE "YES, use prebuilt libraries" )
2011-07-01 20:23:03 +08:00
else ( )
2011-07-04 19:41:39 +08:00
status ( " AndroidNativeCamera:" "NO (native camera requires Android API level 8 or higher)" )
2011-07-01 20:23:03 +08:00
endif ( )
endif ( )
elseif ( APPLE )
2011-11-28 16:23:26 +08:00
if ( NOT IOS )
2012-01-03 21:48:12 +08:00
status ( " Video I/O:" WITH_QUICKTIME THEN QuickTime ELSE QTKit )
2011-11-28 16:23:26 +08:00
else ( )
status ( " Video I/O: AVFoundation" )
endif ( )
2011-07-01 20:23:03 +08:00
elseif ( WIN32 )
status ( " Video I/O:" HAVE_VIDEOINPUT THEN DirectShow ELSE NO )
2011-06-14 18:11:16 +08:00
endif ( )
2011-07-01 20:23:03 +08:00
# Other third-party libraries
status ( "" )
2011-07-02 23:12:07 +08:00
status ( " Other third-party libraries:" )
2011-06-14 18:11:16 +08:00
if ( WITH_IPP AND IPP_FOUND )
2011-07-01 20:23:03 +08:00
status ( " Use IPP:" "${IPP_LATEST_VERSION_STR} [${IPP_LATEST_VERSION_MAJOR}.${IPP_LATEST_VERSION_MINOR}.${IPP_LATEST_VERSION_BUILD}]" )
status ( " at:" "${IPP_ROOT_DIR}" )
2011-06-14 18:11:16 +08:00
else ( )
2012-01-03 21:48:12 +08:00
status ( " Use IPP:" WITH_IPP AND NOT IPP_FOUND THEN "IPP not found" ELSE NO )
2011-06-14 18:11:16 +08:00
endif ( )
2012-01-03 21:48:12 +08:00
status ( " Use TBB:" HAVE_TBB THEN YES ELSE NO )
2011-07-01 20:23:03 +08:00
status ( " Use Cuda:" HAVE_CUDA THEN YES ELSE NO )
status ( " Use Eigen:" HAVE_EIGEN THEN YES ELSE NO )
2011-06-14 18:11:16 +08:00
2011-11-18 16:14:42 +08:00
status ( "" )
status ( " Python interpreter:" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver ${PYTHON_VERSION_MAJOR_MINOR})" ELSE NO )
2011-07-02 23:12:07 +08:00
# interfaces to other languages
status ( "" )
status ( " Interfaces:" )
2012-01-03 21:48:12 +08:00
status ( " Python:" BUILD_NEW_PYTHON_SUPPORT AND PYTHON_EXECUTABLE THEN YES ELSE NO )
status ( " Python numpy:" PYTHON_USE_NUMPY AND BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE "NO (Python wrappers will not be generated)" )
if ( ANDROID )
status ( " Java:" BUILD_JAVA_SUPPORT AND PYTHON_EXECUTABLE THEN YES ELSE NO )
2011-07-04 19:41:39 +08:00
endif ( )
2011-07-02 23:12:07 +08:00
2011-07-01 20:23:03 +08:00
# documentation
status ( "" )
status ( " Documentation:" )
2011-07-22 21:10:50 +08:00
status ( " Sphinx:" HAVE_SPHINX THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO )
status ( " PdfLaTeX compiler:" PDFLATEX_COMPILER THEN "${PDFLATEX_COMPILER}" ELSE NO )
2012-01-03 21:48:12 +08:00
if ( BUILD_DOCS AND HAVE_SPHINX )
status ( " Build Documentation:" PDFLATEX_COMPILER THEN YES ELSE "YES (only HTML without math expressions)" )
2011-07-20 04:27:58 +08:00
else ( )
status ( " Build Documentation:" NO )
endif ( )
2011-06-14 18:11:16 +08:00
2011-07-01 20:23:03 +08:00
# samples and tests
status ( "" )
status ( " Tests and samples:" )
2011-09-06 23:30:28 +08:00
status ( " Tests:" BUILD_TESTS THEN YES ELSE NO )
status ( " Performance tests:" BUILD_PERF_TESTS THEN YES ELSE NO )
status ( " Examples:" BUILD_EXAMPLES THEN YES ELSE NO )
2011-07-01 20:23:03 +08:00
if ( ANDROID )
2012-01-03 21:48:12 +08:00
status ( " Android tests:" BUILD_TESTS AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO )
status ( " Android examples:" BUILD_ANDROID_EXAMPLES THEN YES ELSE NO )
2011-06-14 18:11:16 +08:00
endif ( )
2012-01-03 21:48:12 +08:00
#auxiliary
2011-07-01 20:23:03 +08:00
status ( "" )
status ( " Install path:" "${CMAKE_INSTALL_PREFIX}" )
status ( "" )
status ( " cvconfig.h is in:" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}" )
status ( "-----------------------------------------------------------------" )
status ( "" )
2011-07-01 03:45:52 +08:00
# warn in the case of in-source build
if ( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" )
message ( WARNING "The source directory is the same as binary directory. \" make clean\ " may damage the source tree" )
2011-07-04 16:18:02 +08:00
endif ( )