mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 12:40:05 +08:00
Numerous small fixes in CMakeLists.txt
This commit is contained in:
parent
2776b42a7b
commit
ba7ee71c20
252
CMakeLists.txt
252
CMakeLists.txt
@ -17,7 +17,6 @@ if(UNIX)
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib /usr/lib)
|
||||
endif()
|
||||
|
||||
|
||||
# it _must_ go before PROJECT(OpenCV) in order to work
|
||||
if(WIN32)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
|
||||
@ -25,10 +24,32 @@ else()
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory")
|
||||
endif()
|
||||
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
# SUBDIRECTORIES:
|
||||
# Save libs and executables in the same place
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
|
||||
|
||||
if(ANDROID)
|
||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||
elseif(WIN32)
|
||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||
else()
|
||||
set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
set(OPENCV_LIB_INSTALL_PATH libs/${ARMEABI_NDK_NAME})
|
||||
else()
|
||||
set(OPENCV_LIB_INSTALL_PATH lib)
|
||||
endif()
|
||||
|
||||
# build configuration
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
|
||||
set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
|
||||
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
|
||||
@ -39,8 +60,11 @@ set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
|
||||
set(CMAKE_VERBOSE OFF CACHE BOOL "Verbose mode")
|
||||
|
||||
set(CMAKE_VERBOSE OFF CACHE BOOL "Verbose mode")
|
||||
if(CMAKE_VERBOSE)
|
||||
set(CMAKE_VERBOSE_MAKEFILE 1)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if(${CMAKE_GENERATOR} MATCHES "(MinGW)|(MSYS)")
|
||||
@ -48,14 +72,8 @@ if (WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERBOSE)
|
||||
set(CMAKE_VERBOSE_MAKEFILE 1)
|
||||
endif()
|
||||
|
||||
|
||||
project(OpenCV)
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 2.4)
|
||||
|
||||
|
||||
@ -76,7 +94,6 @@ if(NOT COMMAND find_host_program)
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Indicate CMake 2.7 and above that we don't want to mix relative
|
||||
# and absolute paths in linker lib lists.
|
||||
@ -86,13 +103,12 @@ if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Current version number:
|
||||
# ----------------------------------------------------------------------------
|
||||
set(OPENCV_VERSION "2.3.0")
|
||||
|
||||
string(REGEX MATCHALL "[0-9]" OPENCV_VERSION_PARTS "${OPENCV_VERSION}")
|
||||
string(REGEX MATCHALL "[0-9]+" OPENCV_VERSION_PARTS "${OPENCV_VERSION}")
|
||||
|
||||
list(GET OPENCV_VERSION_PARTS 0 OPENCV_VERSION_MAJOR)
|
||||
list(GET OPENCV_VERSION_PARTS 1 OPENCV_VERSION_MINOR)
|
||||
@ -111,10 +127,9 @@ else()
|
||||
set(OPENCV_DEBUG_POSTFIX)
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Build static or dynamic libs?
|
||||
# Default: dynamic libraries:
|
||||
# Default: dynamic libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
|
||||
|
||||
@ -135,18 +150,15 @@ if(MSVC)
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MD")
|
||||
|
||||
endif()
|
||||
if(${flag_var} MATCHES "/MDd")
|
||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MDd")
|
||||
endif()
|
||||
endforeach(flag_var)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmtd.lib")
|
||||
|
||||
else(BUILD_WITH_STATIC_CRT)
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
@ -155,18 +167,14 @@ if(MSVC)
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/MT")
|
||||
string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MT")
|
||||
|
||||
endif()
|
||||
if(${flag_var} MATCHES "/MTd")
|
||||
string(REGEX REPLACE "/MTd" "/MDd" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MTd")
|
||||
endif()
|
||||
endforeach(flag_var)
|
||||
|
||||
endif(BUILD_WITH_STATIC_CRT)
|
||||
endif(MSVC)
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Variables for cvconfig.h.cmake
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -177,7 +185,6 @@ set(PACKAGE_STRING "${PACKAGE} ${OPENCV_VERSION}")
|
||||
set(PACKAGE_TARNAME "${PACKAGE}")
|
||||
set(PACKAGE_VERSION "${OPENCV_VERSION}")
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Autodetect if we are in a SVN repository
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -190,11 +197,11 @@ if(SVNVERSION_PATH)
|
||||
if(SVNVERSION_RESULT MATCHES "exported")
|
||||
# This is NOT a svn repository:
|
||||
set(OPENCV_SVNVERSION "")
|
||||
message(STATUS "SVNVERSION: exported")
|
||||
else()
|
||||
set(OPENCV_SVNVERSION " svn:${SVNVERSION_RESULT}")
|
||||
message(STATUS "SVNVERSION: ${OPENCV_SVNVERSION}")
|
||||
endif()
|
||||
|
||||
message(STATUS "SVNVERSION: ${OPENCV_SVNVERSION}")
|
||||
else()
|
||||
# We don't have svnversion:
|
||||
set(OPENCV_SVNVERSION "")
|
||||
@ -221,10 +228,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
# 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}")
|
||||
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}")
|
||||
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)
|
||||
@ -241,10 +248,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(MINGW64 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):
|
||||
# see include/opencv/cxtypes.h file for related ICC & CV_ICC defines.
|
||||
@ -269,7 +274,6 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -307,13 +311,6 @@ if(UNIX)
|
||||
include(CheckIncludeFile)
|
||||
endif()
|
||||
|
||||
#if(MSVC)
|
||||
# set(DEFAULT_ENABLE_OPENMP ON)
|
||||
#else()
|
||||
# set(DEFAULT_ENABLE_OPENMP OFF)
|
||||
#endif()
|
||||
#set(ENABLE_OPENMP ${DEFAULT_ENABLE_OPENMP} CACHE BOOL "")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(ENABLE_PROFILING OFF CACHE BOOL "Enable profiling in the GCC compiler (Add flags: -g -pg)")
|
||||
set(USE_OMIT_FRAME_POINTER ON CACHE BOOL "Enable -fomit-frame-pointer for GCC")
|
||||
@ -321,11 +318,9 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*|x86_64*)
|
||||
set(X86_64 1)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686*|i386*|x86*)
|
||||
set(X86 1)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES powerpc*)
|
||||
set(ENABLE_POWERPC ON CACHE BOOL "Enable PowerPC for GCC")
|
||||
endif ()
|
||||
@ -606,13 +601,13 @@ 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)
|
||||
endif(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
|
||||
ERROR_VARIABLE PYTHON_VERSION_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
string(REGEX MATCH "[0-9].[0-9]" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
|
||||
string(REGEX MATCH "[0-9]+.[0-9]+" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
|
||||
if(UNIX)
|
||||
set(PYTHON_PLUGIN_INSTALL_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages/opencv)
|
||||
if(APPLE)
|
||||
@ -869,7 +864,7 @@ endif()
|
||||
############################## Eigen ##############################
|
||||
|
||||
if(WITH_EIGEN)
|
||||
find_path(EIGEN_INCLUDE_PATH "Eigen/Core"
|
||||
find_path(EIGEN_INCLUDE_PATH "Eigen/Core"
|
||||
PATHS "/usr/local/include/eigen2" "/opt/include/eigen2" "/usr/include/eigen2"
|
||||
"/usr/local/include/eigen3" "/opt/include/eigen3" "/usr/include/eigen3"
|
||||
DOC "The path to Eigen2/Eigen3 headers")
|
||||
@ -884,7 +879,6 @@ endif()
|
||||
|
||||
if(WIN32)
|
||||
set(WITH_VIDEOINPUT ON CACHE BOOL "Build HighGUI with DirectShow support")
|
||||
|
||||
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} comctl32 gdi32 ole32)
|
||||
|
||||
if(WITH_VIDEOINPUT)
|
||||
@ -905,7 +899,6 @@ if(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
############## Android source tree for native camera ###############
|
||||
if(ANDROID)
|
||||
SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH
|
||||
@ -922,25 +915,15 @@ libnative_camera_rx.x.x.so for your Android")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
################### DOXYGEN ###############
|
||||
|
||||
#find_package(Doxygen)
|
||||
#
|
||||
#if(DOXYGEN_FOUND)
|
||||
# set(BUILD_DOXYGEN_DOCS ON CACHE BOOL "Generate HTML docs using Doxygen")
|
||||
#endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# UPDATE CONFIG FILES & SCRIPTS:
|
||||
#
|
||||
# CONFIGURE_FILE(InputFile OutputFile [COPYONLY] [ESCAPE_QUOTES] [@ONLY])
|
||||
# If @ONLY is specified, only variables of the form @VAR@ will be
|
||||
# If @ONLY is specified, only variables of the form @VAR@ will be
|
||||
# replaces and ${VAR} will be ignored.
|
||||
#
|
||||
# A directory will be created for each platform so the "cvconfig.h" file is
|
||||
# not overwritten if cmake generates code in the same path.
|
||||
# not overwritten if cmake generates code in the same path.
|
||||
# ----------------------------------------------------------------------------
|
||||
add_definitions(-DHAVE_CVCONFIG_H)
|
||||
|
||||
@ -949,7 +932,6 @@ set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to c
|
||||
message(STATUS "Parsing 'cvconfig.h.cmake'")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# The C+//0 include & link directories:
|
||||
# ---------------------------------------------------------------------------
|
||||
@ -959,7 +941,6 @@ include_directories("."
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/opencv"
|
||||
)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Set the maximum level of warnings:
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -978,7 +959,6 @@ if(MSVC)
|
||||
# 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")
|
||||
@ -986,47 +966,34 @@ if(MSVC)
|
||||
|
||||
set(EXTRA_EXE_LINKER_FLAGS_RELEASE "${EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
|
||||
|
||||
#if(ENABLE_OPENMP)
|
||||
# set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /openmp")
|
||||
#endif()
|
||||
|
||||
# Remove unreferenced functions: function level linking
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Gy")
|
||||
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Zi")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
# High level of warnings.
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")
|
||||
|
||||
# The -Wno-long-long is required in 64bit systems when including sytem headers.
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
|
||||
endif()
|
||||
|
||||
# We need pthread's
|
||||
if(UNIX)
|
||||
if(NOT ANDROID)
|
||||
if(UNIX AND NOT ANDROID)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -pthread")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPENCV_WARNINGS_ARE_ERRORS)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
|
||||
endif()
|
||||
|
||||
if(X86)
|
||||
if(NOT MINGW64)
|
||||
if(NOT X86_64)
|
||||
if(NOT APPLE)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -march=i686")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(X86 AND NOT MINGW64 AND NOT X86_64 AND NOT APPLE)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -march=i686")
|
||||
endif()
|
||||
|
||||
# Other optimizations
|
||||
@ -1074,32 +1041,21 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
endif()
|
||||
|
||||
if(X86 OR X86_64)
|
||||
if(NOT APPLE)
|
||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
|
||||
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mfpmath=387")
|
||||
endif()
|
||||
if(NOT APPLE AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4)
|
||||
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mfpmath=387")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Profiling?
|
||||
if(ENABLE_PROFILING)
|
||||
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -pg -g")
|
||||
else()
|
||||
# Remove unreferenced functions: function level linking
|
||||
if(NOT APPLE)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections")
|
||||
endif()
|
||||
elseif(NOT APPLE)
|
||||
# Remove unreferenced functions: function level linking
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -ffunction-sections")
|
||||
endif()
|
||||
|
||||
# Parallel mode
|
||||
#if(ENABLE_OPENMP)
|
||||
# set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -D_GLIBCXX_PARALLEL -fopenmp")
|
||||
# set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} gomp)
|
||||
#endif()
|
||||
|
||||
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG")
|
||||
set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0 -ggdb3 -DDEBUG -D_DEBUG")
|
||||
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@ -1121,14 +1077,12 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
# Extra link libs if the user selects building static libs:
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++)
|
||||
set(OPENCV_EXTRA_C_FLAGS "-fPIC ${OPENCV_EXTRA_C_FLAGS}")
|
||||
endif()
|
||||
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}")
|
||||
endif()
|
||||
|
||||
|
||||
# Add user supplied extra options (optimization, etc...)
|
||||
# ==========================================================
|
||||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS}" CACHE STRING "Extra compiler options")
|
||||
@ -1138,6 +1092,7 @@ set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS}" CACHE STRIN
|
||||
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)
|
||||
|
||||
#combine all "extra" options
|
||||
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}")
|
||||
@ -1149,10 +1104,8 @@ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${EXTRA_EX
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${EXTRA_EXE_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
# In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release:
|
||||
if (${CMAKE_GENERATOR} MATCHES ".*Makefiles")
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
if (${CMAKE_GENERATOR} MATCHES ".*Makefiles" AND "${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
if (WIN32 AND MSVC)
|
||||
@ -1172,39 +1125,16 @@ if (WIN32 AND MSVC)
|
||||
string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
|
||||
string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_CONFIGURE_LDFLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_CONFIGURE_LDFLAGS}")
|
||||
endif("${CMAKE_CONFIGURE_LDFLAGS}")
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# PROCESS SUBDIRECTORIES:
|
||||
# ----------------------------------------------------------------------------
|
||||
# Save libs and executables in the same place
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
|
||||
|
||||
if(ANDROID)
|
||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||
elseif(WIN32)
|
||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||
else()
|
||||
set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
set(OPENCV_LIB_INSTALL_PATH libs/${ARMEABI_NDK_NAME})
|
||||
else()
|
||||
set(OPENCV_LIB_INSTALL_PATH lib)
|
||||
endif()
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# Installation for CMake Module: OpenCVConfig.cmake
|
||||
# Installation for CMake Module: OpenCVConfig.cmake
|
||||
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
|
||||
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use with "make install"
|
||||
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
|
||||
@ -1238,7 +1168,11 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINA
|
||||
|
||||
if(UNIX)
|
||||
# For a command "FIND_PACKAGE(FOO)", CMake will look at the directory /usr/share|lib/FOO/FOOConfig.cmake, so:
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION share/OpenCV/)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION share/OpenCV/)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION share/OpenCV)
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------
|
||||
@ -1282,6 +1216,7 @@ if(ANDROID)
|
||||
endif()
|
||||
endif()
|
||||
endif(ANDROID)
|
||||
|
||||
# -------------------------------------------------------------------------------------------
|
||||
# Part 1/2: ${BIN_DIR}/OpenCV.mk -> For use *without* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
@ -1311,10 +1246,10 @@ endif(ANDROID)
|
||||
# includedir=${prefix}/include/opencv
|
||||
# -------------------------------------------------------------------------------------------
|
||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(libdir "\${exec_prefix}/lib")
|
||||
set(includedir "\${prefix}/include")
|
||||
set(VERSION ${OPENCV_VERSION})
|
||||
set(includedir "\${prefix}/include")
|
||||
set(VERSION ${OPENCV_VERSION})
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/opencv.pc" @ONLY IMMEDIATE)
|
||||
|
||||
@ -1322,10 +1257,6 @@ if(UNIX AND NOT ANDROID)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION share/OpenCV)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Uninstall target, for "make uninstall"
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -1334,9 +1265,7 @@ CONFIGURE_FILE(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
ADD_CUSTOM_TARGET(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
|
||||
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# CPack target
|
||||
@ -1345,17 +1274,14 @@ ADD_CUSTOM_TARGET(uninstall
|
||||
set(BUILD_PACKAGE OFF CACHE BOOL "Build a installer with the SDK")
|
||||
|
||||
if(BUILD_PACKAGE)
|
||||
|
||||
configure_file(
|
||||
Package.cmake.in
|
||||
${CMAKE_BINARY_DIR}/.cpack/Package.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
Package.cmake.in
|
||||
${CMAKE_BINARY_DIR}/.cpack/Package.cmake
|
||||
@ONLY
|
||||
)
|
||||
include(${CMAKE_BINARY_DIR}/.cpack/Package.cmake)
|
||||
|
||||
set(root_files README)
|
||||
|
||||
file(GLOB root_src_files *.in *.cmake CMakeLists.txt)
|
||||
|
||||
if (NOT WIN32)
|
||||
@ -1384,9 +1310,9 @@ if(BUILD_PACKAGE)
|
||||
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
|
||||
foreach(m calib3d core contrib features2d ffmpeg flann gpu highgui imgproc legacy ml objdetect video)
|
||||
install(FILES ${EXECUTABLE_OUTPUT_PATH}/Debug/opencv_${m}${OPENCV_DLLVERSION}d.dll
|
||||
DESTINATION bin COMPONENT main)
|
||||
DESTINATION bin COMPONENT main)
|
||||
install(FILES ${LIBRARY_OUTPUT_PATH}/Debug/opencv_${m}${OPENCV_DLLVERSION}d.lib
|
||||
DESTINATION lib COMPONENT main)
|
||||
DESTINATION lib COMPONENT main)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@ -1405,7 +1331,6 @@ if(BUILD_PACKAGE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
#-----------------------------------
|
||||
# Solution folders:
|
||||
#-----------------------------------
|
||||
@ -1426,14 +1351,12 @@ add_subdirectory(include)
|
||||
add_subdirectory(modules)
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(3rdparty)
|
||||
|
||||
if(BUILD_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
add_subdirectory(3rdparty)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Summary:
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -1550,8 +1473,8 @@ endif(BUILD_ANDROID_CAMERA_WRAPPER)
|
||||
else(ARMEABI_V7A)
|
||||
message(STATUS " AndroidNativeCamera: NO")
|
||||
endif(ARMEABI_V7A)
|
||||
endif()
|
||||
endif() #if(UNIX AND NOT APPLE)
|
||||
endif(ANDROID)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
if(APPLE)
|
||||
message(STATUS "")
|
||||
@ -1560,7 +1483,7 @@ message(STATUS " Video I/O: QuickTime")
|
||||
else()
|
||||
message(STATUS " Video I/O: QTKit")
|
||||
endif()
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
if(WIN32 AND HAVE_VIDEOINPUT)
|
||||
message(STATUS "")
|
||||
@ -1619,20 +1542,9 @@ else()
|
||||
message(STATUS " Build Documentation: NO")
|
||||
endif()
|
||||
|
||||
#if(BUILD_DOXYGEN_DOCS AND DOXYGEN_FOUND)
|
||||
#message(STATUS " Doxygen HTMLs YES")
|
||||
#else()
|
||||
#message(STATUS " Doxygen HTMLs NO")
|
||||
#endif()
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS " Install path: ${CMAKE_INSTALL_PREFIX}")
|
||||
message(STATUS "")
|
||||
message(STATUS " cvconfig.h is in: ${OPENCV_CONFIG_FILE_INCLUDE_DIR}")
|
||||
message(STATUS "-----------------------------------------------------------------")
|
||||
message(STATUS "")
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Generate the OpenCVConfig.cmake file for unix
|
||||
# installation in CMAKE_INSTALL_PREFIX
|
||||
#----------------------------------------------------------------------------
|
||||
|
@ -271,9 +271,9 @@ if( BUILD_WITH_ANDROID_NDK )
|
||||
set( STL_PATH "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++" )
|
||||
set( STL_LIBRARIES_PATH "${STL_PATH}/libs/${ARMEABI_NDK_NAME}" )
|
||||
include_directories( "${STL_PATH}/include" "${STL_LIBRARIES_PATH}/include" )
|
||||
if ( NOT ARMEABI AND NOT FORCE_ARM )
|
||||
set( STL_LIBRARIES_PATH "${ANDROID_NDK_TOOLCHAIN_ROOT}/arm-linux-androideabi/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb" )
|
||||
endif()
|
||||
# if ( NOT ARMEABI AND NOT FORCE_ARM )
|
||||
# set( STL_LIBRARIES_PATH "${ANDROID_NDK_TOOLCHAIN_ROOT}/arm-linux-androideabi/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb" )
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
if( BUILD_WITH_ANDROID_NDK_TOOLCHAIN )
|
||||
|
Loading…
Reference in New Issue
Block a user