aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/cmake/PySideSetup.cmake
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 /sources/pyside6/cmake/PySideSetup.cmake
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 'sources/pyside6/cmake/PySideSetup.cmake')
-rw-r--r--sources/pyside6/cmake/PySideSetup.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/sources/pyside6/cmake/PySideSetup.cmake b/sources/pyside6/cmake/PySideSetup.cmake
index 08072ac02..a167f4ddd 100644
--- a/sources/pyside6/cmake/PySideSetup.cmake
+++ b/sources/pyside6/cmake/PySideSetup.cmake
@@ -12,6 +12,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Macros")
include(ShibokenHelpers)
include(PySideHelpers)
+#does nothing if QFP_NO_OVERRIDE_OPTIMIZATION_FLAGS (no-size-optimization) flag is not set
+override_release_flags_for_size_optimization()
+
# Don't display "up-to-date / install" messages when installing, to reduce visual clutter.
if(QUIET_BUILD)
set(CMAKE_INSTALL_MESSAGE NEVER)