aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/main.py
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2022-03-23 09:33:22 +0100
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2022-04-11 10:50:27 +0200
commita88f7b21c61e4aa9efcfb81d7939e44b06df3a0d (patch)
treee0b9f6fd7b6f4cca40aab7f241d9ae4a16d2cca4 /build_scripts/main.py
parent1049b1ed57e3ec591ddb5ebda1b501a102f95019 (diff)
PySide6: Optimize for Size
build: use the following flag with setup.py to turn off size optimization --no-size-optimization Added the following compiler optimization flags and their corresponding flags on other platforms GCC - -ffunction-sections -fdata-section which segretates data and function section and linker flag --gc-section which removes unused code. - -fno-exceptions to disable exception handling - -Os - Optimize for size. Basically same as -O2 but removes some flags that cause increase in size. (Ran a couple of example and did not see difference in execution time) MSVC - /Gy /Gw /OPT:REF - same as -ffunction-sections, -fdata-section, -Wl, --gc-section - /EHsc same as -fno-exceptions - /O1 instead of /Os because for MSVC /O1 gave the best results. Clang - Same as GCC except for using -Oz instead of -Os. Experiments: Built a wheel with QtCore and noticed a 300kb reduction in size on both Windows and Linux. Built a complete wheel(except QTest) and it gives me a 4 mb size reduction with unaffected performance. Task-number: PYSIDE-1860 Change-Id: Ia5dfa2c4bfde92994c939b5fac0d0831fa3a73ab Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'build_scripts/main.py')
-rw-r--r--build_scripts/main.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index d44fa2f76..3f8ebd4d7 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -667,6 +667,9 @@ class PysideBuild(_build, DistUtilsCommandMixin, BuildInfoCollectorMixin):
else:
if OPTION['NO_STRIP']:
cmake_cmd.append("-DQFP_NO_STRIP=1")
+ if OPTION['NO_OVERRIDE_OPTIMIZATION_FLAGS']:
+ cmake_cmd.append("-DQFP_NO_OVERRIDE_OPTIMIZATION_FLAGS=1")
+
if OPTION["LIMITED_API"] == "yes":
cmake_cmd.append("-DFORCE_LIMITED_API=yes")
elif OPTION["LIMITED_API"] == "no":