aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-12-14 15:48:31 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-12-19 17:03:39 +0100
commit277783b47e704505f19d00dd80f26239082974d6 (patch)
treeae76de453059f7f1120e72a6d56b3482af9bf27e /build_scripts
parent6ada63dabf63c41b067d06bba4090fc8694c7793 (diff)
Build system: Add an option to enable CMake UNITY_BUILD (jumbo) builds
[ChangeLog] An option --unity has been added to setup.py enabling enabling CMake UNITY_BUILD (jumbo) builds, which speeds up building. Fixes: PYSIDE-2155 Change-Id: I235a18335d6070bc3eb4ea7f9953925f6d9e174c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'build_scripts')
-rw-r--r--build_scripts/main.py6
-rw-r--r--build_scripts/options.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index 788a24335..f7b34bf45 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -581,6 +581,12 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin):
# Doesn't seem to work if set within the cmake files themselves.
cmake_cmd.append('-DCMAKE_RULE_MESSAGES=0')
+ if OPTION["UNITY"]:
+ cmake_cmd.append("-DCMAKE_UNITY_BUILD=ON")
+ batch_size = OPTION["UNITY_BUILD_BATCH_SIZE"]
+ cmake_cmd.append(f"-DCMAKE_UNITY_BUILD_BATCH_SIZE={batch_size}")
+ log.info("Using UNITY build")
+
cmake_cmd += [
"-G", self.make_generator,
f"-DBUILD_TESTS={self.build_tests}",
diff --git a/build_scripts/options.py b/build_scripts/options.py
index e3d713d16..66a47d916 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -217,6 +217,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-build-batch-size=', None, 'Value of CMAKE_UNITY_BUILD_BATCH_SIZE')
]
def __init__(self):
@@ -275,6 +277,8 @@ class CommandMixin(object):
self.plat_name = None
self.internal_cmake_install_dir_query_file_path = None
self._per_command_mixin_options_finalized = False
+ self.unity = False
+ self.unity_build_batch_size = "16"
# When initializing a command other than the main one (so the
# first one), we need to copy the user options from the main
@@ -353,6 +357,8 @@ 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
+ OPTION['UNITY_BUILD_BATCH_SIZE'] = self.unity_build_batch_size
qtpaths_abs_path = None
if self.qtpaths: