mirror of https://github.com/opencv/opencv.git
[~] Automatically tracked dependencies between modules [+] Support for optional module dependencies [+] Options to choose modules to build [~] Removed hardcoded modules lists from OpenCVConfig.cmake, opencv.pc and OpenCV.mk [+] Added COMPONENTS support for FIND_PACKAGE(OpenCV) [~] haartraining and traincascade are moved outside of modules folder since they aren't the modulespull/13383/head
parent
ada9158521
commit
984eb99428
96 changed files with 2675 additions and 2056 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@ |
|||||||
|
add_subdirectory(haartraining) |
||||||
|
add_subdirectory(traincascade) |
@ -0,0 +1,41 @@ |
|||||||
|
if(IOS OR ANDROID) |
||||||
|
return() |
||||||
|
endif() |
||||||
|
|
||||||
|
SET(OPENCV_TRAINCASCADE_DEPS opencv_core opencv_ml opencv_imgproc opencv_objdetect opencv_highgui opencv_calib3d opencv_video opencv_features2d opencv_flann opencv_legacy) |
||||||
|
ocv_check_dependencies(${OPENCV_TRAINCASCADE_DEPS}) |
||||||
|
|
||||||
|
if(NOT OCV_DEPENDENCIES_FOUND) |
||||||
|
return() |
||||||
|
endif() |
||||||
|
|
||||||
|
project(traincascade) |
||||||
|
|
||||||
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv") |
||||||
|
ocv_include_modules(${OPENCV_TRAINCASCADE_DEPS}) |
||||||
|
|
||||||
|
set(traincascade_files traincascade.cpp |
||||||
|
cascadeclassifier.cpp cascadeclassifier.h |
||||||
|
boost.cpp boost.h features.cpp traincascade_features.h |
||||||
|
haarfeatures.cpp haarfeatures.h |
||||||
|
lbpfeatures.cpp lbpfeatures.h |
||||||
|
HOGfeatures.cpp HOGfeatures.h |
||||||
|
imagestorage.cpp imagestorage.h) |
||||||
|
|
||||||
|
set(the_target opencv_traincascade) |
||||||
|
add_executable(${the_target} ${traincascade_files}) |
||||||
|
target_link_libraries(${the_target} ${OPENCV_TRAINCASCADE_DEPS} opencv_haartraining_engine) |
||||||
|
|
||||||
|
set_target_properties(${the_target} PROPERTIES |
||||||
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
||||||
|
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} |
||||||
|
INSTALL_NAME_DIR lib |
||||||
|
OUTPUT_NAME "opencv_traincascade") |
||||||
|
|
||||||
|
if(ENABLE_SOLUTION_FOLDERS) |
||||||
|
set_target_properties(${the_target} PROPERTIES FOLDER "applications") |
||||||
|
endif() |
||||||
|
|
||||||
|
install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) |
||||||
|
|
@ -0,0 +1,65 @@ |
|||||||
|
if(NOT MSVC) |
||||||
|
message(FATAL_ERROR "CRT options are available only for MSVC" |
||||||
|
endif() |
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT) |
||||||
|
foreach(flag_var |
||||||
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
||||||
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO |
||||||
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE |
||||||
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) |
||||||
|
if(${flag_var} MATCHES "/MD") |
||||||
|
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") |
||||||
|
endif() |
||||||
|
if(${flag_var} MATCHES "/MDd") |
||||||
|
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}") |
||||||
|
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() |
||||||
|
foreach(flag_var |
||||||
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
||||||
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO |
||||||
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE |
||||||
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) |
||||||
|
if(${flag_var} MATCHES "/MT") |
||||||
|
string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}") |
||||||
|
endif() |
||||||
|
if(${flag_var} MATCHES "/MTd") |
||||||
|
string(REGEX REPLACE "/MTd" "/MDd" ${flag_var} "${${flag_var}}") |
||||||
|
endif() |
||||||
|
endforeach(flag_var) |
||||||
|
endif() |
||||||
|
|
||||||
|
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() |
||||||
|
endif() |
||||||
|
|
||||||
|
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() |
||||||
|
|
@ -0,0 +1,190 @@ |
|||||||
|
if (WIN32 AND CMAKE_GENERATOR MATCHES "(MinGW)|(MSYS)") |
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG" CACHE STRING "") |
||||||
|
endif() |
||||||
|
|
||||||
|
set(OPENCV_EXTRA_C_FLAGS "") |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "") |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_DEBUG "") |
||||||
|
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "") |
||||||
|
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "") |
||||||
|
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "") |
||||||
|
|
||||||
|
if(MSVC) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_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(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /Wp64") |
||||||
|
endif() |
||||||
|
#if(MSVC90) |
||||||
|
# set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /D _BIND_TO_CURRENT_CRT_VERSION=1 /D _BIND_TO_CURRENT_VCLIBS_VERSION=1") |
||||||
|
#endif() |
||||||
|
|
||||||
|
if(BUILD_WITH_DEBUG_INFO) |
||||||
|
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug") |
||||||
|
endif() |
||||||
|
|
||||||
|
# Remove unreferenced functions: function level linking |
||||||
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /Gy") |
||||||
|
if(BUILD_WITH_DEBUG_INFO) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /Zi") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX) |
||||||
|
# High level of warnings. |
||||||
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -Wall") |
||||||
|
|
||||||
|
# The -Wno-long-long is required in 64bit systems when including sytem headers. |
||||||
|
if(X86_64) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -Wno-long-long") |
||||||
|
endif() |
||||||
|
|
||||||
|
# We need pthread's |
||||||
|
if(UNIX AND NOT ANDROID) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -pthread") |
||||||
|
endif() |
||||||
|
|
||||||
|
if(OPENCV_WARNINGS_ARE_ERRORS) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -Werror") |
||||||
|
endif() |
||||||
|
|
||||||
|
if(X86 AND NOT MINGW64 AND NOT X86_64 AND NOT APPLE) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -march=i686") |
||||||
|
endif() |
||||||
|
|
||||||
|
# Other optimizations |
||||||
|
if(ENABLE_OMIT_FRAME_POINTER) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer") |
||||||
|
else() |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -fno-omit-frame-pointer") |
||||||
|
endif() |
||||||
|
if(ENABLE_FAST_MATH) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -ffast-math") |
||||||
|
endif() |
||||||
|
if(ENABLE_POWERPC) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5") |
||||||
|
endif() |
||||||
|
if(ENABLE_SSE) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse") |
||||||
|
endif() |
||||||
|
if(ENABLE_SSE2) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_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(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse3") |
||||||
|
endif() |
||||||
|
|
||||||
|
if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 402) |
||||||
|
set(HAVE_GCC43_OR_NEWER 1) |
||||||
|
endif() |
||||||
|
if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 401) |
||||||
|
set(HAVE_GCC42_OR_NEWER 1) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(HAVE_GCC42_OR_NEWER OR APPLE) |
||||||
|
if(ENABLE_SSSE3) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -mssse3") |
||||||
|
endif() |
||||||
|
if(HAVE_GCC43_OR_NEWER) |
||||||
|
if(ENABLE_SSE41) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse4.1") |
||||||
|
endif() |
||||||
|
if(ENABLE_SSE42) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse4.2") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
endif(NOT MINGW) |
||||||
|
|
||||||
|
if(X86 OR X86_64) |
||||||
|
if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -mfpmath=387") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
# Profiling? |
||||||
|
if(ENABLE_PROFILING) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -pg -g") |
||||||
|
elseif(NOT APPLE) |
||||||
|
# Remove unreferenced functions: function level linking |
||||||
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -ffunction-sections") |
||||||
|
endif() |
||||||
|
|
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -DNDEBUG") |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_DEBUG "${OPENCV_EXTRA_C_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG") |
||||||
|
if(BUILD_WITH_DEBUG_INFO) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_DEBUG "${OPENCV_EXTRA_C_FLAGS_DEBUG} -ggdb3") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if(MSVC) |
||||||
|
# 64-bit MSVC compiler uses SSE/SSE2 by default |
||||||
|
if(NOT MSVC64) |
||||||
|
if(ENABLE_SSE) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /arch:SSE") |
||||||
|
endif() |
||||||
|
if(ENABLE_SSE2) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /arch:SSE2") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
if(ENABLE_SSE3) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /arch:SSE3") |
||||||
|
endif() |
||||||
|
if(ENABLE_SSE4_1) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /arch:SSE4.1") |
||||||
|
endif() |
||||||
|
if (ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1) |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /Oi") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
# Extra link libs if the user selects building static libs: |
||||||
|
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 INTERNAL "Extra compiler options") |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE}" CACHE INTERNAL "Extra compiler options for Release build") |
||||||
|
set(OPENCV_EXTRA_C_FLAGS_DEBUG "${OPENCV_EXTRA_C_FLAGS_DEBUG}" CACHE INTERNAL "Extra compiler options for Debug build") |
||||||
|
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS}" CACHE INTERNAL "Extra linker flags") |
||||||
|
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}" CACHE INTERNAL "Extra linker flags for Release build") |
||||||
|
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}" CACHE INTERNAL "Extra linker flags for Debug build") |
||||||
|
|
||||||
|
#combine all "extra" options |
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPENCV_EXTRA_C_FLAGS}") |
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_C_FLAGS}") |
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OPENCV_EXTRA_C_FLAGS_RELEASE}") |
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${OPENCV_EXTRA_C_FLAGS_RELEASE}") |
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OPENCV_EXTRA_C_FLAGS_DEBUG}") |
||||||
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${OPENCV_EXTRA_C_FLAGS_DEBUG}") |
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPENCV_EXTRA_EXE_LINKER_FLAGS}") |
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}") |
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}") |
||||||
|
|
||||||
|
if (WIN32 AND MSVC) |
||||||
|
# avoid warnings from MSVC about overriding the /W* option |
||||||
|
# we replace /W3 with /W4 only for C++ files, |
||||||
|
# since all the 3rd-party libraries OpenCV uses are in C, |
||||||
|
# and we do not care about their warnings. |
||||||
|
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |
||||||
|
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") |
||||||
|
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") |
||||||
|
|
||||||
|
# allow extern "C" functions throw exceptions |
||||||
|
string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") |
||||||
|
string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") |
||||||
|
string(REPLACE "/EHsc" "/EHsc-" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") |
||||||
|
string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |
||||||
|
string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") |
||||||
|
string(REPLACE "/EHsc" "/EHsc-" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") |
||||||
|
|
||||||
|
string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |
||||||
|
string(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") |
||||||
|
endif() |
@ -0,0 +1,91 @@ |
|||||||
|
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) |
||||||
|
file(TO_CMAKE_PATH "$ENV{ANDROID_SDK}" ANDROID_SDK_ENV_PATH) |
||||||
|
|
||||||
|
#find android SDK |
||||||
|
find_host_program(ANDROID_EXECUTABLE |
||||||
|
NAMES android.bat android |
||||||
|
PATHS "${ANDROID_SDK_ENV_PATH}/tools/" |
||||||
|
"${ProgramFiles_ENV_PATH}/Android/android-sdk/tools/" |
||||||
|
"/opt/android-sdk/tools/" |
||||||
|
"/opt/android-sdk-linux_x86/tools/" |
||||||
|
"/opt/android-sdk-mac_x86/tools/" |
||||||
|
"/opt/android-sdk-linux_86/tools/" |
||||||
|
"/opt/android-sdk-mac_86/tools/" |
||||||
|
) |
||||||
|
|
||||||
|
if(ANDROID_EXECUTABLE) |
||||||
|
message(STATUS " Found android tool: ${ANDROID_EXECUTABLE}") |
||||||
|
get_filename_component(ANDROID_SDK_TOOLS_PATH "${ANDROID_EXECUTABLE}" PATH) |
||||||
|
|
||||||
|
#read source.properties |
||||||
|
if(EXISTS "${ANDROID_SDK_TOOLS_PATH}/source.properties") |
||||||
|
file(STRINGS "${ANDROID_SDK_TOOLS_PATH}/source.properties" ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES REGEX "^[ ]*[^#].*$") |
||||||
|
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() |
||||||
|
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() |
||||||
|
MARK_AS_ADVANCED(ANDROID_TOOLS_Pkg_Desc) |
||||||
|
endif() |
||||||
|
|
||||||
|
#get installed targets |
||||||
|
execute_process(COMMAND ${ANDROID_EXECUTABLE} list target |
||||||
|
RESULT_VARIABLE ANDROID_PROCESS |
||||||
|
OUTPUT_VARIABLE ANDROID_SDK_TARGETS_FULL |
||||||
|
ERROR_VARIABLE ANDROID_PROCESS_ERRORS |
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE |
||||||
|
) |
||||||
|
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() |
||||||
|
|
||||||
|
# detect ANDROID_SDK_TARGET if no target is provided by user |
||||||
|
if(NOT ANDROID_SDK_TARGET) |
||||||
|
set(desired_android_target_level ${ANDROID_NATIVE_API_LEVEL}) |
||||||
|
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") |
||||||
|
|
||||||
|
foreach(target ${ANDROID_SDK_TARGETS}) |
||||||
|
string(REGEX MATCH "[0-9]+$" target_level "${target}") |
||||||
|
if(target_level GREATER desired_android_target_level_1) |
||||||
|
set(ANDROID_SDK_TARGET "${target}") |
||||||
|
break() |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
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") |
||||||
|
endif() |
||||||
|
endif(NOT ANDROID_SDK_TARGET) |
||||||
|
|
||||||
|
SET(ANDROID_SDK_TARGET "${ANDROID_SDK_TARGET}" CACHE STRING "SDK target for Android tests and samples") |
||||||
|
if(ANDROID_PROCESS EQUAL 0 AND CMAKE_VERSION VERSION_GREATER "2.8") |
||||||
|
set_property( CACHE ANDROID_SDK_TARGET PROPERTY STRINGS ${ANDROID_SDK_TARGETS} ) |
||||||
|
endif() |
||||||
|
string(REGEX MATCH "[0-9]+$" ANDROID_SDK_TARGET_LEVEL "${ANDROID_SDK_TARGET}") |
||||||
|
endif(ANDROID_EXECUTABLE) |
@ -0,0 +1,16 @@ |
|||||||
|
file(TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH) |
||||||
|
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) |
||||||
|
|
||||||
|
find_host_program(ANT_EXECUTABLE NAMES ant.bat ant |
||||||
|
PATHS "${ANT_DIR_ENV_PATH}/bin" |
||||||
|
"${ProgramFiles_ENV_PATH}/apache-ant/bin" |
||||||
|
) |
||||||
|
|
||||||
|
if(ANT_EXECUTABLE) |
||||||
|
execute_process(COMMAND ${ANT_EXECUTABLE} -version |
||||||
|
OUTPUT_VARIABLE ANT_VERSION_FULL |
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
||||||
|
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" ANT_VERSION "${ANT_VERSION_FULL}") |
||||||
|
|
||||||
|
message(STATUS " Found apache ant ${ANT_VERSION}: ${ANT_EXECUTABLE}") |
||||||
|
endif() |
@ -0,0 +1,88 @@ |
|||||||
|
find_package(CUDA 4.0) |
||||||
|
|
||||||
|
if(CUDA_FOUND) |
||||||
|
set(HAVE_CUDA 1) |
||||||
|
|
||||||
|
if(WITH_CUFFT) |
||||||
|
set(HAVE_CUFFT 1) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(WITH_CUBLAS) |
||||||
|
set(HAVE_CUBLAS 1) |
||||||
|
endif() |
||||||
|
|
||||||
|
message(STATUS "CUDA detected: " ${CUDA_VERSION}) |
||||||
|
|
||||||
|
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") |
||||||
|
|
||||||
|
string(REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}") |
||||||
|
string(REGEX REPLACE "\\." "" ARCH_PTX_NO_POINTS "${CUDA_ARCH_PTX}") |
||||||
|
|
||||||
|
# Ckeck if user specified 1.0 compute capability: we don't support it |
||||||
|
string(REGEX MATCH "1.0" HAS_ARCH_10 "${CUDA_ARCH_BIN} ${CUDA_ARCH_PTX}") |
||||||
|
set(CUDA_ARCH_BIN_OR_PTX_10 0) |
||||||
|
if(NOT ${HAS_ARCH_10} STREQUAL "") |
||||||
|
set(CUDA_ARCH_BIN_OR_PTX_10 1) |
||||||
|
endif() |
||||||
|
|
||||||
|
# NVCC flags to be set |
||||||
|
set(NVCC_FLAGS_EXTRA "") |
||||||
|
|
||||||
|
# These vars will be passed into the templates |
||||||
|
set(OPENCV_CUDA_ARCH_BIN "") |
||||||
|
set(OPENCV_CUDA_ARCH_PTX "") |
||||||
|
set(OPENCV_CUDA_ARCH_FEATURES "") |
||||||
|
|
||||||
|
# Tell NVCC to add binaries for the specified GPUs |
||||||
|
string(REGEX MATCHALL "[0-9()]+" ARCH_LIST "${ARCH_BIN_NO_POINTS}") |
||||||
|
foreach(ARCH IN LISTS ARCH_LIST) |
||||||
|
if(ARCH MATCHES "([0-9]+)\\(([0-9]+)\\)") |
||||||
|
# User explicitly specified PTX for the concrete BIN |
||||||
|
set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1}) |
||||||
|
set(OPENCV_CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN} ${CMAKE_MATCH_1}") |
||||||
|
set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${CMAKE_MATCH_2}") |
||||||
|
else() |
||||||
|
# User didn't explicitly specify PTX for the concrete BIN, we assume PTX=BIN |
||||||
|
set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=sm_${ARCH}) |
||||||
|
set(OPENCV_CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN} ${ARCH}") |
||||||
|
set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}") |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
|
||||||
|
# Tell NVCC to add PTX intermediate code for the specified architectures |
||||||
|
string(REGEX MATCHALL "[0-9]+" ARCH_LIST "${ARCH_PTX_NO_POINTS}") |
||||||
|
foreach(ARCH IN LISTS ARCH_LIST) |
||||||
|
set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=compute_${ARCH}) |
||||||
|
set(OPENCV_CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX} ${ARCH}") |
||||||
|
set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}") |
||||||
|
endforeach() |
||||||
|
|
||||||
|
# These vars will be processed in other scripts |
||||||
|
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${NVCC_FLAGS_EXTRA}) |
||||||
|
set(OpenCV_CUDA_CC "${NVCC_FLAGS_EXTRA}") |
||||||
|
|
||||||
|
message(STATUS "CUDA NVCC target flags: ${CUDA_NVCC_FLAGS}") |
||||||
|
|
||||||
|
macro(OCV_CUDA_COMPILE VAR) |
||||||
|
if (BUILD_SHARED_LIBS) |
||||||
|
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -DCVAPI_EXPORTS) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(UNIX OR APPLE) |
||||||
|
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC) |
||||||
|
endif() |
||||||
|
if(APPLE) |
||||||
|
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only) |
||||||
|
endif() |
||||||
|
|
||||||
|
# we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1) |
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG_ ${CMAKE_CXX_FLAGS_DEBUG}) |
||||||
|
string(REPLACE "-ggdb3" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) |
||||||
|
CUDA_COMPILE(${VAR} ${ARGN}) |
||||||
|
set(CMAKE_CXX_DEBUG_FLAGS ${CMAKE_CXX_FLAGS_DEBUG_}) |
||||||
|
endmacro() |
||||||
|
else() |
||||||
|
unset(CUDA_ARCH_BIN CACHE) |
||||||
|
unset(CUDA_ARCH_PTX CACHE) |
||||||
|
endif() |
@ -0,0 +1,76 @@ |
|||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
# Detect Microsoft compiler: |
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
if(CMAKE_CL_64) |
||||||
|
set(MSVC64 1) |
||||||
|
endif() |
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
# Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ): |
||||||
|
# see include/opencv/cxtypes.h file for related ICC & CV_ICC defines. |
||||||
|
# NOTE: The system needs to determine if the '-fPIC' option needs to be added |
||||||
|
# for the 3rdparty static libs being compiled. The CMakeLists.txt files |
||||||
|
# in 3rdparty use the CV_ICC definition being set here to determine if |
||||||
|
# the -fPIC flag should be used. |
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
if(UNIX) |
||||||
|
if (__ICL) |
||||||
|
set(CV_ICC __ICL) |
||||||
|
elseif(__ICC) |
||||||
|
set(CV_ICC __ICC) |
||||||
|
elseif(__ECL) |
||||||
|
set(CV_ICC __ECL) |
||||||
|
elseif(__ECC) |
||||||
|
set(CV_ICC __ECC) |
||||||
|
elseif(__INTEL_COMPILER) |
||||||
|
set(CV_ICC __INTEL_COMPILER) |
||||||
|
elseif(CMAKE_C_COMPILER MATCHES "icc") |
||||||
|
set(CV_ICC icc_matches_c_compiler) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if(MSVC AND CMAKE_C_COMPILER MATCHES "icc") |
||||||
|
set(CV_ICC __INTEL_COMPILER_FOR_WINDOWS) |
||||||
|
endif() |
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
# Detect GNU version: |
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX) |
||||||
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version |
||||||
|
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL |
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
||||||
|
|
||||||
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v |
||||||
|
ERROR_VARIABLE CMAKE_OPENCV_GCC_INFO_FULL |
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
||||||
|
|
||||||
|
# Typical output in CMAKE_OPENCV_GCC_VERSION_FULL: "c+//0 (whatever) 4.2.3 (...)" |
||||||
|
# Look for the version number |
||||||
|
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}") |
||||||
|
|
||||||
|
# Split the three parts: |
||||||
|
string(REGEX MATCHALL "[0-9]+" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}") |
||||||
|
|
||||||
|
list(GET CMAKE_OPENCV_GCC_VERSIONS 0 CMAKE_OPENCV_GCC_VERSION_MAJOR) |
||||||
|
list(GET CMAKE_OPENCV_GCC_VERSIONS 1 CMAKE_OPENCV_GCC_VERSION_MINOR) |
||||||
|
|
||||||
|
set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR}) |
||||||
|
math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}") |
||||||
|
message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})") |
||||||
|
|
||||||
|
if(WIN32) |
||||||
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine |
||||||
|
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE |
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
||||||
|
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64") |
||||||
|
set(MINGW64 1) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES amd64.*|x86_64.*) |
||||||
|
set(X86_64 1) |
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES i686.*|i386.*|x86.*) |
||||||
|
set(X86 1) |
||||||
|
endif() |
@ -0,0 +1,59 @@ |
|||||||
|
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) |
||||||
|
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}") |
||||||
|
if(CMAKE_HOST_UNIX) |
||||||
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_python_lib()" |
||||||
|
RESULT_VARIABLE PYTHON_CVPY_PROCESS |
||||||
|
OUTPUT_VARIABLE PYTHON_STD_PACKAGES_PATH |
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
||||||
|
if("${PYTHON_STD_PACKAGES_PATH}" MATCHES "site-packages") |
||||||
|
set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages CACHE PATH "Where to install the python packages.") |
||||||
|
else() #debian based assumed, install to the dist-packages. |
||||||
|
set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/dist-packages CACHE PATH "Where to install the python packages.") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if(CMAKE_HOST_WIN32) |
||||||
|
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() |
||||||
|
|
||||||
|
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy |
||||||
|
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]" |
||||||
|
RESULT_VARIABLE PYTHON_NUMPY_PROCESS |
||||||
|
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS |
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
||||||
|
|
||||||
|
if(PYTHON_NUMPY_PROCESS EQUAL 0) |
||||||
|
set(PYTHON_USE_NUMPY 1) |
||||||
|
add_definitions(-DPYTHON_USE_NUMPY=1) |
||||||
|
include_directories(AFTER ${PYTHON_NUMPY_INCLUDE_DIRS}) |
||||||
|
message(STATUS " Use NumPy headers from: ${PYTHON_NUMPY_INCLUDE_DIRS}") |
||||||
|
else() |
||||||
|
set(PYTHON_USE_NUMPY 0) |
||||||
|
endif() |
||||||
|
|
||||||
|
# look for Sphinx |
||||||
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx; print sphinx.__version__" |
||||||
|
RESULT_VARIABLE SPHINX_PROCESS |
||||||
|
OUTPUT_VARIABLE SPHINX_VERSION |
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
||||||
|
|
||||||
|
set(HAVE_SPHINX 0) |
||||||
|
if(SPHINX_PROCESS EQUAL 0) |
||||||
|
find_host_program(SPHINX_BUILD sphinx-build) |
||||||
|
if(SPHINX_BUILD) |
||||||
|
set(HAVE_SPHINX 1) |
||||||
|
message(STATUS " Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}") |
||||||
|
endif() |
||||||
|
endif() |
@ -0,0 +1,63 @@ |
|||||||
|
if(UNIX AND NOT APPLE AND NOT ANDROID) |
||||||
|
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}) |
||||||
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES}) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if(NOT HAVE_TBB) |
||||||
|
set(TBB_DEFAULT_INCLUDE_DIRS "/opt/intel/tbb" "/usr/local/include" "/usr/include" "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB" "C:/Program Files (x86)/TBB" "${CMAKE_INSTALL_PREFIX}/include") |
||||||
|
|
||||||
|
find_path(TBB_INCLUDE_DIR "tbb/tbb.h" PATHS ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers") |
||||||
|
if(TBB_INCLUDE_DIR) |
||||||
|
if(UNIX) |
||||||
|
set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory") |
||||||
|
link_directories("${TBB_LIB_DIR}") |
||||||
|
endif() |
||||||
|
if(APPLE) |
||||||
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libtbb.dylib) |
||||||
|
elseif(ANDROID) |
||||||
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb) |
||||||
|
add_definitions(-DTBB_USE_GCC_BUILTINS) |
||||||
|
elseif (UNIX) |
||||||
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb) |
||||||
|
elseif (WIN32) |
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX) |
||||||
|
set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory") |
||||||
|
link_directories("${TBB_LIB_DIR}") |
||||||
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb) |
||||||
|
else() |
||||||
|
get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIR}/../lib" ABSOLUTE) |
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES amd64*|x86_64* OR MSVC64) |
||||||
|
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64") |
||||||
|
elseif() |
||||||
|
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32") |
||||||
|
endif() |
||||||
|
|
||||||
|
if(MSVC80) |
||||||
|
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8") |
||||||
|
elseif(MSVC90) |
||||||
|
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9") |
||||||
|
elseif(MSVC10) |
||||||
|
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10") |
||||||
|
elseif(MSVC11) |
||||||
|
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc11") |
||||||
|
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(TBB_INCLUDE_DIR) |
||||||
|
endif(NOT HAVE_TBB) |
@ -0,0 +1,53 @@ |
|||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
# Uninstall target, for "make uninstall" |
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
CONFIGURE_FILE( |
||||||
|
"${OpenCV_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in" |
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" |
||||||
|
IMMEDIATE @ONLY) |
||||||
|
|
||||||
|
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") |
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
# Source package, for "make package_source" |
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
if(BUILD_PACKAGE) |
||||||
|
set(TARBALL_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}") |
||||||
|
if (NOT WIN32) |
||||||
|
if(APPLE) |
||||||
|
set(TAR_CMD gnutar) |
||||||
|
else() |
||||||
|
set(TAR_CMD tar) |
||||||
|
endif() |
||||||
|
set(TAR_TRANSFORM "\"s,^,${TARBALL_NAME}/,\"") |
||||||
|
add_custom_target(package_source |
||||||
|
#TODO: maybe we should not remove dll's |
||||||
|
COMMAND ${TAR_CMD} --transform ${TAR_TRANSFORM} -cjpf ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL_NAME}.tar.bz2 --exclude=".svn" --exclude="*.pyc" --exclude="*.vcproj" --exclude="*/lib/*" --exclude="*.dll" ./ |
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
||||||
|
else() |
||||||
|
add_custom_target(package_source |
||||||
|
COMMAND zip -9 -r ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL_NAME}.zip . -x '*/.svn/*' '*.vcproj' '*.pyc' |
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------- |
||||||
|
# performance tests, for "make perf" |
||||||
|
#----------------------------------- |
||||||
|
if(BUILD_PERF_TESTS AND PYTHON_EXECUTABLE) |
||||||
|
if(CMAKE_VERSION VERSION_GREATER "2.8.2") |
||||||
|
add_custom_target(perf |
||||||
|
${PYTHON_EXECUTABLE} "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" --configuration $<CONFIGURATION> "${CMAKE_BINARY_DIR}" |
||||||
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" |
||||||
|
DEPENDS "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" |
||||||
|
) |
||||||
|
else() |
||||||
|
add_custom_target(perf |
||||||
|
${PYTHON_EXECUTABLE} "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" "${CMAKE_BINARY_DIR}" |
||||||
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" |
||||||
|
DEPENDS "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" |
||||||
|
) |
||||||
|
endif() |
||||||
|
endif() |
@ -0,0 +1,83 @@ |
|||||||
|
if(ANDROID) |
||||||
|
# -------------------------------------------------------------------------------------------- |
||||||
|
# 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" |
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
|
||||||
|
# build type |
||||||
|
if(BUILD_SHARED_LIBS) |
||||||
|
set(OPENCV_LIBTYPE_CONFIGMAKE "SHARED") |
||||||
|
else() |
||||||
|
set(OPENCV_LIBTYPE_CONFIGMAKE "STATIC") |
||||||
|
endif() |
||||||
|
|
||||||
|
# setup lists of camera libs |
||||||
|
foreach(abi ARMEABI ARMEABI_V7A X86) |
||||||
|
ANDROID_GET_ABI_RAWNAME(${abi} ndkabi) |
||||||
|
if(BUILD_ANDROID_CAMERA_WRAPPER) |
||||||
|
if(ndkabi STREQUAL ANDROID_NDK_ABI_NAME) |
||||||
|
set(OPENCV_CAMERA_LIBS_${abi}_CONFIGCMAKE "native_camera_r${ANDROID_VERSION}") |
||||||
|
else() |
||||||
|
set(OPENCV_CAMERA_LIBS_${abi}_CONFIGCMAKE "") |
||||||
|
endif() |
||||||
|
elseif(HAVE_opencv_androidcamera) |
||||||
|
set(OPENCV_CAMERA_LIBS_${abi}_CONFIGCMAKE "") |
||||||
|
file(GLOB OPENCV_CAMERA_LIBS "${OpenCV_SOURCE_DIR}/3rdparty/lib/${ndkabi}/libnative_camera_r*.so") |
||||||
|
if(OPENCV_CAMERA_LIBS) |
||||||
|
list(SORT OPENCV_CAMERA_LIBS) |
||||||
|
endif() |
||||||
|
foreach(cam_lib ${OPENCV_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(OPENCV_CAMERA_LIBS_${abi}_CONFIGCMAKE "${OPENCV_CAMERA_LIBS_${abi}_CONFIGCMAKE} ${cam_lib}") |
||||||
|
endforeach() |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
|
||||||
|
# build the list of opencv libs and dependencies for all modules |
||||||
|
set(OPENCV_MODULES_CONFIGMAKE "") |
||||||
|
set(OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "") |
||||||
|
set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE "") |
||||||
|
foreach(m ${OPENCV_MODULES_PUBLIC}) |
||||||
|
list(INSERT OPENCV_MODULES_CONFIGMAKE 0 ${${m}_MODULE_DEPS_${ocv_optkind}} ${m}) |
||||||
|
if(${m}_EXTRA_DEPS_${ocv_optkind}) |
||||||
|
list(INSERT OPENCV_EXTRA_COMPONENTS_CONFIGMAKE 0 ${${m}_EXTRA_DEPS_${ocv_optkind}}) |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
|
||||||
|
# split 3rdparty libs and modules |
||||||
|
foreach(mod ${OPENCV_MODULES_CONFIGMAKE}) |
||||||
|
if(NOT mod MATCHES "^opencv_.+$") |
||||||
|
list(INSERT OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE 0 ${mod}) |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
list(REMOVE_ITEM OPENCV_MODULES_CONFIGMAKE ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE}) |
||||||
|
|
||||||
|
# convert CMake lists to makefile literals |
||||||
|
foreach(lst OPENCV_MODULES_CONFIGMAKE OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE OPENCV_EXTRA_COMPONENTS_CONFIGMAKE) |
||||||
|
ocv_list_unique(${lst}) |
||||||
|
ocv_list_reverse(${lst}) |
||||||
|
string(REPLACE ";" " " ${lst} "${${lst}}") |
||||||
|
endforeach() |
||||||
|
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}") |
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
# Part 1/2: ${BIN_DIR}/OpenCV.mk -> For use *without* "make install" |
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"") |
||||||
|
set(OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE "\"${OpenCV_SOURCE_DIR}\"") |
||||||
|
set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)") |
||||||
|
|
||||||
|
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" IMMEDIATE @ONLY) |
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
# Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install" |
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/../../include/opencv\" \"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/../../include\"") |
||||||
|
set(OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE "") |
||||||
|
set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../..") |
||||||
|
|
||||||
|
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" IMMEDIATE @ONLY) |
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION share/OpenCV/) |
||||||
|
endif(ANDROID) |
@ -0,0 +1,130 @@ |
|||||||
|
# -------------------------------------------------------------------------------------------- |
||||||
|
# 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 |
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
|
||||||
|
if(INSTALL_TO_MANGLED_PATHS) |
||||||
|
set(OpenCV_USE_MANGLED_PATHS TRUE) |
||||||
|
else() |
||||||
|
set(OpenCV_USE_MANGLED_PATHS FALSE) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(NOT OpenCV_CUDA_CC) |
||||||
|
set(OpenCV_CUDA_CC_CONFIGMAKE "\"\"") |
||||||
|
else() |
||||||
|
set(OpenCV_CUDA_CC_CONFIGMAKE "${OpenCV_CUDA_CC}") |
||||||
|
endif() |
||||||
|
|
||||||
|
if(NOT ANDROID_NATIVE_API_LEVEL) |
||||||
|
set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGMAKE 0) |
||||||
|
else() |
||||||
|
set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGMAKE "${ANDROID_NATIVE_API_LEVEL}") |
||||||
|
endif() |
||||||
|
|
||||||
|
|
||||||
|
#build list of modules available for the OpenCV user |
||||||
|
set(OpenCV_LIB_COMPONENTS "") |
||||||
|
foreach(m ${OPENCV_MODULES_PUBLIC}) |
||||||
|
list(INSERT OpenCV_LIB_COMPONENTS 0 ${${m}_MODULE_DEPS_OPT} ${m}) |
||||||
|
endforeach() |
||||||
|
ocv_list_unique(OpenCV_LIB_COMPONENTS) |
||||||
|
set(OPENCV_MODULES_CONFIGMAKE ${OpenCV_LIB_COMPONENTS}) |
||||||
|
ocv_list_filterout(OpenCV_LIB_COMPONENTS "^opencv_") |
||||||
|
if(OpenCV_LIB_COMPONENTS) |
||||||
|
list(REMOVE_ITEM OPENCV_MODULES_CONFIGMAKE ${OpenCV_LIB_COMPONENTS}) |
||||||
|
endif() |
||||||
|
|
||||||
|
macro(ocv_generate_dependencies_map_configmake suffix) |
||||||
|
set(OPENCV_DEPENDENCIES_MAP_${suffix} "") |
||||||
|
set(OPENCV_PROCESSED_LIBS "") |
||||||
|
set(OPENCV_LIBS_TO_PROCESS ${OPENCV_MODULES_CONFIGMAKE}) |
||||||
|
while(OPENCV_LIBS_TO_PROCESS) |
||||||
|
list(GET OPENCV_LIBS_TO_PROCESS 0 __ocv_lib) |
||||||
|
|
||||||
|
set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_DEPS_${suffix} ${${__ocv_lib}_MODULE_DEPS_${suffix}})\n") |
||||||
|
set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_EXTRA_DEPS_${suffix} ${${__ocv_lib}_EXTRA_DEPS_${suffix}})\n") |
||||||
|
|
||||||
|
list(APPEND OPENCV_PROCESSED_LIBS ${__ocv_lib}) |
||||||
|
list(APPEND OPENCV_LIBS_TO_PROCESS ${${__ocv_lib}_MODULE_DEPS_${suffix}}) |
||||||
|
list(REMOVE_ITEM OPENCV_LIBS_TO_PROCESS ${OPENCV_PROCESSED_LIBS}) |
||||||
|
endwhile() |
||||||
|
unset(OPENCV_PROCESSED_LIBS) |
||||||
|
unset(OPENCV_LIBS_TO_PROCESS) |
||||||
|
unset(__ocv_lib) |
||||||
|
endmacro() |
||||||
|
|
||||||
|
ocv_generate_dependencies_map_configmake(OPT) |
||||||
|
ocv_generate_dependencies_map_configmake(DBG) |
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install" |
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"") |
||||||
|
set(CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "${OpenCV_SOURCE_DIR}") |
||||||
|
set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}") |
||||||
|
set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") |
||||||
|
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY) |
||||||
|
|
||||||
|
#support for version checking when finding opencv. find_package(OpenCV 2.3.1 EXACT) should now work. |
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig-version.cmake" IMMEDIATE @ONLY) |
||||||
|
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------- |
||||||
|
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install" |
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_PREFIX}/opencv" "\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_PREFIX}\"") |
||||||
|
|
||||||
|
set(CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "") |
||||||
|
if(ANDROID) |
||||||
|
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}\"") |
||||||
|
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}\"") |
||||||
|
if(INSTALL_TO_MANGLED_PATHS) |
||||||
|
set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV-${OPENCV_VERSION}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
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) |
||||||
|
|
||||||
|
if(UNIX) |
||||||
|
#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(INSTALL_TO_MANGLED_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() |
||||||
|
install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION share/OpenCV/) |
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION share/OpenCV/) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if(ANDROID) |
||||||
|
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION share/OpenCV) |
||||||
|
endif() |
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------- |
||||||
|
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages |
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
if(WIN32) |
||||||
|
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${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}\"") |
||||||
|
|
||||||
|
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL) |
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY) |
||||||
|
|
||||||
|
# Install the OpenCVConfig.cmake file which has the right paths pointing to the install directory |
||||||
|
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/") |
||||||
|
endif() |
||||||
|
|
@ -0,0 +1,36 @@ |
|||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
# 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}") |
||||||
|
|
||||||
|
# platform-specific config file |
||||||
|
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h") |
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
# opencv_modules.hpp based on actual modules list |
||||||
|
# ---------------------------------------------------------------------------- |
||||||
|
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "") |
||||||
|
|
||||||
|
set(OPENCV_MOD_LIST ${OPENCV_MODULES_PUBLIC}) |
||||||
|
ocv_list_sort(OPENCV_MOD_LIST) |
||||||
|
foreach(m ${OPENCV_MOD_LIST}) |
||||||
|
string(TOUPPER "${m}" m) |
||||||
|
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}#define HAVE_${m} 1\n") |
||||||
|
endforeach() |
||||||
|
|
||||||
|
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}\n") |
||||||
|
|
||||||
|
set(OPENCV_MOD_LIST ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO}) |
||||||
|
ocv_list_sort(OPENCV_MOD_LIST) |
||||||
|
foreach(m ${OPENCV_MOD_LIST}) |
||||||
|
string(TOUPPER "${m}" m) |
||||||
|
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}#undef HAVE_${m}\n") |
||||||
|
endforeach() |
||||||
|
|
||||||
|
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv_modules.hpp.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp") |
||||||
|
install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2 COMPONENT main) |
@ -0,0 +1,75 @@ |
|||||||
|
# -------------------------------------------------------------------------------------------- |
||||||
|
# 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 |
||||||
|
# its own name (for example, GTK 1.2 might have the package name "gtk+" |
||||||
|
# while GTK 2.0 has "gtk+-2.0"). |
||||||
|
# |
||||||
|
# ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install" |
||||||
|
# ------------------------------------------------------------------------------------------- |
||||||
|
set(prefix "${CMAKE_INSTALL_PREFIX}") |
||||||
|
set(exec_prefix "\${prefix}") |
||||||
|
set(libdir "") #TODO: need link paths for OpenCV_EXTRA_COMPONENTS |
||||||
|
set(includedir "\${prefix}/${OPENCV_INCLUDE_PREFIX}") |
||||||
|
set(VERSION ${OPENCV_VERSION}) |
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE MATCHES "Release") |
||||||
|
set(ocv_optkind OPT) |
||||||
|
else() |
||||||
|
set(ocv_optkind DBG) |
||||||
|
endif() |
||||||
|
|
||||||
|
#build the list of opencv libs and dependencies for all modules |
||||||
|
set(OpenCV_LIB_COMPONENTS "") |
||||||
|
set(OpenCV_EXTRA_COMPONENTS "") |
||||||
|
foreach(m ${OPENCV_MODULES_PUBLIC}) |
||||||
|
list(INSERT OpenCV_LIB_COMPONENTS 0 ${${m}_MODULE_DEPS_${ocv_optkind}} ${m}) |
||||||
|
if(${m}_EXTRA_DEPS_${ocv_optkind}) |
||||||
|
list(INSERT OpenCV_EXTRA_COMPONENTS 0 ${${m}_EXTRA_DEPS_${ocv_optkind}}) |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
|
||||||
|
ocv_list_unique(OpenCV_LIB_COMPONENTS) |
||||||
|
ocv_list_unique(OpenCV_EXTRA_COMPONENTS) |
||||||
|
ocv_list_reverse(OpenCV_LIB_COMPONENTS) |
||||||
|
ocv_list_reverse(OpenCV_EXTRA_COMPONENTS) |
||||||
|
|
||||||
|
#build the list of components |
||||||
|
set(OpenCV_LIB_COMPONENTS_ "") |
||||||
|
foreach(CVLib ${OpenCV_LIB_COMPONENTS}) |
||||||
|
get_target_property(libpath ${CVLib} LOCATION_${CMAKE_BUILD_TYPE}) |
||||||
|
get_filename_component(libname "${libpath}" NAME) |
||||||
|
|
||||||
|
if(INSTALL_TO_MANGLED_PATHS) |
||||||
|
set(libname "${libname}.${OPENCV_VERSION}") |
||||||
|
endif() |
||||||
|
|
||||||
|
#need better solution.... |
||||||
|
if(libpath MATCHES "3rdparty") |
||||||
|
set(installDir "share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}") |
||||||
|
else() |
||||||
|
set(installDir "${OPENCV_LIB_INSTALL_PATH}") |
||||||
|
endif() |
||||||
|
|
||||||
|
set(OpenCV_LIB_COMPONENTS_ "${OpenCV_LIB_COMPONENTS_} \${exec_prefix}/${installDir}/${libname}") |
||||||
|
endforeach() |
||||||
|
|
||||||
|
# add extra dependencies required for OpenCV |
||||||
|
set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) |
||||||
|
if(OpenCV_EXTRA_COMPONENTS) |
||||||
|
string(REPLACE ";" " " OpenCV_EXTRA_COMPONENTS "${OpenCV_EXTRA_COMPONENTS}") |
||||||
|
set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} ${OpenCV_EXTRA_COMPONENTS}") |
||||||
|
endif() |
||||||
|
|
||||||
|
#generate the .pc file |
||||||
|
if(INSTALL_TO_MANGLED_PATHS) |
||||||
|
set(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc") |
||||||
|
else() |
||||||
|
set(OPENCV_PC_FILE_NAME opencv.pc) |
||||||
|
endif() |
||||||
|
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv-XXX.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}" @ONLY IMMEDIATE) |
||||||
|
|
||||||
|
if(UNIX AND NOT ANDROID) |
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME} DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig) |
||||||
|
endif() |
@ -1,278 +1,682 @@ |
|||||||
set(opencv_public_modules "" CACHE INTERNAL "List of OpenCV modules included into the build") |
# Local variables (set for each module): |
||||||
# helper macro for modules management |
# |
||||||
macro(opencv_module_register name) |
# name - short name in lower case i.e. core |
||||||
set(opencv_public_modules ${opencv_public_modules} ${name} CACHE INTERNAL "List of OpenCV modules included into the build") |
# the_module - full name in lower case i.e. opencv_core |
||||||
endmacro() |
|
||||||
|
# Global variables: |
||||||
# Setup include path for OpenCV headers for specified modules |
# |
||||||
macro(opencv_module_includes) |
# OPENCV_MODULE_${the_module}_LOCATION |
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" |
# OPENCV_MODULE_${the_module}_DESCRIPTION |
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src" |
# OPENCV_MODULE_${the_module}_HEADERS |
||||||
"${CMAKE_CURRENT_BINARY_DIR}") |
# OPENCV_MODULE_${the_module}_SOURCES |
||||||
foreach(d ${ARGN}) |
# OPENCV_MODULE_${the_module}_DEPS - final flattened set of module dependencies |
||||||
if(d MATCHES "opencv_") |
# OPENCV_MODULE_${the_module}_DEPS_EXT |
||||||
string(REPLACE "opencv_" "${OpenCV_SOURCE_DIR}/modules/" d_dir ${d}) |
# OPENCV_MODULE_${the_module}_REQ_DEPS |
||||||
if (EXISTS "${d_dir}/include") |
# OPENCV_MODULE_${the_module}_OPT_DEPS |
||||||
include_directories("${d_dir}/include") |
# HAVE_${the_module} - for fast check of module availability |
||||||
endif() |
|
||||||
endif() |
# To control the setup of the module you could also set: |
||||||
endforeach() |
# the_description - text to be used as current module description |
||||||
|
# OPENCV_MODULE_TYPE - STATIC|SHARED - set to force override global settings for current module |
||||||
|
|
||||||
|
# The verbose template for OpenCV module: |
||||||
|
# |
||||||
|
# ocv_add_module(modname <dependencies>) |
||||||
|
# ocv_glob_module_sources() or glob them manually and ocv_set_module_sources(...) |
||||||
|
# ocv_module_include_directories(<extra include directories>) |
||||||
|
# ocv_create_module() |
||||||
|
# <add extra link dependencies, compiler options, etc> |
||||||
|
# ocv_add_precompiled_headers(${the_module}) |
||||||
|
# <add extra installation rules> |
||||||
|
# ocv_add_accuracy_tests(<extra dependencies>) |
||||||
|
# ocv_add_perf_tests(<extra dependencies>) |
||||||
|
# |
||||||
|
# |
||||||
|
# If module have no "extra" then you can define it in one line: |
||||||
|
# |
||||||
|
# ocv_define_module(modname <dependencies>) |
||||||
|
|
||||||
|
# clean flags for modules enabled on previous cmake run |
||||||
|
# this is necessary to correctly handle modules removal |
||||||
|
foreach(mod ${OPENCV_MODULES_BUILD}) |
||||||
|
if(HAVE_${mod}) |
||||||
|
unset(HAVE_${mod} CACHE) |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
|
||||||
|
# clean modules info which needs to be recalculated |
||||||
|
set(OPENCV_MODULES_PUBLIC "" CACHE INTERNAL "List of OpenCV modules marked for export") |
||||||
|
set(OPENCV_MODULES_BUILD "" CACHE INTERNAL "List of OpenCV modules included into the build") |
||||||
|
set(OPENCV_MODULES_DISABLED_USER "" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user") |
||||||
|
set(OPENCV_MODULES_DISABLED_AUTO "" CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies") |
||||||
|
set(OPENCV_MODULES_DISABLED_FORCE "" CACHE INTERNAL "List of OpenCV modules which can not be build in current configuration") |
||||||
|
|
||||||
|
# adds dependencies to OpenCV module |
||||||
|
# Usage: |
||||||
|
# add_dependencies(opencv_<name> [REQUIRED] [<list of dependencies>] [OPTIONAL <list of modules>]) |
||||||
|
# Notes: |
||||||
|
# * <list of dependencies> - can include full names of modules or full pathes to shared/static libraries or cmake targets |
||||||
|
macro(ocv_add_dependencies full_modname) |
||||||
|
#we don't clean the dependencies here to allow this macro several times for every module |
||||||
|
foreach(d "REQIRED" ${ARGN}) |
||||||
|
if(d STREQUAL "REQIRED") |
||||||
|
set(__depsvar OPENCV_MODULE_${full_modname}_REQ_DEPS) |
||||||
|
elseif(d STREQUAL "OPTIONAL") |
||||||
|
set(__depsvar OPENCV_MODULE_${full_modname}_OPT_DEPS) |
||||||
|
else() |
||||||
|
list(APPEND ${__depsvar} "${d}") |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
|
||||||
|
if(OPENCV_MODULE_${full_modname}_REQ_DEPS) |
||||||
|
list(REMOVE_DUPLICATES OPENCV_MODULE_${full_modname}_REQ_DEPS) |
||||||
|
endif() |
||||||
|
if(OPENCV_MODULE_${full_modname}_OPT_DEPS) |
||||||
|
list(REMOVE_DUPLICATES OPENCV_MODULE_${full_modname}_OPT_DEPS) |
||||||
|
endif() |
||||||
|
set(OPENCV_MODULE_${full_modname}_REQ_DEPS ${OPENCV_MODULE_${full_modname}_REQ_DEPS} CACHE INTERNAL "Required dependencies of ${full_modname} module") |
||||||
|
set(OPENCV_MODULE_${full_modname}_OPT_DEPS ${OPENCV_MODULE_${full_modname}_OPT_DEPS} CACHE INTERNAL "Optional dependencies of ${full_modname} module") |
||||||
|
|
||||||
|
unset(__depsvar) |
||||||
endmacro() |
endmacro() |
||||||
|
|
||||||
# opencv precompiled headers macro (can add pch to modules and tests) |
# declare new OpenCV module in current folder |
||||||
# this macro must be called after any "add_definitions" commands, otherwise precompiled headers will not work |
# Usage: |
||||||
macro(add_opencv_precompiled_headers the_target) |
# ocv_add_module(<name> [INTERNAL|BINDINGS] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>]) |
||||||
if("${the_target}" MATCHES "opencv_test_.*") |
# Example: |
||||||
SET(pch_name "test/test_precomp") |
# ocv_add_module(yaom INTERNAL opencv_core opencv_highgui NOLINK opencv_flann OPTIONAL opencv_gpu) |
||||||
elseif("${the_target}" MATCHES "opencv_perf_.*") |
macro(ocv_add_module _name) |
||||||
SET(pch_name "perf/perf_precomp") |
string(TOLOWER "${_name}" name) |
||||||
|
string(REGEX REPLACE "^opencv_" "" ${name} "${name}") |
||||||
|
set(the_module opencv_${name}) |
||||||
|
|
||||||
|
# the first pass - collect modules info, the second pass - create targets |
||||||
|
if(OPENCV_INITIAL_PASS) |
||||||
|
#remember module details |
||||||
|
if(NOT DEFINED the_description) |
||||||
|
set(the_description "The ${name} OpenCV module") |
||||||
|
endif() |
||||||
|
set(OPENCV_MODULE_${the_module}_DESCRIPTION "${the_description}" CACHE INTERNAL "Brief description of ${the_module} module") |
||||||
|
set(OPENCV_MODULE_${the_module}_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Location of ${the_module} module sources") |
||||||
|
|
||||||
|
#create option to enable/disable this module |
||||||
|
option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ON) |
||||||
|
if(NOT BUILD_${the_module}) |
||||||
|
set(OPENCV_MODULES_DISABLED_USER ${OPENCV_MODULES_DISABLED_USER} "${the_module}" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user") |
||||||
else() |
else() |
||||||
SET(pch_name "src/precomp") |
#register new module |
||||||
|
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS") |
||||||
|
set(__ocv_argn__ ${ARGN}) |
||||||
|
list(REMOVE_AT __ocv_argn__ 0) |
||||||
|
ocv_add_dependencies(${the_module} ${__ocv_argn__}) |
||||||
|
unset(__ocv_argn__) |
||||||
|
else() |
||||||
|
ocv_add_dependencies(${the_module} ${ARGN}) |
||||||
|
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} "${the_module}" CACHE INTERNAL "List of OpenCV modules marked for export") |
||||||
|
endif() |
||||||
|
set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD} "${the_module}" CACHE INTERNAL "List of OpenCV modules included into the build") |
||||||
endif() |
endif() |
||||||
set(pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${pch_name}.hpp") |
|
||||||
if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}") |
#TODO: add submodules if any |
||||||
if(CMAKE_GENERATOR MATCHES Visual) |
|
||||||
set(${the_target}_pch "${CMAKE_CURRENT_SOURCE_DIR}/${pch_name}.cpp") |
#stop processing of current file |
||||||
add_native_precompiled_header(${the_target} ${pch_header}) |
return() |
||||||
elseif(CMAKE_GENERATOR MATCHES Xcode) |
else(OPENCV_INITIAL_PASS) |
||||||
add_native_precompiled_header(${the_target} ${pch_header}) |
if(NOT BUILD_${the_module}) |
||||||
elseif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES Makefiles) |
#extra protection from redefinition |
||||||
add_precompiled_header(${the_target} ${pch_header}) |
return() |
||||||
endif() |
|
||||||
endif() |
endif() |
||||||
|
project(${the_module}) |
||||||
|
endif(OPENCV_INITIAL_PASS) |
||||||
endmacro() |
endmacro() |
||||||
|
|
||||||
# this is a template for a OpenCV performance tests |
# Internal macro; disables OpenCV module |
||||||
# define_opencv_perf_test(<module_name> <extra_dependencies>) |
# ocv_module_turn_off(<module name>) |
||||||
macro(define_opencv_perf_test name) |
macro(__ocv_module_turn_off the_module) |
||||||
set(perf_path "${CMAKE_CURRENT_SOURCE_DIR}/perf") |
list(APPEND OPENCV_MODULES_DISABLED_AUTO "${the_module}") |
||||||
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}") |
list(REMOVE_ITEM OPENCV_MODULES_BUILD "${the_module}") |
||||||
|
list(REMOVE_ITEM OPENCV_MODULES_PUBLIC "${the_module}") |
||||||
# opencv_highgui is required for imread/imwrite |
set(HAVE_${the_module} OFF CACHE INTERNAL "Module ${the_module} can not be built in current configuration") |
||||||
set(perf_deps opencv_${name} ${ARGN} opencv_ts opencv_highgui ${EXTRA_OPENCV_${name}_DEPS}) |
endmacro() |
||||||
|
|
||||||
include_directories("${perf_path}") |
|
||||||
opencv_module_includes(${perf_deps}) |
|
||||||
|
|
||||||
file(GLOB perf_srcs "${perf_path}/*.cpp") |
|
||||||
file(GLOB perf_hdrs "${perf_path}/*.h*") |
|
||||||
|
|
||||||
source_group("Src" FILES ${perf_srcs}) |
|
||||||
source_group("Include" FILES ${perf_hdrs}) |
|
||||||
|
|
||||||
set(the_target "opencv_perf_${name}") |
macro(ocv_module_disable module) |
||||||
add_executable(${the_target} ${perf_srcs} ${perf_hdrs}) |
set(__modname ${module}) |
||||||
|
if(NOT __modname MATCHES "^opencv_") |
||||||
|
set(__modname opencv_${module}) |
||||||
|
endif() |
||||||
|
list(APPEND OPENCV_MODULES_DISABLED_FORCE "${__modname}") |
||||||
|
set(HAVE_${__modname} OFF CACHE INTERNAL "Module ${__modname} can not be built in current configuration") |
||||||
|
set(OPENCV_MODULES_DISABLED_FORCE "${OPENCV_MODULES_DISABLED_FORCE}" CACHE INTERNAL "List of OpenCV modules which can not be build in current configuration") |
||||||
|
unset(__modname) |
||||||
|
return()#leave the current folder |
||||||
|
endmacro() |
||||||
|
|
||||||
# Additional target properties |
|
||||||
set_target_properties(${the_target} PROPERTIES |
|
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}" |
|
||||||
) |
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS) |
macro(__ocv_flatten_module_required_dependencies the_module) |
||||||
set_target_properties(${the_target} PROPERTIES FOLDER "performance tests") |
set(__flattened_deps "") |
||||||
endif() |
set(__resolved_deps "") |
||||||
|
set(__req_depends ${OPENCV_MODULE_${the_module}_REQ_DEPS}) |
||||||
|
|
||||||
|
while(__req_depends) |
||||||
|
list(GET __req_depends 0 __dep) |
||||||
|
list(REMOVE_AT __req_depends 0) |
||||||
|
if(__dep STREQUAL the_module) |
||||||
|
#TODO: think how to deal with cyclic dependency |
||||||
|
__ocv_module_turn_off(${the_module}) |
||||||
|
break() |
||||||
|
elseif("${OPENCV_MODULES_DISABLED_USER};${OPENCV_MODULES_DISABLED_AUTO}" MATCHES "(^|;)${__dep}(;|$)") |
||||||
|
#depends on disabled module |
||||||
|
__ocv_module_turn_off(${the_module}) |
||||||
|
break() |
||||||
|
elseif("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)") |
||||||
|
if(__resolved_deps MATCHES "(^|;)${__dep}(;|$)") |
||||||
|
#all dependencies of this module are already resolved |
||||||
|
list(APPEND __flattened_deps "${__dep}") |
||||||
|
else() |
||||||
|
#put all required subdependencies before this dependency and mark it as resolved |
||||||
|
list(APPEND __resolved_deps "${__dep}") |
||||||
|
list(INSERT __req_depends 0 ${OPENCV_MODULE_${__dep}_REQ_DEPS} ${__dep}) |
||||||
|
endif() |
||||||
|
elseif(__dep MATCHES "^opencv_") |
||||||
|
#depends on missing module |
||||||
|
__ocv_module_turn_off(${the_module}) |
||||||
|
break() |
||||||
|
else() |
||||||
|
#skip non-modules |
||||||
|
endif() |
||||||
|
endwhile() |
||||||
|
|
||||||
|
if(__flattened_deps) |
||||||
|
list(REMOVE_DUPLICATES __flattened_deps) |
||||||
|
set(OPENCV_MODULE_${the_module}_DEPS ${__flattened_deps}) |
||||||
|
else() |
||||||
|
set(OPENCV_MODULE_${the_module}_DEPS "") |
||||||
|
endif() |
||||||
|
|
||||||
|
unset(__resolved_deps) |
||||||
|
unset(__flattened_deps) |
||||||
|
unset(__req_depends) |
||||||
|
unset(__dep) |
||||||
|
endmacro() |
||||||
|
|
||||||
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${perf_deps}) |
macro(__ocv_flatten_module_optional_dependencies the_module) |
||||||
|
set(__flattened_deps ${OPENCV_MODULE_${the_module}_DEPS}) |
||||||
|
set(__resolved_deps ${OPENCV_MODULE_${the_module}_DEPS}) |
||||||
|
set(__opt_depends ${OPENCV_MODULE_${the_module}_OPT_DEPS}) |
||||||
|
|
||||||
|
while(__opt_depends) |
||||||
|
list(GET __opt_depends 0 __dep) |
||||||
|
list(REMOVE_AT __opt_depends 0) |
||||||
|
if(__dep STREQUAL the_module) |
||||||
|
#TODO: think how to deal with cyclic dependency |
||||||
|
__ocv_module_turn_off(${the_module}) |
||||||
|
break() |
||||||
|
elseif("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)") |
||||||
|
if(__resolved_deps MATCHES "(^|;)${__dep}(;|$)") |
||||||
|
#all dependencies of this module are already resolved |
||||||
|
list(APPEND __flattened_deps "${__dep}") |
||||||
|
else() |
||||||
|
#put all subdependencies before this dependency and mark it as resolved |
||||||
|
list(APPEND __resolved_deps "${__dep}") |
||||||
|
list(INSERT __opt_depends 0 ${OPENCV_MODULE_${__dep}_REQ_DEPS} ${OPENCV_MODULE_${__dep}_OPT_DEPS} ${__dep}) |
||||||
|
endif() |
||||||
|
else() |
||||||
|
#skip non-modules or missing modules |
||||||
|
endif() |
||||||
|
endwhile() |
||||||
|
if(__flattened_deps) |
||||||
|
list(REMOVE_DUPLICATES __flattened_deps) |
||||||
|
set(OPENCV_MODULE_${the_module}_DEPS ${__flattened_deps}) |
||||||
|
else() |
||||||
|
set(OPENCV_MODULE_${the_module}_DEPS "") |
||||||
|
endif() |
||||||
|
|
||||||
|
unset(__resolved_deps) |
||||||
|
unset(__flattened_deps) |
||||||
|
unset(__opt_depends) |
||||||
|
unset(__dep) |
||||||
|
endmacro() |
||||||
|
|
||||||
add_opencv_precompiled_headers(${the_target}) |
macro(__ocv_flatten_module_dependencies) |
||||||
|
foreach(m ${OPENCV_MODULES_DISABLED_USER}) |
||||||
|
set(HAVE_${m} OFF CACHE INTERNAL "Module ${m} will not be built in current configuration") |
||||||
|
endforeach() |
||||||
|
foreach(m ${OPENCV_MODULES_BUILD}) |
||||||
|
set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will not be built in current configuration") |
||||||
|
__ocv_flatten_module_required_dependencies(${m}) |
||||||
|
endforeach() |
||||||
|
|
||||||
|
foreach(m ${OPENCV_MODULES_BUILD}) |
||||||
|
__ocv_flatten_module_optional_dependencies(${m}) |
||||||
|
|
||||||
|
#dependencies from other modules |
||||||
|
set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module") |
||||||
|
#extra dependencies |
||||||
|
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_REQ_DEPS} ${OPENCV_MODULE_${m}_OPT_DEPS}) |
||||||
|
if(OPENCV_MODULE_${m}_DEPS_EXT AND OPENCV_MODULE_${m}_DEPS) |
||||||
|
list(REMOVE_ITEM OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS}) |
||||||
|
endif() |
||||||
|
ocv_list_filterout(OPENCV_MODULE_${m}_DEPS_EXT "^opencv_[^ ]+$") |
||||||
|
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS_EXT} CACHE INTERNAL "Extra dependencies of ${m} module") |
||||||
|
endforeach() |
||||||
|
|
||||||
|
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} CACHE INTERNAL "List of OpenCV modules marked for export") |
||||||
|
set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD} CACHE INTERNAL "List of OpenCV modules included into the build") |
||||||
|
set(OPENCV_MODULES_DISABLED_AUTO ${OPENCV_MODULES_DISABLED_AUTO} CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies") |
||||||
|
endmacro() |
||||||
|
|
||||||
if (PYTHON_EXECUTABLE) |
# collect modules from specified directories |
||||||
add_dependencies(perf ${the_target}) |
# NB: must be called only once! |
||||||
|
macro(ocv_glob_modules) |
||||||
|
#collect modules |
||||||
|
set(OPENCV_INITIAL_PASS ON) |
||||||
|
foreach(__path ${ARGN}) |
||||||
|
file(GLOB __ocvmodules RELATIVE "${__path}" "${__path}/*") |
||||||
|
if(__ocvmodules) |
||||||
|
list(SORT __ocvmodules) |
||||||
|
foreach(mod ${__ocvmodules}) |
||||||
|
if(EXISTS "${__path}/${mod}/CMakeLists.txt") |
||||||
|
add_subdirectory("${__path}/${mod}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}") |
||||||
endif() |
endif() |
||||||
|
endforeach() |
||||||
endif() |
endif() |
||||||
|
endforeach() |
||||||
|
unset(__ocvmodules) |
||||||
|
|
||||||
|
#resolve dependencies |
||||||
|
__ocv_flatten_module_dependencies() |
||||||
|
|
||||||
|
#create modules |
||||||
|
set(OPENCV_INITIAL_PASS OFF) |
||||||
|
foreach(m ${OPENCV_MODULES_BUILD}) |
||||||
|
string(REGEX REPLACE "^opencv_" "" __shortname "${m}") |
||||||
|
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${__shortname}") |
||||||
|
endforeach() |
||||||
|
unset(__shortname) |
||||||
endmacro() |
endmacro() |
||||||
|
|
||||||
# this is a template for a OpenCV regression tests |
# setup include paths for the list of passed modules |
||||||
# define_opencv_test(<module_name> <extra_dependencies>) |
macro(ocv_include_modules) |
||||||
macro(define_opencv_test name) |
foreach(d ${ARGN}) |
||||||
set(test_path "${CMAKE_CURRENT_SOURCE_DIR}/test") |
if(d MATCHES "^opencv_" AND HAVE_${d}) |
||||||
if(BUILD_TESTS AND EXISTS "${test_path}") |
if (EXISTS "${OPENCV_MODULE_${d}_LOCATION}/include") |
||||||
|
include_directories("${OPENCV_MODULE_${d}_LOCATION}/include") |
||||||
# opencv_highgui is required for imread/imwrite |
endif() |
||||||
set(test_deps opencv_${name} ${ARGN} opencv_ts opencv_highgui ${EXTRA_OPENCV_${name}_DEPS}) |
elseif(EXISTS "${d}") |
||||||
|
include_directories("${d}") |
||||||
include_directories("${test_path}") |
endif() |
||||||
opencv_module_includes(${test_deps}) |
endforeach() |
||||||
|
endmacro() |
||||||
file(GLOB test_srcs "${test_path}/*.cpp") |
|
||||||
file(GLOB test_hdrs "${test_path}/*.h*") |
|
||||||
|
|
||||||
source_group("Src" FILES ${test_srcs}) |
# setup include path for OpenCV headers for specified module |
||||||
source_group("Include" FILES ${test_hdrs}) |
# ocv_module_include_directories(<extra include directories/extra include modules>) |
||||||
|
macro(ocv_module_include_directories) |
||||||
|
include_directories("${OPENCV_MODULE_${the_module}_LOCATION}/include" |
||||||
|
"${OPENCV_MODULE_${the_module}_LOCATION}/src" |
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}"#for precompiled headers |
||||||
|
) |
||||||
|
ocv_include_modules(${OPENCV_MODULE_${the_module}_DEPS} ${ARGN}) |
||||||
|
endmacro() |
||||||
|
|
||||||
set(the_target "opencv_test_${name}") |
|
||||||
add_executable(${the_target} ${test_srcs} ${test_hdrs}) |
|
||||||
|
|
||||||
# Additional target properties |
# sets header and source files for the current module |
||||||
set_target_properties(${the_target} PROPERTIES |
# NB: all files specified as headers will be installed |
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
# Usage: |
||||||
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}" |
# ocv_set_module_sources([HEADERS] <list of files> [SOURCES] <list of files>) |
||||||
) |
macro(ocv_set_module_sources) |
||||||
|
set(OPENCV_MODULE_${the_module}_HEADERS "") |
||||||
|
set(OPENCV_MODULE_${the_module}_SOURCES "") |
||||||
|
|
||||||
|
foreach(f "HEADERS" ${ARGN}) |
||||||
|
if(f STREQUAL "HEADERS" OR f STREQUAL "SOURCES") |
||||||
|
set(__filesvar "OPENCV_MODULE_${the_module}_${f}") |
||||||
|
else() |
||||||
|
list(APPEND ${__filesvar} "${f}") |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
|
||||||
|
# the hacky way to embeed any files into the OpenCV without modification of its build system |
||||||
|
if(COMMAND ocv_get_module_external_sources) |
||||||
|
ocv_get_module_external_sources() |
||||||
|
endif() |
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS) |
set(OPENCV_MODULE_${the_module}_HEADERS ${OPENCV_MODULE_${the_module}_HEADERS} CACHE INTERNAL "List of header files for ${the_module}") |
||||||
set_target_properties(${the_target} PROPERTIES FOLDER "tests") |
set(OPENCV_MODULE_${the_module}_SOURCES ${OPENCV_MODULE_${the_module}_SOURCES} CACHE INTERNAL "List of source files for ${the_module}") |
||||||
endif() |
endmacro() |
||||||
|
|
||||||
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${test_deps}) |
# finds and sets headers and sources for the standard OpenCV module |
||||||
|
# Usage: |
||||||
|
# ocv_glob_module_sources(<extra sources&headers in the same format as used in ocv_set_module_sources>) |
||||||
|
macro(ocv_glob_module_sources) |
||||||
|
file(GLOB lib_srcs "src/*.cpp") |
||||||
|
file(GLOB lib_int_hdrs "src/*.hpp" "src/*.h") |
||||||
|
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h") |
||||||
|
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h") |
||||||
|
|
||||||
enable_testing() |
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs}) |
||||||
get_target_property(LOC ${the_target} LOCATION) |
source_group("Include" FILES ${lib_hdrs}) |
||||||
add_test(${the_target} "${LOC}") |
source_group("Include\\detail" FILES ${lib_hdrs_detail}) |
||||||
|
|
||||||
#if(WIN32) |
ocv_set_module_sources(${ARGN} HEADERS ${lib_hdrs} ${lib_hdrs_detail} SOURCES ${lib_srcs} ${lib_int_hdrs}) |
||||||
# install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) |
|
||||||
#endif() |
|
||||||
add_opencv_precompiled_headers(${the_target}) |
|
||||||
endif() |
|
||||||
endmacro() |
endmacro() |
||||||
|
|
||||||
# Set standard properties, install rules and precompiled headers for OpenCV module |
# creates OpenCV module in current folder |
||||||
macro(opencv_module_setup name) |
# creates new target, configures standard dependencies, compilers flags, install rules |
||||||
set(the_target "opencv_${name}") |
# Usage: |
||||||
|
# ocv_create_module(<extra link dependencies>) |
||||||
# For dynamic link numbering convenions |
macro(ocv_create_module) |
||||||
if(NOT ANDROID) |
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES}) |
||||||
# Android SDK build scripts can include only .so files into final .apk |
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) |
||||||
# As result we should not set version properties for Android |
|
||||||
set_target_properties(${the_target} PROPERTIES |
if(ENABLE_SOLUTION_FOLDERS) |
||||||
VERSION ${OPENCV_VERSION} |
set_target_properties(${the_module} PROPERTIES FOLDER "modules") |
||||||
SOVERSION ${OPENCV_SOVERSION} |
endif() |
||||||
) |
|
||||||
|
set_target_properties(${the_module} PROPERTIES |
||||||
|
OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}" |
||||||
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
||||||
|
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} |
||||||
|
INSTALL_NAME_DIR lib |
||||||
|
) |
||||||
|
|
||||||
|
# For dynamic link numbering convenions |
||||||
|
if(NOT ANDROID) |
||||||
|
# Android SDK build scripts can include only .so files into final .apk |
||||||
|
# As result we should not set version properties for Android |
||||||
|
set_target_properties(${the_module} PROPERTIES |
||||||
|
VERSION ${OPENCV_VERSION} |
||||||
|
SOVERSION ${OPENCV_SOVERSION} |
||||||
|
) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(BUILD_SHARED_LIBS) |
||||||
|
if(MSVC) |
||||||
|
set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS) |
||||||
|
else() |
||||||
|
add_definitions(-DCVAPI_EXPORTS) |
||||||
endif() |
endif() |
||||||
|
endif() |
||||||
|
|
||||||
set_target_properties(${the_target} PROPERTIES OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}" ) |
if(MSVC) |
||||||
|
if(CMAKE_CROSSCOMPILING) |
||||||
if(ENABLE_SOLUTION_FOLDERS) |
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk") |
||||||
set_target_properties(${the_target} PROPERTIES FOLDER "modules") |
|
||||||
endif() |
endif() |
||||||
|
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc /DEBUG") |
||||||
|
endif() |
||||||
|
|
||||||
if (BUILD_SHARED_LIBS) |
install(TARGETS ${the_module} |
||||||
if(MSVC) |
RUNTIME DESTINATION bin COMPONENT main |
||||||
set_target_properties(${the_target} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS) |
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main |
||||||
else() |
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main |
||||||
add_definitions(-DCVAPI_EXPORTS) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
# Additional target properties |
) |
||||||
set_target_properties(${the_target} PROPERTIES |
|
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} |
|
||||||
INSTALL_NAME_DIR lib |
|
||||||
) |
|
||||||
|
|
||||||
if(MSVC) |
# only "public" headers need to be installed |
||||||
if(CMAKE_CROSSCOMPILING) |
if(OPENCV_MODULE_${the_module}_HEADERS AND OPENCV_MODULES_PUBLIC MATCHES "(^|;)${the_module}(;|$)") |
||||||
set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk") |
install(FILES ${OPENCV_MODULE_${the_module}_HEADERS} |
||||||
|
DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name} COMPONENT main) |
||||||
|
endif() |
||||||
|
endmacro() |
||||||
|
|
||||||
|
# opencv precompiled headers macro (can add pch to modules and tests) |
||||||
|
# this macro must be called after any "add_definitions" commands, otherwise precompiled headers will not work |
||||||
|
# Usage: |
||||||
|
# ocv_add_precompiled_headers(${the_module}) |
||||||
|
macro(ocv_add_precompiled_headers the_target) |
||||||
|
if("${the_target}" MATCHES "^opencv_test_.*$") |
||||||
|
SET(pch_path "test/test_") |
||||||
|
elseif("${the_target}" MATCHES "^opencv_perf_.*$") |
||||||
|
SET(pch_path "perf/perf_") |
||||||
|
else() |
||||||
|
SET(pch_path "src/") |
||||||
|
endif() |
||||||
|
set(pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.hpp") |
||||||
|
|
||||||
|
if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}") |
||||||
|
if(CMAKE_GENERATOR MATCHES Visual) |
||||||
|
set(${the_target}_pch "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.cpp") |
||||||
|
add_native_precompiled_header(${the_target} ${pch_header}) |
||||||
|
elseif(CMAKE_GENERATOR MATCHES Xcode) |
||||||
|
add_native_precompiled_header(${the_target} ${pch_header}) |
||||||
|
elseif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES Makefiles) |
||||||
|
add_precompiled_header(${the_target} ${pch_header}) |
||||||
endif() |
endif() |
||||||
set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc /DEBUG") |
|
||||||
endif() |
endif() |
||||||
|
unset(pch_header) |
||||||
|
unset(pch_path) |
||||||
|
unset(${the_target}_pch) |
||||||
|
endmacro() |
||||||
|
|
||||||
install(TARGETS ${the_target} |
# short command for adding simple OpenCV module |
||||||
RUNTIME DESTINATION bin COMPONENT main |
# see ocv_add_module for argument details |
||||||
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main |
# Usage: |
||||||
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main) |
# ocv_define_module(module_name [INTERNAL] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>]) |
||||||
|
macro(ocv_define_module module_name) |
||||||
|
ocv_add_module(${module_name} ${ARGN}) |
||||||
|
ocv_glob_module_sources() |
||||||
|
ocv_module_include_directories() |
||||||
|
ocv_create_module() |
||||||
|
ocv_add_precompiled_headers(${the_module}) |
||||||
|
|
||||||
|
ocv_add_accuracy_tests() |
||||||
|
ocv_add_perf_tests() |
||||||
|
endmacro() |
||||||
|
|
||||||
if(lib_hdrs) |
# ensures that all passed modules are available |
||||||
install(FILES ${lib_hdrs} |
# sets OCV_DEPENDENCIES_FOUND variable to TRUE/FALSE |
||||||
DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name} |
macro(ocv_check_dependencies) |
||||||
COMPONENT main) |
set(OCV_DEPENDENCIES_FOUND TRUE) |
||||||
|
foreach(d ${ARGN}) |
||||||
|
if(d MATCHES "^opencv_[^ ]+$" AND NOT HAVE_${d}) |
||||||
|
set(OCV_DEPENDENCIES_FOUND FALSE) |
||||||
|
break() |
||||||
endif() |
endif() |
||||||
|
endforeach() |
||||||
add_opencv_precompiled_headers(${the_target}) |
|
||||||
endmacro() |
endmacro() |
||||||
|
|
||||||
# this is a template for a OpenCV module declaration |
#auxiliary macro to parse arguments of ocv_add_accuracy_tests and ocv_add_perf_tests commands |
||||||
# define_opencv_moduleEx(<module_name> [public|internal] <dependencies>) |
macro(__ocv_parse_test_sources tests_type) |
||||||
macro(define_opencv_moduleEx _name _visibility) |
set(OPENCV_${tests_type}_${the_module}_SOURCES "") |
||||||
string(TOLOWER "${_name}" name) |
set(OPENCV_${tests_type}_${the_module}_DEPS "") |
||||||
string(TOUPPER "${_name}" mname) |
set(__file_group_name "") |
||||||
string(TOLOWER "${_visibility}" visibility) |
set(__file_group_sources "") |
||||||
|
foreach(arg "DEPENDS_ON" ${ARGN} "FILES") |
||||||
option(OCVMODULE_${mname} "Include ${name} module into the OpenCV build" ON) |
if(arg STREQUAL "FILES") |
||||||
if(OCVMODULE_${mname}) |
set(__currentvar "__file_group_sources") |
||||||
set(the_target "opencv_${name}") |
if(__file_group_name AND __file_group_sources) |
||||||
project(${the_target}) |
source_group("${__file_group_name}" FILES ${__file_group_sources}) |
||||||
|
list(APPEND OPENCV_${tests_type}_${the_module}_SOURCES ${__file_group_sources}) |
||||||
opencv_module_includes(${ARGN}) |
endif() |
||||||
|
set(__file_group_name "") |
||||||
|
set(__file_group_sources "") |
||||||
|
elseif(arg STREQUAL "DEPENDS_ON") |
||||||
|
set(__currentvar "OPENCV_TEST_${the_module}_DEPS") |
||||||
|
elseif("${__currentvar}" STREQUAL "__file_group_sources" AND NOT __file_group_name) |
||||||
|
set(__file_group_name "${arg}") |
||||||
|
else() |
||||||
|
list(APPEND ${__currentvar} "${arg}") |
||||||
|
endif() |
||||||
|
endforeach() |
||||||
|
unset(__file_group_name) |
||||||
|
unset(__file_group_sources) |
||||||
|
unset(__currentvar) |
||||||
|
endmacro() |
||||||
|
|
||||||
file(GLOB lib_srcs "src/*.cpp") |
# this is a command for adding OpenCV performance tests to the module |
||||||
file(GLOB lib_int_hdrs "src/*.h*") |
# ocv_add_perf_tests(<extra_dependencies>) |
||||||
file(GLOB lib_hdrs "include/opencv2/${name}/*.h*") |
macro(ocv_add_perf_tests) |
||||||
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.h*") |
set(perf_path "${CMAKE_CURRENT_SOURCE_DIR}/perf") |
||||||
|
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}") |
||||||
|
__ocv_parse_test_sources(PERF ${ARGN}) |
||||||
|
|
||||||
if(COMMAND get_module_external_sources) |
# opencv_highgui is required for imread/imwrite |
||||||
get_module_external_sources(${name}) |
set(perf_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_PERF_${the_module}_DEPS}) |
||||||
endif() |
ocv_check_dependencies(${perf_deps}) |
||||||
|
|
||||||
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs}) |
if(OCV_DEPENDENCIES_FOUND) |
||||||
source_group("Include" FILES ${lib_hdrs}) |
set(the_target "opencv_perf_${name}") |
||||||
source_group("Include\\detail" FILES ${lib_hdrs_detail}) |
#project(${the_target}) |
||||||
|
|
||||||
|
ocv_module_include_directories(${perf_deps} "${perf_path}") |
||||||
|
|
||||||
list(APPEND lib_hdrs ${lib_hdrs_detail}) |
if(NOT OPENCV_PERF_${the_module}_SOURCES) |
||||||
|
file(GLOB perf_srcs "${perf_path}/*.cpp") |
||||||
|
file(GLOB perf_hdrs "${perf_path}/*.hpp" "${perf_path}/*.h") |
||||||
|
source_group("Src" FILES ${perf_srcs}) |
||||||
|
source_group("Include" FILES ${perf_hdrs}) |
||||||
|
set(OPENCV_PERF_${the_module}_SOURCES ${perf_srcs} ${perf_hdrs}) |
||||||
|
endif() |
||||||
|
|
||||||
if(HAVE_CUDA AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/cuda") |
add_executable(${the_target} ${OPENCV_PERF_${the_module}_SOURCES}) |
||||||
file(GLOB lib_cuda "src/cuda/*.cu") |
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${perf_deps}) |
||||||
source_group("Cuda" FILES "${lib_cuda}") |
|
||||||
|
|
||||||
include_directories(${CUDA_INCLUDE_DIRS}) |
|
||||||
include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/src") |
|
||||||
include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/src/cuda") |
|
||||||
|
|
||||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode arch=compute_10,code=sm_10 |
|
||||||
-gencode arch=compute_11,code=sm_11 |
|
||||||
-gencode arch=compute_12,code=sm_12 |
|
||||||
-gencode arch=compute_13,code=sm_13 |
|
||||||
-gencode arch=compute_20,code=sm_20 |
|
||||||
-gencode arch=compute_20,code=sm_21) |
|
||||||
|
|
||||||
if(UNIX OR APPLE) |
|
||||||
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC) |
|
||||||
endif() |
|
||||||
if(APPLE) |
|
||||||
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only) |
|
||||||
endif() |
|
||||||
|
|
||||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep") |
# Additional target properties |
||||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;") |
set_target_properties(${the_target} PROPERTIES |
||||||
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
||||||
# we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1) |
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}" |
||||||
set(tmp ${CMAKE_CXX_FLAGS_DEBUG}) |
) |
||||||
string(REPLACE "-ggdb3" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) |
|
||||||
CUDA_COMPILE(cuda_objs ${lib_cuda}) |
if(ENABLE_SOLUTION_FOLDERS) |
||||||
set(CMAKE_CXX_DEBUG_FLAGS ${tmp}) |
set_target_properties(${the_target} PROPERTIES FOLDER "tests performance") |
||||||
|
endif() |
||||||
|
|
||||||
|
ocv_add_precompiled_headers(${the_target}) |
||||||
|
|
||||||
|
if (PYTHON_EXECUTABLE) |
||||||
|
add_dependencies(perf ${the_target}) |
||||||
|
endif() |
||||||
|
else(OCV_DEPENDENCIES_FOUND) |
||||||
|
#TODO: warn about unsatisfied dependencies |
||||||
|
endif(OCV_DEPENDENCIES_FOUND) |
||||||
|
endif() |
||||||
|
endmacro() |
||||||
|
|
||||||
else() |
# this is a command for adding OpenCV accuracy/regression tests to the module |
||||||
set(lib_cuda "") |
# ocv_add_accuracy_tests([FILES <source group name> <list of sources>] [DEPENDS_ON] <list of extra dependencies>) |
||||||
set(cuda_objs "") |
macro(ocv_add_accuracy_tests) |
||||||
endif() |
set(test_path "${CMAKE_CURRENT_SOURCE_DIR}/test") |
||||||
|
ocv_check_dependencies(${test_deps}) |
||||||
|
if(BUILD_TESTS AND EXISTS "${test_path}") |
||||||
|
__ocv_parse_test_sources(TEST ${ARGN}) |
||||||
|
|
||||||
|
# opencv_highgui is required for imread/imwrite |
||||||
|
set(test_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_TEST_${the_module}_DEPS}) |
||||||
|
ocv_check_dependencies(${test_deps}) |
||||||
|
|
||||||
|
if(OCV_DEPENDENCIES_FOUND) |
||||||
|
set(the_target "opencv_test_${name}") |
||||||
|
#project(${the_target}) |
||||||
|
|
||||||
|
ocv_module_include_directories(${test_deps} "${test_path}") |
||||||
|
|
||||||
add_library(${the_target} ${OPENCV_${mname}_MODULE_TYPE} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${lib_cuda} ${cuda_objs}) |
if(NOT OPENCV_TEST_${the_module}_SOURCES) |
||||||
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) |
file(GLOB test_srcs "${test_path}/*.cpp") |
||||||
|
file(GLOB test_hdrs "${test_path}/*.hpp" "${test_path}/*.h") |
||||||
|
source_group("Src" FILES ${test_srcs}) |
||||||
|
source_group("Include" FILES ${test_hdrs}) |
||||||
|
set(OPENCV_TEST_${the_module}_SOURCES ${test_srcs} ${test_hdrs}) |
||||||
|
endif() |
||||||
|
|
||||||
|
add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES}) |
||||||
|
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${test_deps}) |
||||||
|
|
||||||
if(HAVE_CUDA AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/cuda") |
# Additional target properties |
||||||
target_link_libraries(${the_target} ${CUDA_LIBRARIES}) |
set_target_properties(${the_target} PROPERTIES |
||||||
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}" |
||||||
|
) |
||||||
|
|
||||||
|
if(ENABLE_SOLUTION_FOLDERS) |
||||||
|
set_target_properties(${the_target} PROPERTIES FOLDER "tests accuracy") |
||||||
|
endif() |
||||||
|
|
||||||
|
enable_testing() |
||||||
|
get_target_property(LOC ${the_target} LOCATION) |
||||||
|
add_test(${the_target} "${LOC}") |
||||||
|
|
||||||
|
ocv_add_precompiled_headers(${the_target}) |
||||||
|
else(OCV_DEPENDENCIES_FOUND) |
||||||
|
#TODO: warn about unsatisfied dependencies |
||||||
|
endif(OCV_DEPENDENCIES_FOUND) |
||||||
|
endif() |
||||||
|
endmacro() |
||||||
|
|
||||||
unset(CUDA_npp_LIBRARY CACHE) |
# internal macro; finds all link dependencies of module |
||||||
find_cuda_helper_libs(npp) |
# should be used at the end of CMake processing |
||||||
target_link_libraries(${the_target} ${CUDA_npp_LIBRARY}) |
macro(__ocv_track_module_link_dependencies the_module optkind) |
||||||
endif() |
set(${the_module}_MODULE_DEPS_${optkind} "") |
||||||
|
set(${the_module}_EXTRA_DEPS_${optkind} "") |
||||||
|
|
||||||
|
get_target_property(__module_type ${the_module} TYPE) |
||||||
|
if(__module_type STREQUAL "STATIC_LIBRARY") |
||||||
|
#in case of static library we have to inherit its dependencies (in right order!!!) |
||||||
|
if(NOT DEFINED ${the_module}_LIB_DEPENDS_${optkind}) |
||||||
|
ocv_split_libs_list(${the_module}_LIB_DEPENDS ${the_module}_LIB_DEPENDS_DBG ${the_module}_LIB_DEPENDS_OPT) |
||||||
|
endif() |
||||||
|
|
||||||
if(visibility STREQUAL "public") |
set(__resolved_deps "") |
||||||
opencv_module_register(${the_target}) |
set(__mod_depends ${${the_module}_LIB_DEPENDS_${optkind}}) |
||||||
|
set(__has_cycle FALSE) |
||||||
|
|
||||||
|
while(__mod_depends) |
||||||
|
list(GET __mod_depends 0 __dep) |
||||||
|
list(REMOVE_AT __mod_depends 0) |
||||||
|
if(__dep STREQUAL the_module) |
||||||
|
set(__has_cycle TRUE) |
||||||
|
else()#if("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)") |
||||||
|
ocv_regex_escape(__rdep "${__dep}") |
||||||
|
if(__resolved_deps MATCHES "(^|;)${__rdep}(;|$)") |
||||||
|
#all dependencies of this module are already resolved |
||||||
|
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${__dep}") |
||||||
|
else() |
||||||
|
get_target_property(__module_type ${__dep} TYPE) |
||||||
|
if(__module_type STREQUAL "STATIC_LIBRARY") |
||||||
|
if(NOT DEFINED ${__dep}_LIB_DEPENDS_${optkind}) |
||||||
|
ocv_split_libs_list(${__dep}_LIB_DEPENDS ${__dep}_LIB_DEPENDS_DBG ${__dep}_LIB_DEPENDS_OPT) |
||||||
|
endif() |
||||||
|
list(INSERT __mod_depends 0 ${${__dep}_LIB_DEPENDS_${optkind}} ${__dep}) |
||||||
|
list(APPEND __resolved_deps "${__dep}") |
||||||
|
elseif(NOT __module_type) |
||||||
|
list(APPEND ${the_module}_EXTRA_DEPS_${optkind} "${__dep}") |
||||||
|
endif() |
||||||
endif() |
endif() |
||||||
|
#else() |
||||||
opencv_module_setup(${name}) |
# get_target_property(__dep_location "${__dep}" LOCATION) |
||||||
define_opencv_test(${name}) |
endif() |
||||||
define_opencv_perf_test(${name}) |
endwhile() |
||||||
|
|
||||||
|
ocv_list_unique(${the_module}_MODULE_DEPS_${optkind}) |
||||||
|
#ocv_list_reverse(${the_module}_MODULE_DEPS_${optkind}) |
||||||
|
ocv_list_unique(${the_module}_EXTRA_DEPS_${optkind}) |
||||||
|
#ocv_list_reverse(${the_module}_EXTRA_DEPS_${optkind}) |
||||||
|
|
||||||
|
if(__has_cycle) |
||||||
|
#not sure if it can work |
||||||
|
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${the_module}") |
||||||
endif() |
endif() |
||||||
endmacro() |
|
||||||
|
|
||||||
# this is a shorthand for a public OpenCV module declaration |
unset(__dep_location) |
||||||
# define_opencv_module(<module_name> <dependencies>) |
unset(__mod_depends) |
||||||
macro(define_opencv_module name) |
unset(__resolved_deps) |
||||||
define_opencv_moduleEx(${name} PUBLIC ${ARGN}) |
unset(__has_cycle) |
||||||
|
unset(__rdep) |
||||||
|
endif()#STATIC_LIBRARY |
||||||
|
unset(__module_type) |
||||||
|
|
||||||
|
#message("${the_module}_MODULE_DEPS_${optkind}") |
||||||
|
#message(" ${${the_module}_MODULE_DEPS_${optkind}}") |
||||||
|
#message(" ${OPENCV_MODULE_${the_module}_DEPS}") |
||||||
|
#message("") |
||||||
|
#message("${the_module}_EXTRA_DEPS_${optkind}") |
||||||
|
#message(" ${${the_module}_EXTRA_DEPS_${optkind}}") |
||||||
|
#message("") |
||||||
endmacro() |
endmacro() |
||||||
|
|
||||||
|
# creates lists of build dependencies needed for external projects |
||||||
|
macro(ocv_track_build_dependencies) |
||||||
|
foreach(m ${OPENCV_MODULES_BUILD}) |
||||||
|
__ocv_track_module_link_dependencies("${m}" OPT) |
||||||
|
__ocv_track_module_link_dependencies("${m}" DBG) |
||||||
|
endforeach() |
||||||
|
endmacro() |
||||||
|
@ -0,0 +1,28 @@ |
|||||||
|
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]+" ) |
||||||
|
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}") |
||||||
|
|
||||||
|
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}") |
||||||
|
|
||||||
|
# create a dependency on version file |
||||||
|
# we never use output of the following command but cmake will rerun automatically if the version file changes |
||||||
|
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY) |
||||||
|
|
||||||
|
if(WIN32) |
||||||
|
# Postfix of DLLs: |
||||||
|
set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}") |
||||||
|
set(OPENCV_DEBUG_POSTFIX d) |
||||||
|
else() |
||||||
|
# Postfix of so's: |
||||||
|
set(OPENCV_DLLVERSION "") |
||||||
|
set(OPENCV_DEBUG_POSTFIX) |
||||||
|
endif() |
||||||
|
|
||||||
|
#name mangling |
||||||
|
set(OPENCV_INCLUDE_PREFIX include) |
||||||
|
if(INSTALL_TO_MANGLED_PATHS) |
||||||
|
set(OPENCV_INCLUDE_PREFIX include/opencv-${OPENCV_VERSION}) |
||||||
|
endif() |
@ -1,13 +0,0 @@ |
|||||||
# Package Information for pkg-config |
|
||||||
|
|
||||||
prefix=@prefix@ |
|
||||||
exec_prefix=@exec_prefix@ |
|
||||||
libdir=@libdir@ |
|
||||||
includedir_old=@includedir@/opencv |
|
||||||
includedir_new=@includedir@ |
|
||||||
|
|
||||||
Name: OpenCV |
|
||||||
Description: Open Source Computer Vision Library |
|
||||||
Version: @VERSION@ |
|
||||||
Libs: -L${libdir} -lopencv_core@OPENCV_DLLVERSION@ -lopencv_imgproc@OPENCV_DLLVERSION@ -lopencv_highgui@OPENCV_DLLVERSION@ -lopencv_ml@OPENCV_DLLVERSION@ -lopencv_video@OPENCV_DLLVERSION@ -lopencv_features2d@OPENCV_DLLVERSION@ -lopencv_calib3d@OPENCV_DLLVERSION@ -lopencv_objdetect@OPENCV_DLLVERSION@ -lopencv_contrib@OPENCV_DLLVERSION@ -lopencv_legacy@OPENCV_DLLVERSION@ -lopencv_flann@OPENCV_DLLVERSION@ |
|
||||||
Cflags: -I${includedir_old} -I${includedir_new} |
|
@ -0,0 +1,9 @@ |
|||||||
|
/*
|
||||||
|
* ** File generated automatically, do not modify **
|
||||||
|
* |
||||||
|
* This file defines the list of modules available in current build configuration |
||||||
|
* |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
@OPENCV_MODULE_DEFINITIONS_CONFIGMAKE@ |
@ -1,10 +1,5 @@ |
|||||||
file(GLOB ocvmodules RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*") |
if(NOT OPENCV_MODULES_PATH) |
||||||
if(ocvmodules) |
set(OPENCV_MODULES_PATH "${CMAKE_CURRENT_SOURCE_DIR}") |
||||||
list(SORT ocvmodules) |
|
||||||
endif() |
endif() |
||||||
|
|
||||||
foreach(mod ${ocvmodules}) |
ocv_glob_modules(${OPENCV_MODULES_PATH}) |
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${mod}/CMakeLists.txt") |
|
||||||
add_subdirectory("${mod}") |
|
||||||
endif() |
|
||||||
endforeach() |
|
||||||
|
@ -1 +1,2 @@ |
|||||||
define_opencv_module(calib3d opencv_core opencv_imgproc opencv_features2d opencv_flann) |
set(the_description "Camera Calibration and 3D Reconstruction") |
||||||
|
ocv_define_module(calib3d opencv_imgproc opencv_features2d) |
||||||
|
@ -1 +1 @@ |
|||||||
define_opencv_module(contrib opencv_core opencv_imgproc opencv_calib3d opencv_features2d opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_flann) |
ocv_define_module(contrib opencv_imgproc opencv_calib3d opencv_features2d opencv_highgui opencv_ml opencv_video opencv_objdetect) |
||||||
|
@ -1,2 +1,3 @@ |
|||||||
define_opencv_module(features2d opencv_core opencv_imgproc opencv_highgui opencv_flann) |
set(the_description "2D Features Framework") |
||||||
|
ocv_define_module(features2d opencv_imgproc opencv_highgui opencv_flann) |
||||||
|
|
||||||
|
@ -1,2 +1,3 @@ |
|||||||
define_opencv_module(flann opencv_core) |
set(the_description "Clustering and Search in Multi-Dimensional Spaces") |
||||||
|
ocv_define_module(flann opencv_core) |
||||||
|
|
||||||
|
@ -1,181 +1,101 @@ |
|||||||
if(ANDROID OR IOS) |
if(ANDROID OR IOS) |
||||||
return() |
ocv_module_disable(gpu) |
||||||
endif() |
endif() |
||||||
|
|
||||||
option(OCVMODULE_GPU "Include gpu module into the OpenCV build" ON) |
set(the_description "GPU-accelerated Computer Vision") |
||||||
if(NOT OCVMODULE_GPU) |
ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect) |
||||||
return() |
|
||||||
endif() |
|
||||||
|
|
||||||
set(name "gpu") |
|
||||||
|
|
||||||
set(the_target "opencv_${name}") |
|
||||||
project(${the_target}) |
|
||||||
|
|
||||||
set(DEPS "opencv_core" "opencv_imgproc" "opencv_calib3d" "opencv_objdetect") |
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda") |
||||||
set(DEPS_HEADER ${DEPS} "opencv_features2d" "opencv_flann") |
|
||||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} opencv_gpu) |
|
||||||
|
|
||||||
opencv_module_includes(${DEPS_HEADER}) |
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h") |
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda") |
file(GLOB lib_int_hdrs "src/*.hpp" "src/*.h") |
||||||
|
file(GLOB lib_cuda_hdrs "src/cuda/*.hpp" "src/cuda/*.h") |
||||||
|
file(GLOB lib_device_hdrs "src/opencv2/gpu/device/*.hpp" "src/opencv2/gpu/device/*.h") |
||||||
|
file(GLOB lib_device_hdrs_detail "src/opencv2/gpu/device/detail/*.hpp" "src/opencv2/gpu/device/detail/*.h") |
||||||
|
file(GLOB lib_srcs "src/*.cpp") |
||||||
|
file(GLOB lib_cuda "src/cuda/*.cu*") |
||||||
|
|
||||||
file(GLOB lib_srcs "src/*.cpp") |
source_group("Include" FILES ${lib_hdrs}) |
||||||
file(GLOB lib_int_hdrs "src/*.h*") |
|
||||||
file(GLOB lib_cuda "src/cuda/*.cu*") |
|
||||||
file(GLOB lib_cuda_hdrs "src/cuda/*.h*") |
|
||||||
source_group("Src\\Host" FILES ${lib_srcs} ${lib_int_hdrs}) |
source_group("Src\\Host" FILES ${lib_srcs} ${lib_int_hdrs}) |
||||||
source_group("Src\\Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs}) |
source_group("Src\\Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs}) |
||||||
|
|
||||||
file(GLOB lib_hdrs "include/opencv2/${name}/*.h*") |
|
||||||
source_group("Include" FILES ${lib_hdrs}) |
|
||||||
|
|
||||||
#file(GLOB lib_device_hdrs "include/opencv2/${name}/device/*.h*") |
|
||||||
file(GLOB lib_device_hdrs "src/opencv2/gpu/device/*.h*") |
|
||||||
file(GLOB lib_device_hdrs_detail "src/opencv2/gpu/device/detail/*.h*") |
|
||||||
source_group("Device" FILES ${lib_device_hdrs}) |
source_group("Device" FILES ${lib_device_hdrs}) |
||||||
source_group("Device\\Detail" FILES ${lib_device_hdrs_detail}) |
source_group("Device\\Detail" FILES ${lib_device_hdrs_detail}) |
||||||
|
|
||||||
if (HAVE_CUDA) |
if (HAVE_CUDA) |
||||||
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp") |
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp") |
||||||
file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu") |
file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu") |
||||||
file(GLOB_RECURSE ncv_hdrs "src/nvidia/*.hpp" "src/nvidia/*.h") |
file(GLOB_RECURSE ncv_hdrs "src/nvidia/*.hpp" "src/nvidia/*.h") |
||||||
|
set(ncv_files ${ncv_srcs} ${ncv_hdrs} ${ncv_cuda}) |
||||||
source_group("Src\\NVidia" FILES ${ncv_srcs} ${ncv_hdrs} ${ncv_cuda}) |
|
||||||
include_directories("src/nvidia/core" "src/nvidia/NPP_staging") |
|
||||||
endif() |
|
||||||
|
|
||||||
if (HAVE_CUDA) |
source_group("Src\\NVidia" FILES ${ncv_files}) |
||||||
include_directories(${CUDA_INCLUDE_DIRS}) |
include_directories("src/nvidia/core" "src/nvidia/NPP_staging" ${CUDA_INCLUDE_DIRS}) |
||||||
|
|
||||||
if (UNIX OR APPLE) |
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep") |
||||||
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;") |
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;") |
||||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "-fPIC") |
|
||||||
endif() |
|
||||||
|
|
||||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep") |
|
||||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;") |
|
||||||
|
|
||||||
if (APPLE) |
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG) |
||||||
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fno-finite-math-only;") |
string(REPLACE "/W4" "/W3" ${var} "${${var}}") |
||||||
endif() |
endforeach() |
||||||
|
|
||||||
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |
|
||||||
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") |
|
||||||
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") |
|
||||||
|
|
||||||
if(MSVC) |
|
||||||
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |
|
||||||
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") |
|
||||||
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") |
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408 /wd4251") |
|
||||||
|
|
||||||
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") |
if(MSVC) |
||||||
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408 /wd4251") |
||||||
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") |
|
||||||
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |
|
||||||
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") |
|
||||||
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") |
|
||||||
endif() |
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS) |
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG) |
||||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-DCVAPI_EXPORTS") |
string(REPLACE "/EHsc-" "/EHs" ${var} "${${var}}") |
||||||
endif() |
endforeach() |
||||||
|
|
||||||
if(MSVC) |
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251) |
||||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/wd4251") |
endif() |
||||||
endif() |
|
||||||
|
OCV_CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda}) |
||||||
|
#CUDA_BUILD_CLEAN_TARGET() |
||||||
|
|
||||||
# we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1) |
unset(CUDA_npp_LIBRARY CACHE) |
||||||
set(tmp ${CMAKE_CXX_FLAGS_DEBUG}) |
find_cuda_helper_libs(npp) |
||||||
string(REPLACE "-ggdb3" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) |
set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) |
||||||
CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda}) |
else() |
||||||
set(CMAKE_CXX_DEBUG_FLAGS ${tmp}) |
set(lib_cuda "") |
||||||
|
set(cuda_objs "") |
||||||
#CUDA_BUILD_CLEAN_TARGET() |
set(cuda_link_libs "") |
||||||
endif() |
set(ncv_files "") |
||||||
|
|
||||||
add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${lib_cuda} ${lib_cuda_hdrs} ${lib_device_hdrs} ${lib_device_hdrs_detail} ${ncv_srcs} ${ncv_hdrs} ${ncv_cuda} ${cuda_objs}) |
|
||||||
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${DEPS} ) |
|
||||||
opencv_module_register(${the_target}) |
|
||||||
|
|
||||||
if (HAVE_CUDA) |
|
||||||
target_link_libraries(${the_target} ${CUDA_LIBRARIES}) |
|
||||||
|
|
||||||
unset(CUDA_npp_LIBRARY CACHE) |
|
||||||
find_cuda_helper_libs(npp) |
|
||||||
target_link_libraries(${the_target} ${CUDA_npp_LIBRARY}) |
|
||||||
|
|
||||||
if(HAVE_CUFFT) |
|
||||||
CUDA_ADD_CUFFT_TO_TARGET(${the_target}) |
|
||||||
endif() |
|
||||||
|
|
||||||
if(HAVE_CUBLAS) |
|
||||||
CUDA_ADD_CUBLAS_TO_TARGET(${the_target}) |
|
||||||
endif() |
|
||||||
endif() |
endif() |
||||||
|
|
||||||
opencv_module_setup(${name}) |
ocv_set_module_sources( |
||||||
|
HEADERS ${lib_hdrs} |
||||||
install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp |
SOURCES ${lib_int_hdrs} ${lib_cuda_hdrs} ${lib_device_hdrs} ${lib_device_hdrs_detail} ${lib_srcs} ${lib_cuda} ${ncv_files} ${cuda_objs} |
||||||
|
) |
||||||
|
|
||||||
|
ocv_create_module(${cuda_link_libs}) |
||||||
|
|
||||||
|
if(HAVE_CUDA) |
||||||
|
if(HAVE_CUFFT) |
||||||
|
CUDA_ADD_CUFFT_TO_TARGET(${the_module}) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(HAVE_CUBLAS) |
||||||
|
CUDA_ADD_CUBLAS_TO_TARGET(${the_module}) |
||||||
|
endif() |
||||||
|
|
||||||
|
install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp |
||||||
DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name} |
DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name} |
||||||
COMPONENT main) |
COMPONENT main) |
||||||
|
endif() |
||||||
|
|
||||||
#install(FILES ${lib_device_hdrs} |
ocv_add_precompiled_headers(${the_module}) |
||||||
# DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name}/device |
|
||||||
# COMPONENT main) |
|
||||||
|
|
||||||
|
|
||||||
################################################################################################################ |
################################################################################################################ |
||||||
################################ GPU Module Tests ##################################################### |
################################ GPU Module Tests ##################################################### |
||||||
################################################################################################################ |
################################################################################################################ |
||||||
|
file(GLOB test_srcs "test/*.cpp") |
||||||
# Test files processing is in the separated directory to avoid 'Src' source |
file(GLOB test_hdrs "test/*.hpp" "test/*.h") |
||||||
# filter creation in Visual Studio |
if(HAVE_CUDA) |
||||||
if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test) |
file(GLOB nvidia "test/nvidia/*.cpp" "test/nvidia/*.hpp" "test/nvidia/*.h") |
||||||
set(the_test_target "opencv_test_${name}") |
set(nvidia FILES "Src\\\\\\\\NVidia" ${nvidia}) # 8 ugly backslashes :'( |
||||||
set(test_deps opencv_${name} opencv_ts opencv_highgui opencv_calib3d ${DEPS}) |
else() |
||||||
|
set(nvidia "") |
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/test") |
|
||||||
opencv_module_includes(${test_deps}) |
|
||||||
|
|
||||||
file(GLOB test_srcs "test/*.cpp") |
|
||||||
file(GLOB test_hdrs "test/*.h*") |
|
||||||
|
|
||||||
source_group("Src" FILES ${test_hdrs} ${test_srcs}) |
|
||||||
if(HAVE_CUDA) |
|
||||||
include_directories(${CUDA_INCLUDE_DIRS} ${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia ${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia/core ${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia/NPP_staging) |
|
||||||
|
|
||||||
file(GLOB nvidia "test/nvidia/*.cpp" "test/nvidia/*.h*") |
|
||||||
source_group("Src\\NVidia" FILES ${nvidia}) |
|
||||||
endif() |
|
||||||
|
|
||||||
add_executable(${the_test_target} ${test_srcs} ${test_hdrs} ${nvidia}) |
|
||||||
|
|
||||||
# Additional target properties |
|
||||||
set_target_properties(${the_test_target} PROPERTIES |
|
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}" |
|
||||||
) |
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS) |
|
||||||
set_target_properties(${the_test_target} PROPERTIES FOLDER "tests") |
|
||||||
endif() |
|
||||||
|
|
||||||
# Add the required libraries for linking: |
|
||||||
target_link_libraries(${the_test_target} ${OPENCV_LINKER_LIBS} ${test_deps}) |
|
||||||
|
|
||||||
enable_testing() |
|
||||||
get_target_property(LOC ${the_test_target} LOCATION) |
|
||||||
add_test(${the_test_target} "${LOC}") |
|
||||||
|
|
||||||
#if(WIN32) |
|
||||||
# install(TARGETS ${the_test_target} RUNTIME DESTINATION bin COMPONENT main) |
|
||||||
#endif() |
|
||||||
|
|
||||||
add_opencv_precompiled_headers(${the_test_target}) |
|
||||||
endif() |
endif() |
||||||
|
|
||||||
|
ocv_add_accuracy_tests(FILES "Include" ${test_hdrs} |
||||||
define_opencv_perf_test(${name}) |
FILES "Src" ${test_srcs} |
||||||
|
${nvidia}) |
||||||
|
ocv_add_perf_tests() |
||||||
|
@ -1 +1,2 @@ |
|||||||
define_opencv_module(imgproc opencv_core) |
set(the_description "Image Processing") |
||||||
|
ocv_define_module(imgproc opencv_core) |
||||||
|
@ -1 +1 @@ |
|||||||
define_opencv_module(legacy opencv_core opencv_imgproc opencv_calib3d opencv_features2d opencv_highgui opencv_video opencv_flann) |
ocv_define_module(legacy opencv_calib3d opencv_highgui opencv_video) |
||||||
|
@ -1 +1,2 @@ |
|||||||
define_opencv_module(ml opencv_core) |
set(the_description "Machine Learning") |
||||||
|
ocv_define_module(ml opencv_core) |
||||||
|
@ -1 +1,2 @@ |
|||||||
define_opencv_module(objdetect opencv_core opencv_imgproc opencv_highgui opencv_features2d opencv_calib3d opencv_flann) |
set(the_description "Object Detection") |
||||||
|
ocv_define_module(objdetect opencv_highgui opencv_calib3d) |
||||||
|
@ -1,11 +1,3 @@ |
|||||||
if(IOS) |
set(the_description "Images stitching") |
||||||
return() |
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_gpu) |
||||||
endif() |
|
||||||
|
|
||||||
set(DEPS opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_flann opencv_objdetect) |
|
||||||
if(NOT ANDROID) |
|
||||||
set(DEPS ${DEPS} opencv_gpu) |
|
||||||
endif() |
|
||||||
|
|
||||||
define_opencv_module(stitching ${DEPS}) |
|
||||||
|
|
||||||
|
@ -1,51 +0,0 @@ |
|||||||
if(IOS) |
|
||||||
return() |
|
||||||
endif() |
|
||||||
|
|
||||||
project(traincascade) |
|
||||||
|
|
||||||
include_directories( |
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/core/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/imgproc/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/objdetect/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/ml/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/highgui/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/video/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/features2d/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/flann/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/calib3d/include" |
|
||||||
"${OpenCV_SOURCE_DIR}/modules/legacy/include" |
|
||||||
) |
|
||||||
|
|
||||||
set(traincascade_libs opencv_core opencv_ml opencv_imgproc |
|
||||||
opencv_objdetect opencv_highgui opencv_haartraining_engine) |
|
||||||
|
|
||||||
set(traincascade_files traincascade.cpp |
|
||||||
cascadeclassifier.cpp cascadeclassifier.h |
|
||||||
boost.cpp boost.h features.cpp traincascade_features.h |
|
||||||
haarfeatures.cpp haarfeatures.h |
|
||||||
lbpfeatures.cpp lbpfeatures.h |
|
||||||
HOGfeatures.cpp HOGfeatures.h |
|
||||||
imagestorage.cpp imagestorage.h) |
|
||||||
|
|
||||||
set(the_target opencv_traincascade) |
|
||||||
add_executable(${the_target} ${traincascade_files}) |
|
||||||
|
|
||||||
add_dependencies(${the_target} ${traincascade_libs}) |
|
||||||
set_target_properties(${the_target} PROPERTIES |
|
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} |
|
||||||
INSTALL_NAME_DIR lib |
|
||||||
OUTPUT_NAME "opencv_traincascade") |
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS) |
|
||||||
set_target_properties(${the_target} PROPERTIES FOLDER "applications") |
|
||||||
endif() |
|
||||||
|
|
||||||
target_link_libraries(${the_target} ${traincascade_libs}) |
|
||||||
|
|
||||||
if(NOT ANDROID) |
|
||||||
install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) |
|
||||||
endif() |
|
@ -1,16 +1,24 @@ |
|||||||
if(BUILD_TESTS OR BUILD_PERF_TESTS) |
if(IOS) |
||||||
if(BUILD_SHARED_LIBS AND NOT MINGW) |
ocv_module_disable(ts) |
||||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1) |
endif() |
||||||
if (MSVC) |
|
||||||
add_definitions( "/wd4251 /wd4275") |
|
||||||
endif() |
|
||||||
else() |
|
||||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0) |
|
||||||
endif() |
|
||||||
|
|
||||||
if(MINGW) |
if(MINGW) |
||||||
set(OPENCV_TS_MODULE_TYPE STATIC) |
set(OPENCV_MODULE_TYPE STATIC) |
||||||
endif() |
endif() |
||||||
|
|
||||||
|
set(the_description "The ts module") |
||||||
|
ocv_add_module(ts opencv_core) |
||||||
|
ocv_glob_module_sources() |
||||||
|
ocv_module_include_directories() |
||||||
|
ocv_create_module() |
||||||
|
|
||||||
define_opencv_module(ts opencv_core) |
if(BUILD_SHARED_LIBS AND NOT MINGW) |
||||||
|
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1) |
||||||
|
if (MSVC) |
||||||
|
add_definitions( "/wd4251 /wd4275") |
||||||
|
endif() |
||||||
|
else() |
||||||
|
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0) |
||||||
endif() |
endif() |
||||||
|
|
||||||
|
ocv_add_precompiled_headers(${the_module}) |
||||||
|
@ -1 +1,2 @@ |
|||||||
define_opencv_module(video opencv_core opencv_imgproc) |
set(the_description "Video Analysis") |
||||||
|
ocv_define_module(video opencv_imgproc) |
||||||
|
@ -1,77 +1,69 @@ |
|||||||
if (BUILD_EXAMPLES) |
SET(OPENCV_GPU_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_highgui |
||||||
set(project "gpu") |
opencv_ml opencv_video opencv_objdetect opencv_features2d |
||||||
string(TOUPPER "${project}" project_upper) |
opencv_calib3d opencv_legacy opencv_contrib opencv_gpu) |
||||||
|
|
||||||
|
ocv_check_dependencies(${OPENCV_GPU_SAMPLES_REQUIRED_DEPS}) |
||||||
|
|
||||||
|
if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) |
||||||
|
set(project "gpu") |
||||||
|
string(TOUPPER "${project}" project_upper) |
||||||
|
|
||||||
project("${project}_samples") |
project("${project}_samples") |
||||||
|
|
||||||
include_directories( |
ocv_include_modules(${OPENCV_GPU_SAMPLES_REQUIRED_DEPS}) |
||||||
"${CMAKE_SOURCE_DIR}/modules/core/include" |
include_directories( |
||||||
"${CMAKE_SOURCE_DIR}/modules/flann/include" |
"${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia" |
||||||
"${CMAKE_SOURCE_DIR}/modules/imgproc/include" |
"${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia/core" |
||||||
"${CMAKE_SOURCE_DIR}/modules/video/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/highgui/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/ml/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/calib3d/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/features2d/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/objdetect/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/legacy/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/contrib/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/gpu/include" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/gpu/src/nvidia" |
|
||||||
"${CMAKE_SOURCE_DIR}/modules/gpu/src/nvidia/core" |
|
||||||
) |
) |
||||||
|
|
||||||
if(HAVE_CUDA) |
if(HAVE_CUDA) |
||||||
include_directories(${CUDA_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/modules/gpu/src/nvidia ${CMAKE_SOURCE_DIR}/modules/gpu/src/nvidia/core) |
include_directories(${CUDA_INCLUDE_DIRS} ${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia ${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia/core) |
||||||
endif() |
endif() |
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX) |
if(CMAKE_COMPILER_IS_GNUCXX) |
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") |
||||||
endif() |
endif() |
||||||
|
|
||||||
# --------------------------------------------- |
# --------------------------------------------- |
||||||
# Define executable targets |
# Define executable targets |
||||||
# --------------------------------------------- |
# --------------------------------------------- |
||||||
MACRO(MY_DEFINE_EXAMPLE name srcs) |
MACRO(OPENCV_DEFINE_GPU_EXAMPLE name srcs) |
||||||
set(the_target "example_${project}_${name}") |
set(the_target "example_${project}_${name}") |
||||||
add_executable(${the_target} ${srcs}) |
add_executable(${the_target} ${srcs}) |
||||||
set_target_properties(${the_target} PROPERTIES |
|
||||||
OUTPUT_NAME "${name}_${project}" |
|
||||||
PROJECT_LABEL "(EXAMPLE_${project_upper}) ${name}") |
|
||||||
add_dependencies(${the_target} opencv_core opencv_flann opencv_imgproc opencv_highgui |
|
||||||
opencv_ml opencv_video opencv_objdetect opencv_features2d |
|
||||||
opencv_calib3d opencv_legacy opencv_contrib opencv_gpu) |
|
||||||
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core |
|
||||||
opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect |
|
||||||
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_gpu) |
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS) |
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_GPU_SAMPLES_REQUIRED_DEPS}) |
||||||
set_target_properties(${the_target} PROPERTIES FOLDER "samples//${project}") |
|
||||||
endif() |
|
||||||
|
|
||||||
if(WIN32) |
set_target_properties(${the_target} PROPERTIES |
||||||
if (MSVC AND NOT BUILD_SHARED_LIBS) |
OUTPUT_NAME "${name}_${project}" |
||||||
set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") |
PROJECT_LABEL "(EXAMPLE_${project_upper}) ${name}") |
||||||
endif() |
|
||||||
install(TARGETS ${the_target} RUNTIME DESTINATION "samples/${project}" COMPONENT main) |
if(ENABLE_SOLUTION_FOLDERS) |
||||||
endif() |
set_target_properties(${the_target} PROPERTIES FOLDER "samples//${project}") |
||||||
ENDMACRO(MY_DEFINE_EXAMPLE) |
endif() |
||||||
|
|
||||||
|
if(WIN32) |
||||||
|
if(MSVC AND NOT BUILD_SHARED_LIBS) |
||||||
|
set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") |
||||||
|
endif() |
||||||
|
install(TARGETS ${the_target} RUNTIME DESTINATION "samples/${project}" COMPONENT main) |
||||||
|
endif() |
||||||
|
ENDMACRO() |
||||||
|
|
||||||
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) |
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) |
||||||
|
|
||||||
foreach(sample_filename ${all_samples}) |
foreach(sample_filename ${all_samples}) |
||||||
get_filename_component(sample ${sample_filename} NAME_WE) |
get_filename_component(sample ${sample_filename} NAME_WE) |
||||||
file(GLOB sample_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${sample}.*) |
file(GLOB sample_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${sample}.*) |
||||||
MY_DEFINE_EXAMPLE(${sample} ${sample_srcs}) |
OPENCV_DEFINE_GPU_EXAMPLE(${sample} ${sample_srcs}) |
||||||
endforeach() |
endforeach() |
||||||
|
|
||||||
include("performance/CMakeLists.txt") |
include("performance/CMakeLists.txt") |
||||||
endif(BUILD_EXAMPLES) |
endif() |
||||||
|
|
||||||
if (NOT WIN32) |
if (NOT WIN32) |
||||||
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) |
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) |
||||||
install(FILES ${install_list} |
install(FILES ${install_list} |
||||||
DESTINATION share/opencv/samples/${project} |
DESTINATION share/opencv/samples/${project} |
||||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) |
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) |
||||||
endif () |
endif() |
||||||
|
|
||||||
|
Loading…
Reference in new issue