From 9d5c24cdc85459948dfa01248cf2de1500f78bdc Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Wed, 25 Jan 2012 09:04:49 +0000 Subject: [PATCH] Updating opencv module definition in cmake (continued) --- cmake/OpenCVModule.cmake | 81 ++++++++++++---------------- cmake/OpenCVUtils.cmake | 12 ----- modules/CMakeLists.txt | 45 +++------------- modules/androidcamera/CMakeLists.txt | 4 +- modules/gpu/CMakeLists.txt | 52 +++++++----------- modules/haartraining/CMakeLists.txt | 4 ++ modules/highgui/CMakeLists.txt | 81 ++++++++++++---------------- modules/java/CMakeLists.txt | 4 ++ modules/python/CMakeLists.txt | 3 ++ modules/stitching/CMakeLists.txt | 4 ++ modules/traincascade/CMakeLists.txt | 4 ++ modules/ts/CMakeLists.txt | 22 ++++---- 12 files changed, 130 insertions(+), 186 deletions(-) diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 21ff49e27..27ef9e8ee 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -1,9 +1,24 @@ set(opencv_public_modules "" CACHE INTERNAL "List of OpenCV modules included into the build") # helper macro for modules management -macro(register_opencv_module name) +macro(opencv_module_register name) set(opencv_public_modules ${opencv_public_modules} ${name} CACHE INTERNAL "List of OpenCV modules included into the build") endmacro() +# Setup include path for OpenCV headers for specified modules +macro(opencv_module_includes) + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" + "${CMAKE_CURRENT_SOURCE_DIR}/src" + "${CMAKE_CURRENT_BINARY_DIR}") + foreach(d ${ARGN}) + if(d MATCHES "opencv_") + string(REPLACE "opencv_" "${OpenCV_SOURCE_DIR}/modules/" d_dir ${d}) + if (EXISTS "${d_dir}/include") + include_directories("${d_dir}/include") + endif() + endif() + endforeach() +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 macro(add_opencv_precompiled_headers the_target) @@ -28,24 +43,16 @@ macro(add_opencv_precompiled_headers the_target) endmacro() # this is a template for a OpenCV performance tests -# define_opencv_perf_test( ) +# define_opencv_perf_test( ) macro(define_opencv_perf_test name) set(perf_path "${CMAKE_CURRENT_SOURCE_DIR}/perf") if(BUILD_PERF_TESTS AND EXISTS "${perf_path}") - include_directories("${perf_path}" "${CMAKE_CURRENT_BINARY_DIR}") - # opencv_highgui is required for imread/imwrite set(perf_deps opencv_${name} ${ARGN} opencv_ts opencv_highgui ${EXTRA_OPENCV_${name}_DEPS}) - foreach(d ${perf_deps}) - if(d MATCHES "opencv_") - string(REPLACE "opencv_" "${OpenCV_SOURCE_DIR}/modules/" d_dir ${d}) - if (EXISTS "${d_dir}/include") - include_directories("${d_dir}/include") - endif() - endif() - endforeach() + include_directories("${perf_path}") + opencv_module_includes(${perf_deps}) file(GLOB perf_srcs "${perf_path}/*.cpp") file(GLOB perf_hdrs "${perf_path}/*.h*") @@ -66,7 +73,6 @@ macro(define_opencv_perf_test name) set_target_properties(${the_target} PROPERTIES FOLDER "performance tests") endif() - add_dependencies(${the_target} ${perf_deps}) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${perf_deps}) add_opencv_precompiled_headers(${the_target}) @@ -78,23 +84,16 @@ macro(define_opencv_perf_test name) endmacro() # this is a template for a OpenCV regression tests -# define_opencv_test( ) +# define_opencv_test( ) macro(define_opencv_test name) set(test_path "${CMAKE_CURRENT_SOURCE_DIR}/test") if(BUILD_TESTS AND EXISTS "${test_path}") - include_directories("${test_path}" "${CMAKE_CURRENT_BINARY_DIR}") # opencv_highgui is required for imread/imwrite set(test_deps opencv_${name} ${ARGN} opencv_ts opencv_highgui ${EXTRA_OPENCV_${name}_DEPS}) - foreach(d ${test_deps}) - if(d MATCHES "opencv_") - string(REPLACE "opencv_" "${OpenCV_SOURCE_DIR}/modules/" d_dir ${d}) - if (EXISTS "${d_dir}/include") - include_directories("${d_dir}/include") - endif() - endif() - endforeach() + include_directories("${test_path}") + opencv_module_includes(${test_deps}) file(GLOB test_srcs "${test_path}/*.cpp") file(GLOB test_hdrs "${test_path}/*.h*") @@ -115,7 +114,6 @@ macro(define_opencv_test name) set_target_properties(${the_target} PROPERTIES FOLDER "tests") endif() - add_dependencies(${the_target} ${test_deps}) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${test_deps}) enable_testing() @@ -129,8 +127,10 @@ macro(define_opencv_test name) endif() endmacro() -macro(setup_opencv_module name) +# Set standard properties, install rules and precompiled headers for OpenCV module +macro(opencv_module_setup name) set(the_target "opencv_${name}") + # For dynamic link numbering convenions if(NOT ANDROID) # Android SDK build scripts can include only .so files into final .apk @@ -185,31 +185,18 @@ macro(setup_opencv_module name) endmacro() # this is a template for a OpenCV module declaration -# define_opencv_moduleEx( [public|internal] [STATIC|SHARED|AUTO] ) -macro(define_opencv_moduleEx _name _visibility moduletype) +# define_opencv_moduleEx( [public|internal] ) +macro(define_opencv_moduleEx _name _visibility) string(TOLOWER "${_name}" name) string(TOUPPER "${_name}" mname) string(TOLOWER "${_visibility}" visibility) - string(TOUPPER "${moduletype}" modtype) - if(modtype STREQUAL "AUTO" ) - set(modtype "") - endif() option(OCVMODULE_${mname} "Include ${name} module into the OpenCV build" ON) if(OCVMODULE_${mname}) set(the_target "opencv_${name}") - - if(visibility STREQUAL "public") - register_opencv_module(${the_target}) - endif() - project(${the_target}) - include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" - "${CMAKE_CURRENT_SOURCE_DIR}/src" - "${CMAKE_CURRENT_BINARY_DIR}") - - include_opencv_modules(${ARGN}) + opencv_module_includes(${ARGN}) file(GLOB lib_srcs "src/*.cpp") file(GLOB lib_int_hdrs "src/*.h*") @@ -226,12 +213,14 @@ macro(define_opencv_moduleEx _name _visibility moduletype) list(APPEND lib_hdrs ${lib_hdrs_detail}) - add_library(${the_target} ${modtype} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs}) - - # Add the required libraries for linking: + add_library(${the_target} ${OPENCV_${mname}_MODULE_TYPE} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs}) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) - setup_opencv_module("${name}") + if(visibility STREQUAL "public") + opencv_module_register(${the_target}) + endif() + + opencv_module_setup(${name}) define_opencv_test(${name}) define_opencv_perf_test(${name}) endif() @@ -240,6 +229,6 @@ endmacro() # this is a shorthand for a public OpenCV module declaration # define_opencv_module( ) macro(define_opencv_module name) - define_opencv_moduleEx(${name} PUBLIC AUTO ${ARGN}) + define_opencv_moduleEx(${name} PUBLIC ${ARGN}) endmacro() diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 4b5efee83..d8f09c8cc 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -115,15 +115,3 @@ macro(status text) message(STATUS "${text}") endif() endmacro() - -# Setup include path for OpenCV headers for specified modules -macro(include_opencv_modules) - foreach(d ${ARGN}) - if(d MATCHES "opencv_") - string(REPLACE "opencv_" "${OpenCV_SOURCE_DIR}/modules/" d_dir ${d}) - if (EXISTS "${d_dir}/include") - include_directories("${d_dir}/include") - endif() - endif() - endforeach() -endmacro() diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 63b00ba1f..7620a4832 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,39 +1,10 @@ -if(ANDROID AND WITH_ANDROID_CAMERA) - add_subdirectory(androidcamera) +file(GLOB ocvmodules RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*") +if(ocvmodules) + list(SORT ocvmodules) endif() -add_subdirectory(calib3d) -add_subdirectory(core) -add_subdirectory(features2d) -add_subdirectory(flann) - -if(BUILD_TESTS OR BUILD_PERF_TESTS) - add_subdirectory(ts) -endif() - -add_subdirectory(highgui) -add_subdirectory(imgproc) -add_subdirectory(legacy) -add_subdirectory(contrib) -add_subdirectory(ml) -add_subdirectory(objdetect) - -if(PYTHONLIBS_FOUND AND BUILD_NEW_PYTHON_SUPPORT AND PYTHON_USE_NUMPY) - add_subdirectory(python) -endif() - -if(BUILD_JAVA_SUPPORT) - add_subdirectory(java) -endif() - -add_subdirectory(video) - -if(NOT (ANDROID OR IOS)) - add_subdirectory(gpu) -endif() - -if(NOT IOS) - add_subdirectory(traincascade) - add_subdirectory(haartraining) - add_subdirectory(stitching) -endif() +foreach(mod ${ocvmodules}) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${mod}/CMakeLists.txt") + add_subdirectory("${mod}") + endif() +endforeach() diff --git a/modules/androidcamera/CMakeLists.txt b/modules/androidcamera/CMakeLists.txt index 1d53a856e..88a69fe98 100644 --- a/modules/androidcamera/CMakeLists.txt +++ b/modules/androidcamera/CMakeLists.txt @@ -1,5 +1,5 @@ -IF(NOT ANDROID) - MESSAGE( FATAL_ERROR "This project is for ANDROID only" ) +IF(NOT ANDROID OR NOT WITH_ANDROID_CAMERA) + return() ENDIF() if (BUILD_ANDROID_CAMERA_WRAPPER) diff --git a/modules/gpu/CMakeLists.txt b/modules/gpu/CMakeLists.txt index 5b71fbce8..8bc4446a8 100644 --- a/modules/gpu/CMakeLists.txt +++ b/modules/gpu/CMakeLists.txt @@ -1,3 +1,7 @@ +if(ANDROID OR IOS) + return() +endif() + option(OCVMODULE_GPU "Include gpu module into the OpenCV build" ON) if(NOT OCVMODULE_GPU) return() @@ -12,10 +16,8 @@ set(DEPS "opencv_core" "opencv_imgproc" "opencv_calib3d" "opencv_objdetect") set(DEPS_HEADER ${DEPS} "opencv_features2d" "opencv_flann") set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} opencv_gpu) -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" - "${CMAKE_CURRENT_SOURCE_DIR}/src/cuda" - "${CMAKE_CURRENT_SOURCE_DIR}/src" - "${CMAKE_CURRENT_BINARY_DIR}") +opencv_module_includes(${DEPS_HEADER}) +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda") file(GLOB lib_srcs "src/*.cpp") file(GLOB lib_int_hdrs "src/*.h*") @@ -33,8 +35,6 @@ file(GLOB lib_device_hdrs_detail "src/opencv2/gpu/device/detail/*.h*") source_group("Device" FILES ${lib_device_hdrs}) source_group("Device\\Detail" FILES ${lib_device_hdrs_detail}) -include_opencv_modules(${DEPS_HEADER}) - if (HAVE_CUDA) file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp") file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu") @@ -90,9 +90,8 @@ if (HAVE_CUDA) endif() 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}) - -# Add the required libraries for linking: 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}) @@ -110,7 +109,7 @@ if (HAVE_CUDA) endif() endif() -setup_opencv_module(${name}) +opencv_module_setup(${name}) install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name} @@ -129,46 +128,33 @@ install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp # filter creation in Visual Studio if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test) set(the_test_target "opencv_test_${name}") - - include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" - "${CMAKE_CURRENT_SOURCE_DIR}/test" - "${CMAKE_CURRENT_BINARY_DIR}") - set(test_deps opencv_${name} opencv_ts opencv_highgui opencv_calib3d ${DEPS}) - foreach(d ${test_deps}) - if(${d} MATCHES "opencv_") - string(REPLACE "opencv_" "${CMAKE_CURRENT_SOURCE_DIR}/../" d_dir ${d}) - include_directories("${d_dir}/include") - endif() - endforeach() + + 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}) + 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) + 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}) + 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}) - add_opencv_precompiled_headers(${the_test_target}) - # 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_dependencies(${the_test_target} ${test_deps}) + 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}) @@ -180,6 +166,8 @@ if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test) #if(WIN32) # install(TARGETS ${the_test_target} RUNTIME DESTINATION bin COMPONENT main) #endif() + + add_opencv_precompiled_headers(${the_test_target}) endif() diff --git a/modules/haartraining/CMakeLists.txt b/modules/haartraining/CMakeLists.txt index 59bafeff5..ba7054de1 100644 --- a/modules/haartraining/CMakeLists.txt +++ b/modules/haartraining/CMakeLists.txt @@ -1,3 +1,7 @@ +if(IOS) + return() +endif() + project(haartraining) include_directories( diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 50377f5c7..ab8474dc3 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -229,7 +229,6 @@ if(WITH_ANDROID_CAMERA) set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} opencv_androidcamera) endif() -#XIMEA API if(HAVE_XIMEA AND XIMEA_FOUND) set(highgui_srcs ${highgui_srcs} src/cap_ximea.cpp) include_directories(${XIMEA_PATH}) @@ -238,6 +237,31 @@ if(HAVE_XIMEA AND XIMEA_FOUND) set(highgui_srcs ${highgui_srcs} src/cap_ximea.cpp) endif() +if(OPENNI_LIBRARY) + set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${OPENNI_LIBRARY}) +endif() + +if(APPLE AND NOT IOS) + set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} -lbz2 -framework Cocoa -framework QuartzCore) + if(WITH_CARBON) + set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} -framework Carbon) + endif() + if(NOT WITH_QUICKTIME) + set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} -framework QTKit) + endif() + if(WITH_CARBON OR WITH_QUICKTIME) + set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} -framework QuickTime -framework CoreFoundation) + endif() +endif() + +if(IOS) + set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} -lbz2 -framework QuartzCore -framework CoreFoundation -framework ImageIO -framework CoreGraphics -framework AVFoundation) +endif() + +if(OPENCV_BUILD_3RDPARTY_LIBS AND WIN32) + link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib") +endif() + if(COMMAND get_module_external_sources) set( lib_srcs "${highgui_srcs}" ) set( lib_int_hdrs "${highgui_hdrs}" ) @@ -249,33 +273,23 @@ endif() source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs}) source_group("Include" FILES ${highgui_ext_hdrs}) -if(OPENCV_BUILD_3RDPARTY_LIBS) - if(WIN32) - link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib") - endif() - #link_directories( - # "${CMAKE_BINARY_DIR}/3rdparty/lib" - # "${CMAKE_BINARY_DIR}/3rdparty/lib/${ConfigurationName}" - # ) -endif() +#message(STATUS "GRFMT: ${GRFMT_LIBS}") +#message(STATUS "OPENCV_LIBS: ${OPENCV_LINKER_LIBS}") +#message(STATUS "HIGHGUI_LIBS: ${HIGHGUI_LIBRARIES}") # ---------------------------------------------------------------------------------- # Define the library target: # ---------------------------------------------------------------------------------- -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" - "${CMAKE_CURRENT_SOURCE_DIR}/../core/include" - "${CMAKE_CURRENT_SOURCE_DIR}/../imgproc/include" - "${CMAKE_CURRENT_SOURCE_DIR}/src" - "${CMAKE_CURRENT_BINARY_DIR}") - +opencv_module_includes(opencv_core opencv_imgproc) if(WIN32) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include") endif() add_library(${the_target} ${highgui_srcs} ${grfmt_srcs} ${highgui_hdrs} ${grfmt_hdrs} ${highgui_ext_hdrs}) -register_opencv_module(${the_target}) +target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_imgproc ${GRFMT_LIBS} ${HIGHGUI_LIBRARIES}) +opencv_module_register(${the_target}) -if (BUILD_SHARED_LIBS) +if(BUILD_SHARED_LIBS) add_definitions(-DHIGHGUI_EXPORTS) endif() @@ -283,33 +297,6 @@ if(MSVC) set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG") endif() -#message(STATUS "GRFMT: ${GRFMT_LIBS}") -#message(STATUS "HIGHGUI_LIBS: ${HIGHGUI_LIBRARIES}") -#message(STATUS "OPENCV_LIBS: ${OPENCV_LINKER_LIBS}") - -target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core - opencv_imgproc ${GRFMT_LIBS} ${HIGHGUI_LIBRARIES}) -if( OPENNI_LIBRARY ) - target_link_libraries(${the_target} ${OPENNI_LIBRARY}) -endif() - -if(APPLE AND NOT IOS) - target_link_libraries(${the_target} "-lbz2 -framework Cocoa -framework QuartzCore") - if(WITH_CARBON) - target_link_libraries(${the_target} "-framework Carbon") - endif() - if(NOT WITH_QUICKTIME) - target_link_libraries(${the_target} "-framework QTKit") - endif() - if(WITH_CARBON OR WITH_QUICKTIME) - target_link_libraries(${the_target} "-framework QuickTime -framework CoreFoundation") - endif() -endif() - -if (IOS) - target_link_libraries(${the_target} "-lbz2 -framework QuartzCore -framework CoreFoundation -framework ImageIO -framework CoreGraphics -framework AVFoundation") -endif() - -setup_opencv_module(highgui) +opencv_module_setup(highgui) define_opencv_test(highgui) -define_opencv_perf_test(highgui) \ No newline at end of file +define_opencv_perf_test(highgui) diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index 460fe855b..3d66b60fa 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -1,3 +1,7 @@ +if(NOT BUILD_JAVA_SUPPORT OR NOT PYTHON_EXECUTABLE) + return() +endif() + # ---------------------------------------------------------------------------- # CMake file for java support # ---------------------------------------------------------------------------- diff --git a/modules/python/CMakeLists.txt b/modules/python/CMakeLists.txt index 1433fc4dd..589c764bd 100644 --- a/modules/python/CMakeLists.txt +++ b/modules/python/CMakeLists.txt @@ -1,6 +1,9 @@ if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") return() endif() +if(NOT PYTHONLIBS_FOUND OR NOT BUILD_NEW_PYTHON_SUPPORT OR NOT PYTHON_USE_NUMPY) + return() +endif() # ---------------------------------------------------------------------------- # CMake file for python support diff --git a/modules/stitching/CMakeLists.txt b/modules/stitching/CMakeLists.txt index 98410198d..edeaa63c4 100644 --- a/modules/stitching/CMakeLists.txt +++ b/modules/stitching/CMakeLists.txt @@ -1,3 +1,7 @@ +if(IOS) + return() +endif() + if(ANDROID) define_opencv_module(stitching opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_flann opencv_objdetect) else() diff --git a/modules/traincascade/CMakeLists.txt b/modules/traincascade/CMakeLists.txt index 858f42f99..4cfca3e66 100644 --- a/modules/traincascade/CMakeLists.txt +++ b/modules/traincascade/CMakeLists.txt @@ -1,3 +1,7 @@ +if(IOS) + return() +endif() + project(traincascade) include_directories( diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt index a8182faa2..3574f98f3 100644 --- a/modules/ts/CMakeLists.txt +++ b/modules/ts/CMakeLists.txt @@ -1,14 +1,16 @@ -if(BUILD_SHARED_LIBS) - add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1) - if (MSVC) - add_definitions( "/wd4251 /wd4275") +if(BUILD_TESTS OR BUILD_PERF_TESTS) + 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() + + if(MINGW) + set(OPENCV_TS_MODULE_TYPE STATIC) endif() -else() - add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0) -endif() -if(MINGW) - define_opencv_moduleEx(ts PUBLIC STATIC opencv_core) -else() define_opencv_module(ts opencv_core) endif()