mirror of
git://code.qt.io/qt/qt5.git
synced 2026-01-07 23:46:51 +08:00
CMake: Integrate init-repository with the configure script
Calling configure will now implicitly run init-repository when appropriate. See further down below for what "appropriate" means. All supported init-repository options can be passed to configure as except for -mirror, -oslo, -berlin. This includes useful options like -submodules, -no-resolve-deps and -no-optional-deps. When running configure on a qt5.git clone without any submodules cloned, configure will exit with a helpful error message suggesting to pass -init-submodules, so it automatically clones missing repositories. This means cloning is opt-in, so that internet access is not done implicitly. The error message also suggests passing the -submodules option. This will affect which submodules will be cloned by init-repository and which submodules will be configured by configure. In this case -submodules is effectively an alias of init-repository's -module-subset for cloning purposes. When calling configure a second time, without -init-submodules, on an already configured repo, init-repository behavior is entirely skipped. -submodules now accepts init-repository-style special values like "essential", "addon", "all", "existing", "-deprecated" for the purpose of cloning submodules. The values are then translated into actual repos that should also be configured or skipped by configure. The default subset of cloned submodules is currently the same one as init-repository, "default", which clones 44 actively maintained repositories as well as deprecated submodules. If configure is called a second time WITH -init-submodules, it's the same as calling init-repository --force to re-initialize submodules. In this case passing something like --submodules existing,<additional-submodules> might make sense to add or remove submodules. As a drive-by this also fixes the bug where you couldn't pass a configure -- -DFOO=0 parameter to configure, because it got treated as '0>', redirecting from a different stream than stdout, leading to empty content in the file. [ChangeLog][General][Build System] The configure script now implicitly calls init-repository when appropriate and accepts init-repository command line options. Fixes: QTBUG-120030 Task-number: QTBUG-122622 Change-Id: Iedbfcbf0a87c8ee89e40d00b6377b68296a65a62 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
@@ -1,6 +1,58 @@
|
||||
# Copyright (C) 2024 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
macro(qt_tl_include_all_helpers)
|
||||
include(QtIRHelpers)
|
||||
qt_ir_include_all_helpers()
|
||||
endmacro()
|
||||
|
||||
function(qt_tl_run_toplevel_configure top_level_src_path)
|
||||
# Filter out init-repository specific arguments before passing them to
|
||||
# configure.
|
||||
qt_ir_get_args_from_optfile_configure_filtered("${OPTFILE}" configure_args)
|
||||
|
||||
# Get the path to the qtbase configure script.
|
||||
set(qtbase_dir_name "qtbase")
|
||||
set(configure_path "${top_level_src_path}/${qtbase_dir_name}/configure")
|
||||
if(CMAKE_HOST_WIN32)
|
||||
string(APPEND configure_path ".bat")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${configure_path}")
|
||||
message(FATAL_ERROR
|
||||
"The required qtbase/configure script was not found: ${configure_path}\n"
|
||||
"Try re-running configure with --init-submodules")
|
||||
endif()
|
||||
|
||||
# Make a build directory for qtbase in the current build directory.
|
||||
set(qtbase_build_dir "${CMAKE_CURRENT_BINARY_DIR}/${qtbase_dir_name}")
|
||||
file(MAKE_DIRECTORY "${qtbase_build_dir}")
|
||||
|
||||
qt_ir_execute_process_and_log_and_handle_error(
|
||||
COMMAND_ARGS "${configure_path}" -top-level ${configure_args}
|
||||
WORKING_DIRECTORY "${qtbase_build_dir}"
|
||||
FORCE_VERBOSE
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(qt_tl_run_main_script)
|
||||
if(NOT TOP_LEVEL_SRC_PATH)
|
||||
message(FATAL_ERROR "Assertion: configure TOP_LEVEL_SRC_PATH is not set")
|
||||
endif()
|
||||
|
||||
# Tell init-repository it is called from configure.
|
||||
qt_ir_set_option_value(from-configure TRUE)
|
||||
|
||||
# Run init-repository in-process.
|
||||
qt_ir_run_main_script("${TOP_LEVEL_SRC_PATH}" exit_reason)
|
||||
if(exit_reason AND NOT exit_reason STREQUAL "ALREADY_INITIALIZED")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Then run configure out-of-process.
|
||||
qt_tl_run_toplevel_configure("${TOP_LEVEL_SRC_PATH}")
|
||||
endfunction()
|
||||
|
||||
# Populates $out_module_list with all subdirectories that have a CMakeLists.txt file
|
||||
function(qt_internal_find_modules out_module_list)
|
||||
set(module_list "")
|
||||
|
||||
Reference in New Issue
Block a user