diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-01-30 08:13:20 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-01-30 13:37:44 +0100 |
| commit | e57c5d0adb446c38dccbe9e7e9003e89a33b4c55 (patch) | |
| tree | 15e1b750e344848e156607fd629bd07478bca6dd | |
| parent | 75981c3a753e6a0991d7bedbc130cd6e34e7b61a (diff) | |
Make Unity builds default
[ChangeLog][PySide6] setup.py now uses CMake Unity Build Mode by
default.
Change-Id: I50c892646c73ac636276460b0a1efa558531c76d
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
| -rw-r--r-- | build_scripts/options.py | 9 | ||||
| -rw-r--r-- | build_scripts/qfp_tool.py | 17 | ||||
| -rw-r--r-- | sources/pyside6/doc/gettingstarted/index.rst | 4 |
3 files changed, 17 insertions, 13 deletions
diff --git a/build_scripts/options.py b/build_scripts/options.py index e6b43d4df..14c176486 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -245,7 +245,8 @@ class CommandMixin(object): # We redeclare plat-name as an option so it's recognized by the # install command and doesn't throw an error. ('plat-name=', None, 'The platform name for which we are cross-compiling'), - ('unity', None, 'Use CMake UNITY_BUILD_MODE'), + ('unity', None, 'Use CMake UNITY_BUILD_MODE (obsolete)'), + ('no-unity', None, 'Disable CMake UNITY_BUILD_MODE'), ('unity-build-batch-size=', None, 'Value of CMAKE_UNITY_BUILD_BATCH_SIZE') ] @@ -306,6 +307,7 @@ class CommandMixin(object): self.internal_cmake_install_dir_query_file_path = None self._per_command_mixin_options_finalized = False self.unity = False + self.no_unity = False self.unity_build_batch_size = "16" # When initializing a command other than the main one (so the @@ -422,7 +424,10 @@ class CommandMixin(object): OPTION['SANITIZE_ADDRESS'] = self.sanitize_address OPTION['SHORTER_PATHS'] = self.shorter_paths OPTION['DOC_BUILD_ONLINE'] = self.doc_build_online - OPTION['UNITY'] = self.unity + if self.unity: + log.warn("Using --unity no longer has any effect, " + "Unity build mode is now the default.") + OPTION['UNITY'] = not self.no_unity OPTION['UNITY_BUILD_BATCH_SIZE'] = self.unity_build_batch_size qtpaths_abs_path = None diff --git a/build_scripts/qfp_tool.py b/build_scripts/qfp_tool.py index 28dbad765..f370dc982 100644 --- a/build_scripts/qfp_tool.py +++ b/build_scripts/qfp_tool.py @@ -64,10 +64,9 @@ class UnityMode(Enum): DISABLE = auto() -UNITY_OPTION = "--unity" +DISABLE_UNITY_OPTION = "--no-unity" LOG_LEVEL_OPTION = "--log-level" -DEFAULT_BUILD_ARGS = ['--build-tests', '--skip-docs', LOG_LEVEL_OPTION, "quiet", - UNITY_OPTION] +DEFAULT_BUILD_ARGS = ['--build-tests', '--skip-docs', LOG_LEVEL_OPTION, "quiet"] IS_WINDOWS = sys.platform == 'win32' INCREDIBUILD_CONSOLE = 'BuildConsole' if IS_WINDOWS else '/opt/incredibuild/bin/ib_console' # Config file keys @@ -300,11 +299,11 @@ def build(target: str): del build_arguments[i] arguments.extend(build_arguments) if opt_unity_mode != UnityMode.DEFAULT: - has_unity = UNITY_OPTION in build_arguments - if opt_unity_mode == UnityMode.ENABLE and not has_unity: - arguments.append(UNITY_OPTION) - elif opt_unity_mode == UnityMode.DISABLE and has_unity: - arguments.remove(UNITY_OPTION) + unity_disabled = DISABLE_UNITY_OPTION in build_arguments + if opt_unity_mode == UnityMode.ENABLE and unity_disabled: + arguments.remove(DISABLE_UNITY_OPTION) + elif opt_unity_mode == UnityMode.DISABLE and not unity_disabled: + arguments.append(DISABLE_UNITY_OPTION) generator = read_config(GENERATOR_KEY) if generator != 'Ninja': arguments.extend(['--make-spec', 'ninja']) @@ -312,7 +311,7 @@ def build(target: str): if jobs > 1: arguments.extend(['-j', str(jobs)]) if build_mode != BuildMode.BUILD: - arguments.extend(['--reuse-build', '--ignore-git']) + arguments.append('--reuse-build') if build_mode != BuildMode.RECONFIGURE: arguments.append('--skip-cmake') modules = read_config_modules_argument() diff --git a/sources/pyside6/doc/gettingstarted/index.rst b/sources/pyside6/doc/gettingstarted/index.rst index 71c27686d..0ea47dc65 100644 --- a/sources/pyside6/doc/gettingstarted/index.rst +++ b/sources/pyside6/doc/gettingstarted/index.rst @@ -104,9 +104,9 @@ using **ninja** (instead of make), and considering only the **module subset** of :mod:`QtCore <PySide6.QtCore>`, :mod:`QtGui <PySide6.QtGui>`, and :mod:`QtWidgets <PySide6.QtWidgets>`. +`CMake Unity Build Mode`_ is used by default for speed-up. + Other important options to consider are: - * ``--unity``, Activates `CMake Unity Build Mode`_, which speeds up the - build by concatenating source files, * ``--cmake``, to specify the path to the cmake binary, * ``--reuse-build``, to rebuild only the modified files, * ``--openssl=/path/to/openssl/bin``, to use a different path for OpenSSL, |
