|
|
@ -72,17 +72,13 @@ macro(ocv_add_dependencies full_modname) |
|
|
|
list(APPEND ${__depsvar} "${d}") |
|
|
|
list(APPEND ${__depsvar} "${d}") |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
|
|
|
|
unset(__depsvar) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ocv_list_unique(OPENCV_MODULE_${full_modname}_REQ_DEPS) |
|
|
|
|
|
|
|
ocv_list_unique(OPENCV_MODULE_${full_modname}_OPT_DEPS) |
|
|
|
|
|
|
|
|
|
|
|
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}_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") |
|
|
|
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() |
|
|
|
|
|
|
|
|
|
|
|
# declare new OpenCV module in current folder |
|
|
|
# declare new OpenCV module in current folder |
|
|
@ -105,19 +101,22 @@ macro(ocv_add_module _name) |
|
|
|
") |
|
|
|
") |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
#remember module details |
|
|
|
|
|
|
|
if(NOT DEFINED the_description) |
|
|
|
if(NOT DEFINED the_description) |
|
|
|
set(the_description "The ${name} OpenCV module") |
|
|
|
set(the_description "The ${name} OpenCV module") |
|
|
|
endif() |
|
|
|
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 |
|
|
|
|
|
|
|
if(NOT DEFINED BUILD_${the_module}_INIT) |
|
|
|
if(NOT DEFINED BUILD_${the_module}_INIT) |
|
|
|
set(BUILD_${the_module}_INIT ON) |
|
|
|
set(BUILD_${the_module}_INIT ON) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# create option to enable/disable this module |
|
|
|
option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ${BUILD_${the_module}_INIT}) |
|
|
|
option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ${BUILD_${the_module}_INIT}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# remember the module details |
|
|
|
|
|
|
|
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") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# parse list of dependencies |
|
|
|
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS") |
|
|
|
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS") |
|
|
|
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module") |
|
|
|
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module") |
|
|
|
set(__ocv_argn__ ${ARGN}) |
|
|
|
set(__ocv_argn__ ${ARGN}) |
|
|
@ -149,22 +148,13 @@ macro(ocv_add_module _name) |
|
|
|
return() |
|
|
|
return() |
|
|
|
else(OPENCV_INITIAL_PASS) |
|
|
|
else(OPENCV_INITIAL_PASS) |
|
|
|
if(NOT BUILD_${the_module}) |
|
|
|
if(NOT BUILD_${the_module}) |
|
|
|
#extra protection from redefinition |
|
|
|
return() # extra protection from redefinition |
|
|
|
return() |
|
|
|
|
|
|
|
endif() |
|
|
|
endif() |
|
|
|
project(${the_module}) |
|
|
|
project(${the_module}) |
|
|
|
endif(OPENCV_INITIAL_PASS) |
|
|
|
endif(OPENCV_INITIAL_PASS) |
|
|
|
endmacro() |
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
# Internal macro; disables OpenCV module |
|
|
|
# excludes module from current configuration |
|
|
|
# ocv_module_turn_off(<module name>) |
|
|
|
|
|
|
|
macro(__ocv_module_turn_off the_module) |
|
|
|
|
|
|
|
list(APPEND OPENCV_MODULES_DISABLED_AUTO "${the_module}") |
|
|
|
|
|
|
|
list(REMOVE_ITEM OPENCV_MODULES_BUILD "${the_module}") |
|
|
|
|
|
|
|
list(REMOVE_ITEM OPENCV_MODULES_PUBLIC "${the_module}") |
|
|
|
|
|
|
|
set(HAVE_${the_module} OFF CACHE INTERNAL "Module ${the_module} can not be built in current configuration") |
|
|
|
|
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_") |
|
|
@ -179,34 +169,39 @@ macro(ocv_module_disable module) |
|
|
|
endmacro() |
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Internal macro; partly disables OpenCV module |
|
|
|
|
|
|
|
macro(__ocv_module_turn_off the_module) |
|
|
|
|
|
|
|
list(APPEND OPENCV_MODULES_DISABLED_AUTO "${the_module}") |
|
|
|
|
|
|
|
list(REMOVE_ITEM OPENCV_MODULES_BUILD "${the_module}") |
|
|
|
|
|
|
|
list(REMOVE_ITEM OPENCV_MODULES_PUBLIC "${the_module}") |
|
|
|
|
|
|
|
set(HAVE_${the_module} OFF CACHE INTERNAL "Module ${the_module} can not be built in current configuration") |
|
|
|
|
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Internal macro for dependencies tracking |
|
|
|
macro(__ocv_flatten_module_required_dependencies the_module) |
|
|
|
macro(__ocv_flatten_module_required_dependencies the_module) |
|
|
|
set(__flattened_deps "") |
|
|
|
set(__flattened_deps "") |
|
|
|
set(__resolved_deps "") |
|
|
|
set(__resolved_deps "") |
|
|
|
set(__req_depends ${OPENCV_MODULE_${the_module}_REQ_DEPS}) |
|
|
|
set(__req_depends ${OPENCV_MODULE_${the_module}_REQ_DEPS}) |
|
|
|
|
|
|
|
|
|
|
|
while(__req_depends) |
|
|
|
while(__req_depends) |
|
|
|
list(GET __req_depends 0 __dep) |
|
|
|
ocv_list_pop_front(__req_depends __dep) |
|
|
|
list(REMOVE_AT __req_depends 0) |
|
|
|
|
|
|
|
if(__dep STREQUAL the_module) |
|
|
|
if(__dep STREQUAL the_module) |
|
|
|
#TODO: think how to deal with cyclic dependency |
|
|
|
__ocv_module_turn_off(${the_module}) # TODO: think how to deal with cyclic dependency |
|
|
|
__ocv_module_turn_off(${the_module}) |
|
|
|
|
|
|
|
break() |
|
|
|
break() |
|
|
|
elseif("${OPENCV_MODULES_DISABLED_USER};${OPENCV_MODULES_DISABLED_AUTO}" MATCHES "(^|;)${__dep}(;|$)") |
|
|
|
elseif(";${OPENCV_MODULES_DISABLED_USER};${OPENCV_MODULES_DISABLED_AUTO};" MATCHES ";${__dep};") |
|
|
|
#depends on disabled module |
|
|
|
__ocv_module_turn_off(${the_module}) # depends on disabled module |
|
|
|
__ocv_module_turn_off(${the_module}) |
|
|
|
|
|
|
|
break() |
|
|
|
break() |
|
|
|
elseif("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)") |
|
|
|
elseif(";${OPENCV_MODULES_BUILD};" MATCHES ";${__dep};") |
|
|
|
if(__resolved_deps MATCHES "(^|;)${__dep}(;|$)") |
|
|
|
if(";${__resolved_deps};" MATCHES ";${__dep};") |
|
|
|
#all dependencies of this module are already resolved |
|
|
|
list(APPEND __flattened_deps "${__dep}") # all dependencies of this module are already resolved |
|
|
|
list(APPEND __flattened_deps "${__dep}") |
|
|
|
|
|
|
|
else() |
|
|
|
else() |
|
|
|
# put all required subdependencies before this dependency and mark it as resolved |
|
|
|
# put all required subdependencies before this dependency and mark it as resolved |
|
|
|
list(APPEND __resolved_deps "${__dep}") |
|
|
|
list(APPEND __resolved_deps "${__dep}") |
|
|
|
list(INSERT __req_depends 0 ${OPENCV_MODULE_${__dep}_REQ_DEPS} ${__dep}) |
|
|
|
list(INSERT __req_depends 0 ${OPENCV_MODULE_${__dep}_REQ_DEPS} ${__dep}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
elseif(__dep MATCHES "^opencv_") |
|
|
|
elseif(__dep MATCHES "^opencv_") |
|
|
|
#depends on missing module |
|
|
|
__ocv_module_turn_off(${the_module}) # depends on missing module |
|
|
|
__ocv_module_turn_off(${the_module}) |
|
|
|
message(WARNING "Unknown \"${__dep}\" module is listened in the dependencies of \"${the_module}\" module") |
|
|
|
break() |
|
|
|
break() |
|
|
|
else() |
|
|
|
else() |
|
|
|
# skip non-modules |
|
|
|
# skip non-modules |
|
|
@ -220,28 +215,23 @@ macro(__ocv_flatten_module_required_dependencies the_module) |
|
|
|
set(OPENCV_MODULE_${the_module}_DEPS "") |
|
|
|
set(OPENCV_MODULE_${the_module}_DEPS "") |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
unset(__resolved_deps) |
|
|
|
ocv_clear_vars(__resolved_deps __flattened_deps __req_depends __dep) |
|
|
|
unset(__flattened_deps) |
|
|
|
|
|
|
|
unset(__req_depends) |
|
|
|
|
|
|
|
unset(__dep) |
|
|
|
|
|
|
|
endmacro() |
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Internal macro for dependencies tracking |
|
|
|
macro(__ocv_flatten_module_optional_dependencies the_module) |
|
|
|
macro(__ocv_flatten_module_optional_dependencies the_module) |
|
|
|
set(__flattened_deps ${OPENCV_MODULE_${the_module}_DEPS}) |
|
|
|
set(__flattened_deps ${OPENCV_MODULE_${the_module}_DEPS}) |
|
|
|
set(__resolved_deps ${OPENCV_MODULE_${the_module}_DEPS}) |
|
|
|
set(__resolved_deps ${OPENCV_MODULE_${the_module}_DEPS}) |
|
|
|
set(__opt_depends ${OPENCV_MODULE_${the_module}_OPT_DEPS}) |
|
|
|
set(__opt_depends ${OPENCV_MODULE_${the_module}_OPT_DEPS}) |
|
|
|
|
|
|
|
|
|
|
|
while(__opt_depends) |
|
|
|
while(__opt_depends) |
|
|
|
list(GET __opt_depends 0 __dep) |
|
|
|
ocv_list_pop_front(__opt_depends __dep) |
|
|
|
list(REMOVE_AT __opt_depends 0) |
|
|
|
|
|
|
|
if(__dep STREQUAL the_module) |
|
|
|
if(__dep STREQUAL the_module) |
|
|
|
#TODO: think how to deal with cyclic dependency |
|
|
|
__ocv_module_turn_off(${the_module}) # TODO: think how to deal with cyclic dependency |
|
|
|
__ocv_module_turn_off(${the_module}) |
|
|
|
|
|
|
|
break() |
|
|
|
break() |
|
|
|
elseif("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)") |
|
|
|
elseif(";${OPENCV_MODULES_BUILD};" MATCHES ";${__dep};") |
|
|
|
if(__resolved_deps MATCHES "(^|;)${__dep}(;|$)") |
|
|
|
if(";${__resolved_deps};" MATCHES ";${__dep};") |
|
|
|
#all dependencies of this module are already resolved |
|
|
|
list(APPEND __flattened_deps "${__dep}") # all dependencies of this module are already resolved |
|
|
|
list(APPEND __flattened_deps "${__dep}") |
|
|
|
|
|
|
|
else() |
|
|
|
else() |
|
|
|
# put all subdependencies before this dependency and mark it as resolved |
|
|
|
# put all subdependencies before this dependency and mark it as resolved |
|
|
|
list(APPEND __resolved_deps "${__dep}") |
|
|
|
list(APPEND __resolved_deps "${__dep}") |
|
|
@ -251,6 +241,7 @@ macro(__ocv_flatten_module_optional_dependencies the_module) |
|
|
|
# skip non-modules or missing modules |
|
|
|
# skip non-modules or missing modules |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endwhile() |
|
|
|
endwhile() |
|
|
|
|
|
|
|
|
|
|
|
if(__flattened_deps) |
|
|
|
if(__flattened_deps) |
|
|
|
list(REMOVE_DUPLICATES __flattened_deps) |
|
|
|
list(REMOVE_DUPLICATES __flattened_deps) |
|
|
|
set(OPENCV_MODULE_${the_module}_DEPS ${__flattened_deps}) |
|
|
|
set(OPENCV_MODULE_${the_module}_DEPS ${__flattened_deps}) |
|
|
@ -258,10 +249,7 @@ macro(__ocv_flatten_module_optional_dependencies the_module) |
|
|
|
set(OPENCV_MODULE_${the_module}_DEPS "") |
|
|
|
set(OPENCV_MODULE_${the_module}_DEPS "") |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
unset(__resolved_deps) |
|
|
|
ocv_clear_vars(__resolved_deps __flattened_deps __opt_depends __dep) |
|
|
|
unset(__flattened_deps) |
|
|
|
|
|
|
|
unset(__opt_depends) |
|
|
|
|
|
|
|
unset(__dep) |
|
|
|
|
|
|
|
endmacro() |
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
macro(__ocv_flatten_module_dependencies) |
|
|
|
macro(__ocv_flatten_module_dependencies) |
|
|
@ -269,16 +257,16 @@ macro(__ocv_flatten_module_dependencies) |
|
|
|
set(HAVE_${m} OFF CACHE INTERNAL "Module ${m} will not be built in current configuration") |
|
|
|
set(HAVE_${m} OFF CACHE INTERNAL "Module ${m} will not be built in current configuration") |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
foreach(m ${OPENCV_MODULES_BUILD}) |
|
|
|
foreach(m ${OPENCV_MODULES_BUILD}) |
|
|
|
set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will not be built in current configuration") |
|
|
|
set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will be built in current configuration") |
|
|
|
__ocv_flatten_module_required_dependencies(${m}) |
|
|
|
__ocv_flatten_module_required_dependencies(${m}) |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
|
|
|
|
|
|
|
|
foreach(m ${OPENCV_MODULES_BUILD}) |
|
|
|
foreach(m ${OPENCV_MODULES_BUILD}) |
|
|
|
__ocv_flatten_module_optional_dependencies(${m}) |
|
|
|
__ocv_flatten_module_optional_dependencies(${m}) |
|
|
|
|
|
|
|
|
|
|
|
#dependencies from other modules |
|
|
|
# save dependencies from other modules |
|
|
|
set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module") |
|
|
|
set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module") |
|
|
|
#extra dependencies |
|
|
|
# save extra dependencies |
|
|
|
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_REQ_DEPS} ${OPENCV_MODULE_${m}_OPT_DEPS}) |
|
|
|
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) |
|
|
|
if(OPENCV_MODULE_${m}_DEPS_EXT AND OPENCV_MODULE_${m}_DEPS) |
|
|
|
list(REMOVE_ITEM OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS}) |
|
|
|
list(REMOVE_ITEM OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS}) |
|
|
@ -304,6 +292,7 @@ macro(ocv_glob_modules) |
|
|
|
set(OPENCV_INITIAL_PASS ON) |
|
|
|
set(OPENCV_INITIAL_PASS ON) |
|
|
|
foreach(__path ${ARGN}) |
|
|
|
foreach(__path ${ARGN}) |
|
|
|
ocv_get_real_path(__path "${__path}") |
|
|
|
ocv_get_real_path(__path "${__path}") |
|
|
|
|
|
|
|
|
|
|
|
list(FIND __directories_observed "${__path}" __pathIdx) |
|
|
|
list(FIND __directories_observed "${__path}" __pathIdx) |
|
|
|
if(__pathIdx GREATER -1) |
|
|
|
if(__pathIdx GREATER -1) |
|
|
|
message(FATAL_ERROR "The directory ${__path} is observed for OpenCV modules second time.") |
|
|
|
message(FATAL_ERROR "The directory ${__path} is observed for OpenCV modules second time.") |
|
|
@ -316,6 +305,7 @@ macro(ocv_glob_modules) |
|
|
|
foreach(mod ${__ocvmodules}) |
|
|
|
foreach(mod ${__ocvmodules}) |
|
|
|
ocv_get_real_path(__modpath "${__path}/${mod}") |
|
|
|
ocv_get_real_path(__modpath "${__path}/${mod}") |
|
|
|
if(EXISTS "${__modpath}/CMakeLists.txt") |
|
|
|
if(EXISTS "${__modpath}/CMakeLists.txt") |
|
|
|
|
|
|
|
|
|
|
|
list(FIND __directories_observed "${__modpath}" __pathIdx) |
|
|
|
list(FIND __directories_observed "${__modpath}" __pathIdx) |
|
|
|
if(__pathIdx GREATER -1) |
|
|
|
if(__pathIdx GREATER -1) |
|
|
|
message(FATAL_ERROR "The module from ${__modpath} is already loaded.") |
|
|
|
message(FATAL_ERROR "The module from ${__modpath} is already loaded.") |
|
|
@ -327,11 +317,7 @@ macro(ocv_glob_modules) |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
unset(__ocvmodules) |
|
|
|
ocv_clear_vars(__ocvmodules __directories_observed __path __modpath __pathIdx) |
|
|
|
unset(__directories_observed) |
|
|
|
|
|
|
|
unset(__path) |
|
|
|
|
|
|
|
unset(__modpath) |
|
|
|
|
|
|
|
unset(__pathIdx) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# resolve dependencies |
|
|
|
# resolve dependencies |
|
|
|
__ocv_flatten_module_dependencies() |
|
|
|
__ocv_flatten_module_dependencies() |
|
|
@ -417,7 +403,7 @@ macro(ocv_set_module_sources) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# use full paths for module to be independent from the module location |
|
|
|
# use full paths for module to be independent from the module location |
|
|
|
ocv_to_full_paths(OPENCV_MODULE_${the_module}_HEADERS) |
|
|
|
ocv_convert_to_full_paths(OPENCV_MODULE_${the_module}_HEADERS) |
|
|
|
|
|
|
|
|
|
|
|
set(OPENCV_MODULE_${the_module}_HEADERS ${OPENCV_MODULE_${the_module}_HEADERS} CACHE INTERNAL "List of header files for ${the_module}") |
|
|
|
set(OPENCV_MODULE_${the_module}_HEADERS ${OPENCV_MODULE_${the_module}_HEADERS} CACHE INTERNAL "List of header files for ${the_module}") |
|
|
|
set(OPENCV_MODULE_${the_module}_SOURCES ${OPENCV_MODULE_${the_module}_SOURCES} CACHE INTERNAL "List of source files for ${the_module}") |
|
|
|
set(OPENCV_MODULE_${the_module}_SOURCES ${OPENCV_MODULE_${the_module}_SOURCES} CACHE INTERNAL "List of source files for ${the_module}") |
|
|
@ -446,9 +432,11 @@ endmacro() |
|
|
|
# ocv_create_module(SKIP_LINK) |
|
|
|
# ocv_create_module(SKIP_LINK) |
|
|
|
macro(ocv_create_module) |
|
|
|
macro(ocv_create_module) |
|
|
|
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES}) |
|
|
|
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES}) |
|
|
|
|
|
|
|
|
|
|
|
if(NOT "${ARGN}" STREQUAL "SKIP_LINK") |
|
|
|
if(NOT "${ARGN}" STREQUAL "SKIP_LINK") |
|
|
|
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) |
|
|
|
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
add_dependencies(opencv_modules ${the_module}) |
|
|
|
add_dependencies(opencv_modules ${the_module}) |
|
|
|
|
|
|
|
|
|
|
|
if(ENABLE_SOLUTION_FOLDERS) |
|
|
|
if(ENABLE_SOLUTION_FOLDERS) |
|
|
@ -495,7 +483,7 @@ macro(ocv_create_module) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# only "public" headers need to be installed |
|
|
|
# only "public" headers need to be installed |
|
|
|
if(OPENCV_MODULE_${the_module}_HEADERS AND OPENCV_MODULES_PUBLIC MATCHES "(^|;)${the_module}(;|$)") |
|
|
|
if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};") |
|
|
|
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS}) |
|
|
|
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS}) |
|
|
|
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}") |
|
|
|
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}") |
|
|
|
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$") |
|
|
|
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$") |
|
|
@ -519,21 +507,8 @@ macro(ocv_add_precompiled_headers the_target) |
|
|
|
else() |
|
|
|
else() |
|
|
|
SET(pch_path "src/") |
|
|
|
SET(pch_path "src/") |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
set(pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.hpp") |
|
|
|
ocv_add_precompiled_header_to_target(${the_target} "${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|Ninja") |
|
|
|
|
|
|
|
add_precompiled_header(${the_target} ${pch_header}) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
unset(pch_header) |
|
|
|
|
|
|
|
unset(pch_path) |
|
|
|
unset(pch_path) |
|
|
|
unset(${the_target}_pch) |
|
|
|
|
|
|
|
endmacro() |
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
# short command for adding simple OpenCV module |
|
|
|
# short command for adding simple OpenCV module |
|
|
@ -593,7 +568,7 @@ endmacro() |
|
|
|
|
|
|
|
|
|
|
|
# this is a command for adding OpenCV performance tests to the module |
|
|
|
# this is a command for adding OpenCV performance tests to the module |
|
|
|
# ocv_add_perf_tests(<extra_dependencies>) |
|
|
|
# ocv_add_perf_tests(<extra_dependencies>) |
|
|
|
macro(ocv_add_perf_tests) |
|
|
|
function(ocv_add_perf_tests) |
|
|
|
set(perf_path "${CMAKE_CURRENT_SOURCE_DIR}/perf") |
|
|
|
set(perf_path "${CMAKE_CURRENT_SOURCE_DIR}/perf") |
|
|
|
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}") |
|
|
|
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}") |
|
|
|
__ocv_parse_test_sources(PERF ${ARGN}) |
|
|
|
__ocv_parse_test_sources(PERF ${ARGN}) |
|
|
@ -639,11 +614,11 @@ macro(ocv_add_perf_tests) |
|
|
|
# TODO: warn about unsatisfied dependencies |
|
|
|
# TODO: warn about unsatisfied dependencies |
|
|
|
endif(OCV_DEPENDENCIES_FOUND) |
|
|
|
endif(OCV_DEPENDENCIES_FOUND) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endmacro() |
|
|
|
endfunction() |
|
|
|
|
|
|
|
|
|
|
|
# this is a command for adding OpenCV accuracy/regression tests to the module |
|
|
|
# this is a command for adding OpenCV accuracy/regression tests to the module |
|
|
|
# ocv_add_accuracy_tests([FILES <source group name> <list of sources>] [DEPENDS_ON] <list of extra dependencies>) |
|
|
|
# ocv_add_accuracy_tests([FILES <source group name> <list of sources>] [DEPENDS_ON] <list of extra dependencies>) |
|
|
|
macro(ocv_add_accuracy_tests) |
|
|
|
function(ocv_add_accuracy_tests) |
|
|
|
set(test_path "${CMAKE_CURRENT_SOURCE_DIR}/test") |
|
|
|
set(test_path "${CMAKE_CURRENT_SOURCE_DIR}/test") |
|
|
|
ocv_check_dependencies(${test_deps}) |
|
|
|
ocv_check_dependencies(${test_deps}) |
|
|
|
if(BUILD_TESTS AND EXISTS "${test_path}") |
|
|
|
if(BUILD_TESTS AND EXISTS "${test_path}") |
|
|
@ -690,9 +665,9 @@ macro(ocv_add_accuracy_tests) |
|
|
|
# TODO: warn about unsatisfied dependencies |
|
|
|
# TODO: warn about unsatisfied dependencies |
|
|
|
endif(OCV_DEPENDENCIES_FOUND) |
|
|
|
endif(OCV_DEPENDENCIES_FOUND) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endmacro() |
|
|
|
endfunction() |
|
|
|
|
|
|
|
|
|
|
|
# internal macro; finds all link dependencies of module |
|
|
|
# internal macro; finds all link dependencies of the module |
|
|
|
# should be used at the end of CMake processing |
|
|
|
# should be used at the end of CMake processing |
|
|
|
macro(__ocv_track_module_link_dependencies the_module optkind) |
|
|
|
macro(__ocv_track_module_link_dependencies the_module optkind) |
|
|
|
set(${the_module}_MODULE_DEPS_${optkind} "") |
|
|
|
set(${the_module}_MODULE_DEPS_${optkind} "") |
|
|
|