Merge pull request #9886 from mshabunin:remove-cmake-submodules

pull/9845/head
Alexander Alekhin 7 years ago
commit 60cbc46da1
  1. 7
      cmake/OpenCVGenPkgconfig.cmake
  2. 63
      cmake/OpenCVModule.cmake
  3. 24
      cmake/OpenCVUtils.cmake
  4. 2
      doc/CMakeLists.txt

@ -57,17 +57,12 @@ ocv_get_all_libs(_modules _extra _3rdparty)
# when linking against static libraries, if libfoo depends on libbar, then
# libfoo must come first in the linker flags.
# world and contrib_world are special targets whose library should come first,
# world is a special target whose library should come first,
# especially for static link.
if(_modules MATCHES "opencv_world")
set(_modules "opencv_world")
endif()
if(_modules MATCHES "opencv_contrib_world")
list(REMOVE_ITEM _modules "opencv_contrib_world")
list(INSERT _modules 0 "opencv_contrib_world")
endif()
set(HELPER_SCRIPT "")
ocv_cmake_script_append_var(HELPER_SCRIPT
BUILD_SHARED_LIBS

@ -20,7 +20,6 @@
# OPENCV_MODULE_${the_module}_PRIVATE_OPT_DEPS
# OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD
# OPENCV_MODULE_${the_module}_CUDA_OBJECTS - compiled CUDA objects list
# OPENCV_MODULE_${the_module}_CHILDREN - list of submodules for compound modules (cmake >= 2.8.8)
# OPENCV_MODULE_${the_module}_WRAPPERS - list of wrappers supporting this module
# HAVE_${the_module} - for fast check of module availability
@ -30,7 +29,6 @@
# OPENCV_MODULE_TYPE - STATIC|SHARED - set to force override global settings for current module
# OPENCV_MODULE_IS_PART_OF_WORLD - ON|OFF (default ON) - should the module be added to the opencv_world?
# BUILD_${the_module}_INIT - ON|OFF (default ON) - initial value for BUILD_${the_module}
# OPENCV_MODULE_CHILDREN - list of submodules
# The verbose template for OpenCV module:
#
@ -208,9 +206,6 @@ macro(ocv_add_module _name)
set(OPENCV_MODULES_DISABLED_USER ${OPENCV_MODULES_DISABLED_USER} "${the_module}" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user")
endif()
# add submodules if any
set(OPENCV_MODULE_${the_module}_CHILDREN "${OPENCV_MODULE_CHILDREN}" CACHE INTERNAL "List of ${the_module} submodules")
# add reverse wrapper dependencies
foreach (wrapper ${OPENCV_MODULE_${the_module}_WRAPPERS})
ocv_add_dependencies(opencv_${wrapper} OPTIONAL ${the_module})
@ -372,7 +367,7 @@ function(__ocv_sort_modules_by_deps __lst)
if (NOT ";${result};" MATCHES ";${m};")
# scan through module dependencies...
set(unresolved_deps_found FALSE)
foreach (d ${OPENCV_MODULE_${m}_CHILDREN} ${OPENCV_MODULE_${m}_DEPS})
foreach (d ${OPENCV_MODULE_${m}_DEPS})
# ... which are not already in the result and are enabled
if ((NOT ";${result};" MATCHES ";${d};") AND HAVE_${d})
set(unresolved_deps_found TRUE)
@ -791,21 +786,6 @@ macro(_ocv_create_module)
get_native_precompiled_header(${the_module} precomp.hpp)
endif()
set(sub_objs "")
set(cuda_objs "")
if (OPENCV_MODULE_${the_module}_CHILDREN)
message(STATUS "Complex module ${the_module}")
foreach (m ${OPENCV_MODULE_${the_module}_CHILDREN})
if (BUILD_${m} AND TARGET ${m}_object)
list(APPEND sub_objs $<TARGET_OBJECTS:${m}_object>)
message(STATUS " + ${m}")
else()
message(STATUS " - ${m}")
endif()
list(APPEND cuda_objs ${OPENCV_MODULE_${m}_CUDA_OBJECTS})
endforeach()
endif()
if(WIN32
AND (BUILD_SHARED_LIBS AND NOT "x${OPENCV_MODULE_TYPE}" STREQUAL "xSTATIC")
AND NOT OPENCV_VS_VERSIONINFO_SKIP)
@ -834,17 +814,10 @@ macro(_ocv_create_module)
source_group("Src" FILES "${${the_module}_pch}")
ocv_add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES}
"${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp"
${${the_module}_pch} ${sub_objs}
${${the_module}_pch}
${_VS_VERSION_FILE}
)
if (cuda_objs)
target_link_libraries(${the_module} LINK_PRIVATE ${cuda_objs})
endif()
unset(sub_objs)
unset(cuda_objs)
set_target_properties(${the_module} PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};Module")
set_source_files_properties(${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES} ${${the_module}_pch}
PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};Module")
@ -913,31 +886,17 @@ macro(_ocv_create_module)
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT dev NAMELINK_ONLY)
endif()
foreach(m ${OPENCV_MODULE_${the_module}_CHILDREN} ${the_module})
# only "public" headers need to be installed
if(OPENCV_MODULE_${m}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${m};")
foreach(hdr ${OPENCV_MODULE_${m}_HEADERS})
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
if(NOT hdr2 MATCHES "private" AND hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$" )
install(FILES ${hdr} OPTIONAL DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT dev)
endif()
endforeach()
endif()
endforeach()
# only "public" headers need to be installed
if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
if(NOT hdr2 MATCHES "private" AND hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$" )
install(FILES ${hdr} OPTIONAL DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT dev)
endif()
endforeach()
endif()
_ocv_add_precompiled_headers(${the_module})
if (TARGET ${the_module}_object)
# copy COMPILE_DEFINITIONS
get_target_property(main_defs ${the_module} COMPILE_DEFINITIONS)
if (main_defs)
set_target_properties(${the_module}_object PROPERTIES COMPILE_DEFINITIONS ${main_defs})
endif()
# use same PCH
if (TARGET pch_Generate_${the_module})
add_dependencies(${the_module}_object pch_Generate_${the_module} )
endif()
endif()
endmacro()
# opencv precompiled headers macro (can add pch to modules and tests)

@ -949,9 +949,6 @@ endfunction()
function(_ocv_append_target_includes target)
if(DEFINED OCV_TARGET_INCLUDE_DIRS_${target})
target_include_directories(${target} PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
if (TARGET ${target}_object)
target_include_directories(${target}_object PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
endif()
if(OPENCV_DEPENDANT_TARGETS_${target})
foreach(t ${OPENCV_DEPENDANT_TARGETS_${target}})
target_include_directories(${t} PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
@ -975,27 +972,6 @@ function(ocv_add_library target)
add_library(${target} ${ARGN} ${cuda_objs})
# Add OBJECT library (added in cmake 2.8.8) to use in compound modules
if (NOT CMAKE_VERSION VERSION_LESS "2.8.8" AND OPENCV_ENABLE_OBJECT_TARGETS
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|cu)$")
add_library(${target}_object OBJECT ${sources})
set_target_properties(${target}_object PROPERTIES
EXCLUDE_FROM_ALL True
EXCLUDE_FROM_DEFAULT_BUILD True
POSITION_INDEPENDENT_CODE True
)
if (ENABLE_SOLUTION_FOLDERS)
set_target_properties(${target}_object PROPERTIES FOLDER "object_libraries")
endif()
unset(sources)
endif()
if(APPLE_FRAMEWORK AND BUILD_SHARED_LIBS)
message(STATUS "Setting Apple target properties for ${target}")

@ -33,7 +33,7 @@ endif(HAVE_DOC_GENERATOR)
if(BUILD_DOCS AND DOXYGEN_FOUND)
# not documented modules list
list(APPEND blacklist "ts" "java" "python2" "python3" "js" "world" "contrib_world")
list(APPEND blacklist "ts" "java" "python2" "python3" "js" "world")
unset(CMAKE_DOXYGEN_TUTORIAL_CONTRIB_ROOT)
unset(CMAKE_DOXYGEN_TUTORIAL_JS_ROOT)

Loading…
Cancel
Save