Commit 9e9fd281 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #8044 from alalek:opencv_world_with_contrib

parents 5c13ffb7 4b7c0b9c
...@@ -76,6 +76,10 @@ if(POLICY CMP0022) ...@@ -76,6 +76,10 @@ if(POLICY CMP0022)
cmake_policy(SET CMP0022 OLD) cmake_policy(SET CMP0022 OLD)
endif() endif()
if(POLICY CMP0023)
cmake_policy(SET CMP0023 NEW)
endif()
if(POLICY CMP0026) if(POLICY CMP0026)
# silence cmake 3.0+ warnings about reading LOCATION attribute # silence cmake 3.0+ warnings about reading LOCATION attribute
cmake_policy(SET CMP0026 OLD) cmake_policy(SET CMP0026 OLD)
......
...@@ -72,7 +72,7 @@ set(generated_cubin_file_internal "@generated_cubin_file@") # path ...@@ -72,7 +72,7 @@ set(generated_cubin_file_internal "@generated_cubin_file@") # path
set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path
set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
@CUDA_NVCC_FLAGS_CONFIG@ @CUDA_NVCC_FLAGS_CONFIG@
set(nvcc_flags @nvcc_flags@) # list set(nvcc_flags "@nvcc_flags@") # list
set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly). set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly).
set(format_flag "@format_flag@") # string set(format_flag "@format_flag@") # string
......
...@@ -172,3 +172,13 @@ elseif(MINGW) ...@@ -172,3 +172,13 @@ elseif(MINGW)
set(OpenCV_ARCH x86) set(OpenCV_ARCH x86)
endif() endif()
endif() endif()
# Fix handling of duplicated files in the same static library:
# https://public.kitware.com/Bug/view.php?id=14874
if(CMAKE_VERSION VERSION_LESS "3.1")
foreach(var CMAKE_C_ARCHIVE_APPEND CMAKE_CXX_ARCHIVE_APPEND)
if(${var} MATCHES "^<CMAKE_AR> r")
string(REPLACE "<CMAKE_AR> r" "<CMAKE_AR> q" ${var} "${${var}}")
endif()
endforeach()
endif()
...@@ -33,10 +33,12 @@ foreach(mod ${OPENCV_MODULES_BUILD}) ...@@ -33,10 +33,12 @@ foreach(mod ${OPENCV_MODULES_BUILD})
list(APPEND OPENCV_ABI_SKIP_HEADERS "${h}") list(APPEND OPENCV_ABI_SKIP_HEADERS "${h}")
endforeach() endforeach()
# libraries # libraries
set(lib_name "") if(TARGET opencv_${mod}) # opencv_world
get_target_property(lib_name opencv_${mod} LOCATION) set(lib_name "")
get_filename_component(lib_name "${lib_name}" NAME) get_target_property(lib_name opencv_${mod} LOCATION)
list(APPEND OPENCV_ABI_SKIP_LIBRARIES "${lib_name}") get_filename_component(lib_name "${lib_name}" NAME)
list(APPEND OPENCV_ABI_SKIP_LIBRARIES "${lib_name}")
endif()
endif() endif()
endforeach() endforeach()
string(REPLACE ";" "\n " OPENCV_ABI_SKIP_HEADERS "${OPENCV_ABI_SKIP_HEADERS}") string(REPLACE ";" "\n " OPENCV_ABI_SKIP_HEADERS "${OPENCV_ABI_SKIP_HEADERS}")
......
...@@ -182,7 +182,7 @@ macro(ocv_add_module _name) ...@@ -182,7 +182,7 @@ macro(ocv_add_module _name)
# add self to the world dependencies # add self to the world dependencies
if((NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD if((NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD
AND NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "BINDINGS" AND NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "BINDINGS"
AND NOT OPENCV_PROCESSING_EXTRA_MODULES AND (NOT OPENCV_PROCESSING_EXTRA_MODULES OR NOT OPENCV_WORLD_EXCLUDE_EXTRA_MODULES)
AND (NOT BUILD_SHARED_LIBS OR NOT "x${OPENCV_MODULE_TYPE}" STREQUAL "xSTATIC")) AND (NOT BUILD_SHARED_LIBS OR NOT "x${OPENCV_MODULE_TYPE}" STREQUAL "xSTATIC"))
OR OPENCV_MODULE_IS_PART_OF_WORLD OR OPENCV_MODULE_IS_PART_OF_WORLD
) )
...@@ -233,7 +233,7 @@ macro(ocv_add_module _name) ...@@ -233,7 +233,7 @@ macro(ocv_add_module _name)
endmacro() endmacro()
# excludes module from current configuration # excludes module from current configuration
macro(ocv_module_disable module) macro(ocv_module_disable_ module)
set(__modname ${module}) set(__modname ${module})
if(NOT __modname MATCHES "^opencv_") if(NOT __modname MATCHES "^opencv_")
set(__modname opencv_${module}) set(__modname opencv_${module})
...@@ -246,9 +246,12 @@ macro(ocv_module_disable module) ...@@ -246,9 +246,12 @@ macro(ocv_module_disable module)
# touch variable controlling build of the module to suppress "unused variable" CMake warning # touch variable controlling build of the module to suppress "unused variable" CMake warning
endif() endif()
unset(__modname) unset(__modname)
return() # leave the current folder
endmacro() endmacro()
macro(ocv_module_disable module)
ocv_module_disable_(${module})
return() # leave the current folder
endmacro()
# collect modules from specified directories # collect modules from specified directories
# NB: must be called only once! # NB: must be called only once!
...@@ -724,8 +727,10 @@ endmacro() ...@@ -724,8 +727,10 @@ endmacro()
# ocv_create_module(<extra link dependencies>) # ocv_create_module(<extra link dependencies>)
# ocv_create_module() # ocv_create_module()
macro(ocv_create_module) macro(ocv_create_module)
ocv_debug_message("ocv_create_module(" ${ARGN} ")") ocv_debug_message("${the_module}: ocv_create_module(" ${ARGN} ")")
set(OPENCV_MODULE_${the_module}_LINK_DEPS "${OPENCV_MODULE_${the_module}_LINK_DEPS};${ARGN}" CACHE INTERNAL "") if(NOT " ${ARGN}" STREQUAL " ")
set(OPENCV_MODULE_${the_module}_LINK_DEPS "${OPENCV_MODULE_${the_module}_LINK_DEPS};${ARGN}" CACHE INTERNAL "")
endif()
if(${BUILD_opencv_world} AND OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD) if(${BUILD_opencv_world} AND OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD)
# nothing # nothing
set(the_module_target opencv_world) set(the_module_target opencv_world)
......
...@@ -303,9 +303,11 @@ ENDMACRO(ADD_PRECOMPILED_HEADER) ...@@ -303,9 +303,11 @@ ENDMACRO(ADD_PRECOMPILED_HEADER)
MACRO(GET_NATIVE_PRECOMPILED_HEADER _targetName _input) MACRO(GET_NATIVE_PRECOMPILED_HEADER _targetName _input)
if(ENABLE_PRECOMPILED_HEADERS)
if(CMAKE_GENERATOR MATCHES "^Visual.*$") if(CMAKE_GENERATOR MATCHES "^Visual.*$")
set(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cpp) set(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cpp)
endif() endif()
endif()
ENDMACRO(GET_NATIVE_PRECOMPILED_HEADER) ENDMACRO(GET_NATIVE_PRECOMPILED_HEADER)
......
...@@ -887,7 +887,14 @@ function(ocv_target_link_libraries target) ...@@ -887,7 +887,14 @@ function(ocv_target_link_libraries target)
if(";${LINK_DEPS};" MATCHES ";${target};") if(";${LINK_DEPS};" MATCHES ";${target};")
list(REMOVE_ITEM LINK_DEPS "${target}") # prevent "link to itself" warning (world problem) list(REMOVE_ITEM LINK_DEPS "${target}") # prevent "link to itself" warning (world problem)
endif() endif()
target_link_libraries(${target} ${LINK_DEPS}) if(NOT TARGET ${target})
if(NOT DEFINED OPENCV_MODULE_${target}_LOCATION)
message(FATAL_ERROR "ocv_target_link_libraries: invalid target: '${target}'")
endif()
set(OPENCV_MODULE_${target}_LINK_DEPS ${OPENCV_MODULE_${target}_LINK_DEPS} ${LINK_DEPS} CACHE INTERNAL "" FORCE)
else()
target_link_libraries(${target} ${LINK_DEPS})
endif()
endfunction() endfunction()
function(_ocv_append_target_includes target) function(_ocv_append_target_includes target)
......
...@@ -2,16 +2,26 @@ ...@@ -2,16 +2,26 @@
# CMake file for python support # CMake file for python support
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if((WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") if(ANDROID OR APPLE_FRAMEWORK OR WINRT)
OR BUILD_opencv_world set(__disable_python2 ON)
) set(__disable_python3 ON)
ocv_module_disable(python2) elseif(BUILD_opencv_world OR (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug"))
ocv_module_disable(python3) if(NOT DEFINED BUILD_opencv_python2)
set(__disable_python2 ON)
endif()
if(NOT DEFINED BUILD_opencv_python3)
set(__disable_python3 ON)
endif()
endif() endif()
if(ANDROID OR APPLE_FRAMEWORK OR WINRT) if(__disable_python2)
ocv_module_disable(python2) ocv_module_disable_(python2)
ocv_module_disable(python3) endif()
if(__disable_python3)
ocv_module_disable_(python3)
endif()
if(__disable_python2 AND __disable_python3)
return()
endif() endif()
add_subdirectory(python2) add_subdirectory(python2)
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
/* End of file. */
...@@ -5,7 +5,7 @@ if(HAVE_CUDA) ...@@ -5,7 +5,7 @@ if(HAVE_CUDA)
endif() endif()
set(STITCHING_CONTRIB_DEPS "opencv_xfeatures2d") set(STITCHING_CONTRIB_DEPS "opencv_xfeatures2d")
if(BUILD_SHARED_LIBS AND BUILD_opencv_world) if(BUILD_SHARED_LIBS AND BUILD_opencv_world AND OPENCV_WORLD_EXCLUDE_EXTRA_MODULES)
set(STITCHING_CONTRIB_DEPS "") set(STITCHING_CONTRIB_DEPS "")
endif() endif()
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect
......
...@@ -193,7 +193,7 @@ class CMakeCache: ...@@ -193,7 +193,7 @@ class CMakeCache:
self.tests_dir = os.path.normpath(path) self.tests_dir = os.path.normpath(path)
def read(self, path, fname): def read(self, path, fname):
rx = re.compile(r'^opencv_(\w+)_SOURCE_DIR:STATIC=(.*)$') rx = re.compile(r'^OPENCV_MODULE_opencv_(\w+)_LOCATION:INTERNAL=(.*)$')
module_paths = {} # name -> path module_paths = {} # name -> path
with open(fname, "rt") as cachefile: with open(fname, "rt") as cachefile:
for l in cachefile.readlines(): for l in cachefile.readlines():
......
...@@ -2,12 +2,14 @@ if(NOT WITH_VTK OR NOT DEFINED HAVE_VTK OR NOT HAVE_VTK) ...@@ -2,12 +2,14 @@ if(NOT WITH_VTK OR NOT DEFINED HAVE_VTK OR NOT HAVE_VTK)
ocv_module_disable(viz) ocv_module_disable(viz)
endif() endif()
include(${VTK_USE_FILE})
set(the_description "Viz") set(the_description "Viz")
ocv_define_module(viz opencv_core ${VTK_LIBRARIES} WRAP python) ocv_define_module(viz opencv_core WRAP python)
include(${VTK_USE_FILE})
ocv_target_link_libraries(${the_module} ${VTK_LIBRARIES})
if(APPLE AND BUILD_opencv_viz) if(APPLE AND BUILD_opencv_viz)
ocv_target_link_libraries(opencv_viz "-framework Cocoa") ocv_target_link_libraries(${the_module} "-framework Cocoa")
endif() endif()
if(TARGET opencv_test_viz) if(TARGET opencv_test_viz)
......
...@@ -11,6 +11,11 @@ endif() ...@@ -11,6 +11,11 @@ endif()
function(include_one_module m) function(include_one_module m)
include("${OPENCV_MODULE_${m}_LOCATION}/CMakeLists.txt") include("${OPENCV_MODULE_${m}_LOCATION}/CMakeLists.txt")
foreach(var
CMAKE_CXX_FLAGS CMAKE_C_FLAGS # Propagate warnings settings
)
set(${var} "${${var}}" PARENT_SCOPE)
endforeach()
endfunction() endfunction()
if(NOT OPENCV_INITIAL_PASS) if(NOT OPENCV_INITIAL_PASS)
...@@ -35,12 +40,14 @@ ocv_add_module(world opencv_core) ...@@ -35,12 +40,14 @@ ocv_add_module(world opencv_core)
set(headers_list "HEADERS") set(headers_list "HEADERS")
set(sources_list "SOURCES") set(sources_list "SOURCES")
set(link_deps "") set(link_deps "")
foreach(m ${OPENCV_MODULE_${the_module}_DEPS}) foreach(m ${OPENCV_MODULE_${the_module}_DEPS} opencv_world)
if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD) if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD)
set(headers_list "${headers_list};${OPENCV_MODULE_${m}_HEADERS}") set(headers_list "${headers_list};${OPENCV_MODULE_${m}_HEADERS}")
set(sources_list "${sources_list};${OPENCV_MODULE_${m}_SOURCES}") set(sources_list "${sources_list};${OPENCV_MODULE_${m}_SOURCES}")
endif() endif()
set(link_deps "${link_deps};${OPENCV_MODULE_${m}_LINK_DEPS}") if(NOT " ${OPENCV_MODULE_${m}_LINK_DEPS}" STREQUAL " ")
list(APPEND link_deps ${OPENCV_MODULE_${m}_LINK_DEPS})
endif()
endforeach() endforeach()
ocv_glob_module_sources(${headers_list} ${sources_list}) ocv_glob_module_sources(${headers_list} ${sources_list})
......
...@@ -14,27 +14,19 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) ...@@ -14,27 +14,19 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
project("${project}_samples") project("${project}_samples")
ocv_include_modules_recurse(${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS}) ocv_include_modules_recurse(${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
ocv_include_directories(
"${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia"
"${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia/core"
)
if(HAVE_opencv_xfeatures2d) if(HAVE_opencv_xfeatures2d)
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/xfeatures2d/include") ocv_include_modules_recurse(opencv_xfeatures2d)
endif() endif()
if(HAVE_opencv_cudacodec) if(HAVE_opencv_cudacodec)
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/cudacodec/include") ocv_include_modules_recurse(opencv_cudacodec)
endif() endif()
if(HAVE_CUDA) if(HAVE_CUDA)
ocv_include_directories(${CUDA_INCLUDE_DIRS}) ocv_include_directories(${CUDA_INCLUDE_DIRS})
endif() endif()
if(HAVE_OPENCL)
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/ocl/include")
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS) if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
endif() endif()
......
...@@ -4,11 +4,11 @@ file(GLOB sources "performance/*.cpp") ...@@ -4,11 +4,11 @@ file(GLOB sources "performance/*.cpp")
file(GLOB headers "performance/*.h") file(GLOB headers "performance/*.h")
if(HAVE_opencv_xfeatures2d) if(HAVE_opencv_xfeatures2d)
ocv_include_directories("${opencv_xfeatures2d_SOURCE_DIR}/include") ocv_include_modules_recurse(opencv_xfeatures2d)
endif() endif()
if(HAVE_opencv_bgsegm) if(HAVE_opencv_bgsegm)
ocv_include_directories("${opencv_bgsegm_SOURCE_DIR}/include") ocv_include_modules_recurse(opencv_bgsegm)
endif() endif()
add_executable(${the_target} ${sources} ${headers}) add_executable(${the_target} ${sources} ${headers})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment