mirror of https://github.com/qt/qt5.git
Avoid collecting dependencies from modules that were explicitly skipped
If either -skip <module> or BUILD_<module>=OFF is set from command line we should avoid processing the module dependencies and exclude it from the list of modules that needs to be build. Pick-to: 6.7 Change-Id: Ieec8db085221cc4abd5d8ac83c06ecce25d5d4b0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
d77a38f2aa
commit
13a7e25f5d
|
@ -29,16 +29,26 @@ include(ECMOptionalAddSubdirectory)
|
||||||
|
|
||||||
qt_internal_top_level_before_build_submodules()
|
qt_internal_top_level_before_build_submodules()
|
||||||
|
|
||||||
|
qt_internal_find_modules(known_submodules)
|
||||||
# Get submodule list if not already defined
|
# Get submodule list if not already defined
|
||||||
if(NOT QT_BUILD_SUBMODULES)
|
if(NOT QT_BUILD_SUBMODULES)
|
||||||
if(DEFINED ENV{QT_BUILD_SUBMODULES})
|
if(DEFINED ENV{QT_BUILD_SUBMODULES})
|
||||||
set(QT_BUILD_SUBMODULES "$ENV{QT_BUILD_SUBMODULES}")
|
set(QT_BUILD_SUBMODULES "$ENV{QT_BUILD_SUBMODULES}")
|
||||||
else()
|
else()
|
||||||
qt_internal_find_modules(QT_BUILD_SUBMODULES)
|
set(QT_BUILD_SUBMODULES "${known_submodules}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
set(QT_BUILD_SUBMODULES "${QT_BUILD_SUBMODULES}" CACHE STRING "Submodules to build")
|
set(QT_BUILD_SUBMODULES "${QT_BUILD_SUBMODULES}" CACHE STRING "Submodules to build")
|
||||||
|
|
||||||
|
# Preliminary check if module should be skipped since -skip <module> or BUILD_<module>
|
||||||
|
# are provided.
|
||||||
|
set(explicitly_skipped_modules "")
|
||||||
|
foreach(module IN LISTS known_submodules)
|
||||||
|
if(DEFINED BUILD_${module} AND NOT BUILD_${module})
|
||||||
|
list(APPEND explicitly_skipped_modules ${module})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
||||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${module}/CMakeLists.txt)
|
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${module}/CMakeLists.txt)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
|
@ -49,7 +59,8 @@ foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES)
|
qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES
|
||||||
|
SKIP_MODULES ${explicitly_skipped_modules})
|
||||||
|
|
||||||
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
||||||
# Check for unmet dependencies
|
# Check for unmet dependencies
|
||||||
|
|
|
@ -184,11 +184,13 @@ endfunction()
|
||||||
#
|
#
|
||||||
# NORMALIZE_REPO_NAME_IF_NEEDED Will remove 'tqtc-' from the beginning of submodule dependencies
|
# NORMALIZE_REPO_NAME_IF_NEEDED Will remove 'tqtc-' from the beginning of submodule dependencies
|
||||||
# if a tqtc- named directory does not exist.
|
# if a tqtc- named directory does not exist.
|
||||||
|
#
|
||||||
|
# SKIP_MODULES Modules that should be skipped from evaluation completely.
|
||||||
function(qt_internal_resolve_module_dependencies module out_ordered out_revisions)
|
function(qt_internal_resolve_module_dependencies module out_ordered out_revisions)
|
||||||
set(options IN_RECURSION NORMALIZE_REPO_NAME_IF_NEEDED PARSE_GITMODULES
|
set(options IN_RECURSION NORMALIZE_REPO_NAME_IF_NEEDED PARSE_GITMODULES
|
||||||
EXCLUDE_OPTIONAL_DEPS)
|
EXCLUDE_OPTIONAL_DEPS)
|
||||||
set(oneValueArgs REVISION SKIPPED_VAR GITMODULES_PREFIX_VAR)
|
set(oneValueArgs REVISION SKIPPED_VAR GITMODULES_PREFIX_VAR)
|
||||||
set(multiValueArgs PARSED_DEPENDENCIES)
|
set(multiValueArgs PARSED_DEPENDENCIES SKIP_MODULES)
|
||||||
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
# Clear the property that stores the repositories we've already seen.
|
# Clear the property that stores the repositories we've already seen.
|
||||||
|
@ -196,10 +198,10 @@ function(qt_internal_resolve_module_dependencies module out_ordered out_revision
|
||||||
set_property(GLOBAL PROPERTY _qt_internal_seen_repos)
|
set_property(GLOBAL PROPERTY _qt_internal_seen_repos)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Bail out if we've seen the module already.
|
# Bail out if we've seen the module already or it was skipped explicitly from command line.
|
||||||
qt_internal_resolve_module_dependencies_set_skipped(FALSE)
|
qt_internal_resolve_module_dependencies_set_skipped(FALSE)
|
||||||
get_property(seen GLOBAL PROPERTY _qt_internal_seen_repos)
|
get_property(seen GLOBAL PROPERTY _qt_internal_seen_repos)
|
||||||
if(module IN_LIST seen)
|
if(module IN_LIST seen OR module IN_LIST arg_SKIP_MODULES)
|
||||||
qt_internal_resolve_module_dependencies_set_skipped(TRUE)
|
qt_internal_resolve_module_dependencies_set_skipped(TRUE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
@ -287,6 +289,11 @@ function(qt_internal_resolve_module_dependencies module out_ordered out_revision
|
||||||
set(exclude_optional_deps "EXCLUDE_OPTIONAL_DEPS")
|
set(exclude_optional_deps "EXCLUDE_OPTIONAL_DEPS")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(extra_options "")
|
||||||
|
if(arg_SKIP_MODULES)
|
||||||
|
list(extra_options APPEND SKIP_MODULES ${arg_SKIP_MODULES})
|
||||||
|
endif()
|
||||||
|
|
||||||
qt_internal_resolve_module_dependencies(${dependency} dep_ordered dep_revisions
|
qt_internal_resolve_module_dependencies(${dependency} dep_ordered dep_revisions
|
||||||
REVISION "${revision}"
|
REVISION "${revision}"
|
||||||
SKIPPED_VAR skipped
|
SKIPPED_VAR skipped
|
||||||
|
@ -295,6 +302,7 @@ function(qt_internal_resolve_module_dependencies module out_ordered out_revision
|
||||||
${parse_gitmodules}
|
${parse_gitmodules}
|
||||||
${exclude_optional_deps}
|
${exclude_optional_deps}
|
||||||
GITMODULES_PREFIX_VAR ${arg_GITMODULES_PREFIX_VAR}
|
GITMODULES_PREFIX_VAR ${arg_GITMODULES_PREFIX_VAR}
|
||||||
|
${extra_options}
|
||||||
)
|
)
|
||||||
if(NOT skipped)
|
if(NOT skipped)
|
||||||
list(APPEND ordered ${dep_ordered})
|
list(APPEND ordered ${dep_ordered})
|
||||||
|
@ -321,11 +329,13 @@ endfunction()
|
||||||
# EXCLUDE_OPTIONAL_DEPS is a keyword argument that excludes optional dependencies from the result.
|
# EXCLUDE_OPTIONAL_DEPS is a keyword argument that excludes optional dependencies from the result.
|
||||||
# See qt_internal_resolve_module_dependencies for details.
|
# See qt_internal_resolve_module_dependencies for details.
|
||||||
#
|
#
|
||||||
|
# SKIP_MODULES Modules that should be skipped from evaluation completely.
|
||||||
|
#
|
||||||
# See qt_internal_resolve_module_dependencies for side effects.
|
# See qt_internal_resolve_module_dependencies for side effects.
|
||||||
function(qt_internal_sort_module_dependencies modules out_all_ordered)
|
function(qt_internal_sort_module_dependencies modules out_all_ordered)
|
||||||
set(options PARSE_GITMODULES EXCLUDE_OPTIONAL_DEPS)
|
set(options PARSE_GITMODULES EXCLUDE_OPTIONAL_DEPS)
|
||||||
set(oneValueArgs GITMODULES_PREFIX_VAR)
|
set(oneValueArgs GITMODULES_PREFIX_VAR)
|
||||||
set(multiValueArgs "")
|
set(multiValueArgs SKIP_MODULES)
|
||||||
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
set(parse_gitmodules "")
|
set(parse_gitmodules "")
|
||||||
|
@ -345,12 +355,18 @@ function(qt_internal_sort_module_dependencies modules out_all_ordered)
|
||||||
list(APPEND all_selected_repos_as_parsed_dependencies "${module}/HEAD/FALSE")
|
list(APPEND all_selected_repos_as_parsed_dependencies "${module}/HEAD/FALSE")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
set(extra_args "")
|
||||||
|
if(arg_SKIP_MODULES)
|
||||||
|
set(extra_args SKIP_MODULES ${arg_SKIP_MODULES})
|
||||||
|
endif()
|
||||||
|
|
||||||
qt_internal_resolve_module_dependencies(all_selected_repos ordered unused_revisions
|
qt_internal_resolve_module_dependencies(all_selected_repos ordered unused_revisions
|
||||||
PARSED_DEPENDENCIES ${all_selected_repos_as_parsed_dependencies}
|
PARSED_DEPENDENCIES ${all_selected_repos_as_parsed_dependencies}
|
||||||
NORMALIZE_REPO_NAME_IF_NEEDED
|
NORMALIZE_REPO_NAME_IF_NEEDED
|
||||||
${exclude_optional_deps}
|
${exclude_optional_deps}
|
||||||
${parse_gitmodules}
|
${parse_gitmodules}
|
||||||
GITMODULES_PREFIX_VAR ${arg_GITMODULES_PREFIX_VAR}
|
GITMODULES_PREFIX_VAR ${arg_GITMODULES_PREFIX_VAR}
|
||||||
|
${extra_args}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Drop "all_selected_repos" from the output. It depends on all selected repos, thus it must be
|
# Drop "all_selected_repos" from the output. It depends on all selected repos, thus it must be
|
||||||
|
|
Loading…
Reference in New Issue