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
project(OpenCV)\r
\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
+\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
set(USE_O2 ON CACHE BOOL "Enable -O2 for GCC")\r
set(USE_FAST_MATH ON CACHE BOOL "Enable -ffast-math for GCC")\r
endif()\r
- \r
+\r
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)\r
set(X86_64 1)\r
endif()\r
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)\r
set(X86_64 1)\r
endif()\r
- \r
+\r
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686*)\r
set(X86 1)\r
endif()\r
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86*)\r
set(X86 1)\r
endif()\r
- \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
+\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 for GCC")\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
+ set(WITH_VIDEOINPUT ON CACHE BOOL "Enable VideoInput support")\r
endif()\r
\r
# ===================================================\r
foreach(P "${ALIAS_INCLUDE_DIRS}")\r
if (${P})\r
list(APPEND HIGHGUI_INCLUDE_DIRS ${${P}})\r
- endif() \r
+ endif()\r
endforeach()\r
\r
foreach(P "${ALIAS_LIBRARY_DIRS}")\r
else()\r
set(HAVE_UNICAP FALSE)\r
endif()\r
- \r
+\r
if(WITH_PVAPI)\r
find_path(PVAPI_INCLUDE_PATH "PvApi.h"\r
PATHS "/usr/local/include" "/usr/include"\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
endif()\r
# Find the bzip2 library because it is required on some systems\r
FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2)\r
set(JPEG_FOUND FALSE)\r
endif()\r
endif()\r
- \r
+\r
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")\r
set(OPENCV_LINKER_LIBS m pthread)\r
else()\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
+\r
execute_process(COMMAND ${PYTHON_EXECUTABLE} --version\r
ERROR_VARIABLE PYTHON_VERSION_FULL\r
OUTPUT_STRIP_TRAILING_WHITESPACE)\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
+ 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
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
- #endif()\r
- \r
+ #endif()\r
+\r
endif()\r
endif()\r
- \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
+\r
+ if (TBB_FOUND)\r
set(HAVE_TBB 1)\r
if(NOT "${TBB_INCLUDE_DIRS}" STREQUAL "")\r
include_directories("${TBB_INCLUDE_DIRS}")\r
set(TBB_DEFAULT_INCLUDE_DIRS\r
"/opt/intel/tbb"\r
"/usr/local/include"\r
- "/usr/include") \r
+ "/usr/include")\r
endif()\r
- endif() \r
+ endif()\r
if (APPLE)\r
set(TBB_DEFAULT_INCLUDE_DIRS\r
"/usr/local/include"\r
- "/usr/include") \r
- endif() \r
+ "/usr/include")\r
+ endif()\r
if (WIN32)\r
set(TBB_DEFAULT_INCLUDE_DIRS\r
"C:/Program Files/Intel/TBB"\r
- "C:/Program Files (x86)/Intel/TBB") \r
- endif() \r
+ "C:/Program Files (x86)/Intel/TBB")\r
+ endif()\r
if (NOT HAVE_TBB)\r
find_path(TBB_INCLUDE_DIR "tbb/tbb.h"\r
PATHS TBB_DEFAULT_INCLUDE_DIRS\r
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86*)\r
set(X86 1)\r
endif()\r
- \r
+\r
set(_TBB_LIB_PATH "${TBB_INCLUDE_DIR}/../lib")\r
if (X86_64)\r
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")\r
link_directories("${TBB_LIB_DIR}")\r
endif()\r
endif()\r
- \r
+\r
set(HAVE_TBB 1)\r
if(NOT "${TBB_INCLUDE_DIR}" STREQUAL "")\r
include_directories("${TBB_INCLUDE_DIR}")\r
############################### CUDA ################################\r
\r
if (WITH_CUDA)\r
- find_package(CUDA) \r
+ find_package(CUDA)\r
if (CUDA_FOUND)\r
- message(STATUS "CUDA detected.") \r
+ message(STATUS "CUDA detected.")\r
set(HAVE_CUDA 1)\r
+\r
+ set(CUDA_COMPUTE_CAPABILITIES " 1.0 1.1 1.2 1.3 2.0 " CACHE STRING "Add or remove compute capability")\r
+ set(CUDA_NVCC_FLAGS_ARCH ${CUDA_COMPUTE_CAPABILITIES})\r
+\r
+ set(CUDA_NVCC_FLAGS_NUM "")\r
+\r
+ while(NOT ${CUDA_NVCC_FLAGS_ARCH} STREQUAL "")\r
+ string(REGEX MATCH "[0-9]+.[0-9]+" RESULT_NUM ${CUDA_NVCC_FLAGS_ARCH})\r
+ string(REGEX MATCHALL "[0-9]" RESULT_STR ${RESULT_NUM})\r
+ string(REGEX REPLACE ";" "\ " RESULT ${RESULT_STR})\r
+ list(APPEND CUDA_NVCC_FLAGS_NUM ${RESULT})\r
+ string(REGEX REPLACE "${RESULT_NUM}" "\ " CUDA_NVCC_FLAGS_ARCH_STR ${CUDA_NVCC_FLAGS_ARCH})\r
+ string(STRIP ${CUDA_NVCC_FLAGS_ARCH_STR} CUDA_NVCC_FLAGS_ARCH)\r
+ endwhile()\r
+\r
+ set (OpenCV_CUDA_CC "")\r
+ set (loop_var "")\r
+ foreach( loop_var IN LISTS CUDA_NVCC_FLAGS_NUM)\r
+ set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode arch=compute_${loop_var},code=sm_${loop_var})\r
+ set (OpenCV_CUDA_CC ${OpenCV_CUDA_CC} -gencode arch=compute_${loop_var},code=sm_${loop_var})\r
+ endforeach()\r
+\r
+ ### set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${OpenCV_COMPUTE_CAPABILITIES})\r
endif()\r
endif()\r
\r
if (WIN32 AND WITH_VIDEOINPUT)\r
if(CMAKE_CXX_COMPILER MATCHES "dw2")\r
else()\r
- if(NOT MINGW64)\r
+ if(NOT MINGW64)\r
set(HAVE_VIDEOINPUT 1)\r
- endif()\r
+ endif()\r
endif()\r
endif()\r
\r
############################## Eigen2 ##############################\r
\r
if(WITH_EIGEN2)\r
- find_path(EIGEN2_INCLUDE_PATH "Eigen/Core"\r
+ find_path(EIGEN2_INCLUDE_PATH "Eigen/Core"\r
PATHS "/usr/local/include/eigen2" "/opt/include/eigen2" "/usr/include/eigen2"\r
DOC "The path to Eigen2 headers")\r
if(EIGEN2_INCLUDE_PATH)\r
add_definitions(-DHAVE_IPP)\r
include_directories("${IPP_PATH}/../include")\r
link_directories("${IPP_PATH}/../lib")\r
- \r
+\r
file(GLOB em64t_files "${IPP_PATH}/../lib/*em64t*")\r
set(IPP_ARCH)\r
if(em64t_files)\r
set(IPP_ARCH "em64t")\r
endif()\r
- \r
+\r
set(A ${CMAKE_STATIC_LIBRARY_PREFIX})\r
set(B ${IPP_ARCH}${CMAKE_STATIC_LIBRARY_SUFFIX})\r
if(WIN32)\r
find_package(Doxygen)\r
\r
if(DOXYGEN_FOUND)\r
- set(BUILD_DOXYGEN_DOCS ON CACHE BOOL "Generate HTML docs using Doxygen") \r
+ set(BUILD_DOXYGEN_DOCS ON CACHE BOOL "Generate HTML docs using Doxygen")\r
endif()\r
\r
# ----------------------------------------------------------------------------\r
#endif()\r
endif()\r
endif()\r
- \r
+\r
if(X86 OR X86_64)\r
if(NOT APPLE)\r
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)\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
+\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
# -------------------------------------------------------------------------------------------\r
if(WIN32)\r
# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:\r
- \r
+\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\" \"\${THIS_OPENCV_CONFIG_PATH}/include/opencv\"")\r
- set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"${THIS_OPENCV_CONFIG_PATH}\"")\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
set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/lib\"")\r
${CMAKE_BINARY_DIR}/.cpack/Package.cmake\r
@ONLY\r
)\r
- \r
+\r
include(${CMAKE_BINARY_DIR}/.cpack/Package.cmake)\r
\r
set(root_files README)\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
+ # 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
DESTINATION bin COMPONENT main)\r
install(FILES ${CMAKE_BINARY_DIR}/lib/Debug/${m}${OPENCV_DLLVERSION}d.lib\r
DESTINATION lib COMPONENT main)\r
- endforeach() \r
+ endforeach()\r
endif()\r
\r
install(DIRECTORY data samples DESTINATION "." COMPONENT main 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/plastex DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)\r
- \r
+\r
endif()\r
endif()\r
\r
\r
if(BUILD_LATEX_DOCS)\r
include(OpenCVFindLATEX.cmake REQUIRED)\r
- \r
+\r
if(PDFLATEX_COMPILER)\r
message(STATUS "PDF LaTeX found!")\r
endif()\r
message(STATUS " GThread: ${HAVE_GTHREAD}")\r
endif()\r
endif()\r
-endif() \r
+endif()\r
\r
message(STATUS "")\r
message(STATUS " Image I/O: ")\r
#\r
# ** File generated automatically, do not modify **\r
#\r
-# Usage from an external project: \r
+# Usage from an external project:\r
# In your CMakeLists.txt, add these lines:\r
#\r
# FIND_PACKAGE(OpenCV REQUIRED )\r
-# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS}) \r
+# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})\r
#\r
# This file will define the following variables:\r
-# - OpenCV_LIBS : The list of libraries to links against.\r
-# - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES\r
-# with this path is NOT needed.\r
-# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.\r
-# - OpenCV_VERSION : The version of this OpenCV build. Example: "1.2.0"\r
-# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "1"\r
-# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "2"\r
-# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"\r
+# - OpenCV_LIBS : The list of libraries to links against.\r
+# - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES\r
+# with this path is NOT needed.\r
+# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.\r
+# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability\r
+# - OpenCV_VERSION : The version of this OpenCV build. Example: "1.2.0"\r
+# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "1"\r
+# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "2"\r
+# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"\r
#\r
-# ===================================================================================\r
+# =================================================================================================\r
\r
+# ======================================================\r
+# Version Compute Capability from which library OpenCV\r
+# has been compiled is remembered\r
+# ======================================================\r
+SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@)\r
\r
# Extract the directory where *this* file has been installed (determined at cmake run-time)\r
# This variable may or may not be used below, depending on the parsing of OpenCVConfig.cmake\r
endforeach(__CVLIB)\r
endif(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL "")\r
\r
-# For OpenCV built as static libs, we need the user to link against \r
+# For OpenCV built as static libs, we need the user to link against\r
# many more dependencies:\r
IF (NOT @OPENCV_BUILD_SHARED_LIB@)\r
# Under static libs, the user of OpenCV needs access to the 3rdparty libs as well:\r
LINK_DIRECTORIES("@CMAKE_BINARY_DIR@/3rdparty/lib")\r
\r
- SET(OpenCV_LIBS \r
- @OPENCV_LINKER_LIBS@ \r
+ SET(OpenCV_LIBS\r
+ @OPENCV_LINKER_LIBS@\r
@IPP_LIBS@\r
- @JPEG_LIBRARIES@ \r
- @PNG_LIBRARIES@ \r
- @TIFF_LIBRARIES@ \r
- @JASPER_LIBRARIES@ \r
- @HIGHGUI_LIBRARIES@ \r
+ @JPEG_LIBRARIES@\r
+ @PNG_LIBRARIES@\r
+ @TIFF_LIBRARIES@\r
+ @JASPER_LIBRARIES@\r
+ @HIGHGUI_LIBRARIES@\r
${OpenCV_LIBS}) # The standard libs BEFORE (OpenCV_LIBS) since these can have "debug","optimized".\r
ENDIF(NOT @OPENCV_BUILD_SHARED_LIB@)\r
\r
\r
# ======================================================\r
-# Version variables: \r
+# Version variables:\r
# ======================================================\r
SET(OpenCV_VERSION @OPENCV_VERSION@)\r
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@)\r