mirror of
git://code.qt.io/qt/qt5.git
synced 2025-12-21 15:38:15 +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:
@@ -247,12 +247,29 @@ function(qt_ir_get_raw_args_from_optfile optfile_path out_var)
|
||||
set(${out_var} "${args}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Reads the optfile_path, iterates over the given command line arguments,
|
||||
# sets the input for recongized options.
|
||||
#
|
||||
# IGNORE_UNKNOWN_ARGS tells the function not to fail if it encounters an unknown
|
||||
# option, needed when the script is called from the configure script with
|
||||
# configure-only-known options.
|
||||
# Reads the optfile_path, iterates over the given command line arguments,
|
||||
# sets the input for recongized options.
|
||||
#
|
||||
# Handles the following styles of CLI arguments:
|
||||
# --no-foo / --disable-foo
|
||||
# -no-foo / -disable-foo
|
||||
# --foo=<values>
|
||||
# --foo <values>
|
||||
# -foo <values>
|
||||
# --foo
|
||||
# -foo
|
||||
# --f
|
||||
# -f
|
||||
#
|
||||
# Currently handles the following types of CLI arguments:
|
||||
# string
|
||||
# boolean
|
||||
# void
|
||||
#
|
||||
# IGNORE_UNKNOWN_ARGS tells the function not to fail if it encounters an unknown
|
||||
# option, and instead append it to a global list of unknown options.
|
||||
# It is needed when the script is called from the configure script with
|
||||
# configure-only-known options.
|
||||
function(qt_ir_process_args_from_optfile optfile_path)
|
||||
set(options IGNORE_UNKNOWN_ARGS)
|
||||
set(oneValueArgs "")
|
||||
@@ -286,7 +303,13 @@ function(qt_ir_process_args_from_optfile optfile_path)
|
||||
set(opt "${CMAKE_MATCH_1}")
|
||||
unset(val)
|
||||
else()
|
||||
qt_ir_add_error("Invalid command line parameter '${arg}'.")
|
||||
if(NOT arg_IGNORE_UNKNOWN_ARGS)
|
||||
qt_ir_add_error("Invalid command line parameter '${arg}'.")
|
||||
else()
|
||||
message(DEBUG "Unknown command line parameter '${arg}'. Collecting.")
|
||||
qt_ir_append_unknown_args("${arg}")
|
||||
continue()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(type "${commandline_option_${opt}_type}")
|
||||
@@ -295,7 +318,8 @@ function(qt_ir_process_args_from_optfile optfile_path)
|
||||
if(NOT arg_IGNORE_UNKNOWN_ARGS)
|
||||
qt_ir_add_error("Unknown command line option '${arg}'.")
|
||||
else()
|
||||
message(DEBUG "Unknown command line option '${arg}'. Ignoring.")
|
||||
message(DEBUG "Unknown command line option '${arg}'. Collecting.")
|
||||
qt_ir_append_unknown_args("${arg}")
|
||||
continue()
|
||||
endif()
|
||||
endif()
|
||||
@@ -332,6 +356,17 @@ function(qt_ir_set_unhandled_args args)
|
||||
set_property(GLOBAL PROPERTY _qt_ir_unhandled_args "${args}")
|
||||
endfunction()
|
||||
|
||||
# Adds to the unknown command line args.
|
||||
function(qt_ir_append_unknown_args args)
|
||||
set_property(GLOBAL APPEND PROPERTY _qt_ir_unknown_args ${args})
|
||||
endfunction()
|
||||
|
||||
# Gets the unhandled command line args.
|
||||
function(qt_ir_get_unknown_args out_var)
|
||||
get_property(args GLOBAL PROPERTY _qt_ir_unknown_args)
|
||||
set(${out_var} "${args}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Gets the unsupported options that init-repository.pl supports, but the cmake port does
|
||||
# not support.
|
||||
function(qt_ir_get_unsupported_options out_var)
|
||||
|
||||
Reference in New Issue
Block a user