diff --git a/CMakeLists.txt b/CMakeLists.txt index bf9d85feb..5cdc849f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -253,7 +253,7 @@ OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binar # OpenCV build options # =================================================== -OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) ) +OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS AND NOT CMAKE_CROSSCOMPILING AND NOT ((HAVE_CUDA OR WITH_CUDA) AND BUILD_opencv_world)) ) OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) ) OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX ) OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CMAKE_COMPILER_IS_GNUCXX ) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 75412ebc8..b60f357d4 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -747,20 +747,9 @@ function(ocv_add_executable target) endfunction() function(ocv_add_library target) - set(cuda_objs "") - if(HAVE_CUDA) - set(cuda_srcs "") - - foreach(var ${ARGN}) - if(var MATCHES ".cu") - list(APPEND cuda_srcs ${var}) - endif() - endforeach() - - if(cuda_srcs) - ocv_include_directories(${CUDA_INCLUDE_DIRS}) - ocv_cuda_compile(cuda_objs ${lib_cuda_srcs} ${lib_cuda_hdrs}) - endif() + if(HAVE_CUDA AND ARGN MATCHES "\\.cu") + ocv_include_directories(${CUDA_INCLUDE_DIRS}) + ocv_cuda_compile(cuda_objs ${ARGN}) set(OPENCV_MODULE_${target}_CUDA_OBJECTS ${cuda_objs} CACHE INTERNAL "Compiled CUDA object files") endif() @@ -771,9 +760,10 @@ function(ocv_add_library target) AND NOT OPENCV_MODULE_${target}_CHILDREN AND NOT OPENCV_MODULE_${target}_CLASS STREQUAL "BINDINGS" AND NOT ${target} STREQUAL "opencv_ts" + AND (NOT BUILD_opencv_world OR NOT HAVE_CUDA) ) set(sources ${ARGN}) - ocv_list_filterout(sources "\\\\.(cl|inc)$") + ocv_list_filterout(sources "\\\\.(cl|inc|cu)$") add_library(${target}_object OBJECT ${sources}) set_target_properties(${target}_object PROPERTIES EXCLUDE_FROM_ALL True diff --git a/modules/cudev/CMakeLists.txt b/modules/cudev/CMakeLists.txt index 257572951..f9f1d0bb9 100644 --- a/modules/cudev/CMakeLists.txt +++ b/modules/cudev/CMakeLists.txt @@ -17,6 +17,6 @@ ocv_set_module_sources(HEADERS ${lib_hdrs} SOURCES ${lib_srcs}) ocv_create_module() -if(BUILD_TESTS) +if(BUILD_TESTS AND NOT BUILD_opencv_world) add_subdirectory(test) endif() diff --git a/modules/world/CMakeLists.txt b/modules/world/CMakeLists.txt index 7783151fa..6fa10d0b5 100644 --- a/modules/world/CMakeLists.txt +++ b/modules/world/CMakeLists.txt @@ -20,13 +20,13 @@ if(NOT OPENCV_INITIAL_PASS) foreach(m ${OPENCV_MODULES_BUILD}) if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD) message(STATUS " module ${m}...") - set(CMAKE_CURRENT_SOURCE_DIR ${OPENCV_MODULE_${m}_LOCATION}) + set(CMAKE_CURRENT_SOURCE_DIR "${OPENCV_MODULE_${m}_LOCATION}") #add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" ${CMAKE_CURRENT_BINARY_DIR}/${m}) include_one_module(${m}) endif() endforeach() message(STATUS "Processing WORLD modules... DONE") - set(CMAKE_CURRENT_SOURCE_DIR OPENCV_MODULE_${opencv_world}_LOCATION) + set(CMAKE_CURRENT_SOURCE_DIR "${OPENCV_MODULE_opencv_world_LOCATION}") endif() ocv_add_module(world opencv_core)