summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuhang Zhao <zhaoyuhang@rankyee.com>2023-05-23 15:59:24 +0800
committerYuhang Zhao <yuhangzhao@deepin.org>2023-05-29 05:57:08 +0000
commit51becfbd234d9152726446af0e3718644fcf00df (patch)
tree70671d635cc8fa166cea43f7fc3b3a988870e300
parent44cfdfa7c07a4f1aa1e5b6a384418556e6b3028e (diff)
CMake: use VS2019's flag for stronger inlining
Use the new "/Ob3" flag introduced in VS2019 to increase the inline level, which may give better performance. For compilers older than VS2019, we still use the traditional "/Ob2" inline level. Official documentation: https://learn.microsoft.com/en-us/cpp/build/reference/ob-inline-function-expansion?view=msvc-170 Change-Id: I34a50f27a151cb7c09f0085dd037a385c71848aa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--cmake/QtCompilerOptimization.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmake/QtCompilerOptimization.cmake b/cmake/QtCompilerOptimization.cmake
index a093ed4dce..e1d363afab 100644
--- a/cmake/QtCompilerOptimization.cmake
+++ b/cmake/QtCompilerOptimization.cmake
@@ -92,10 +92,10 @@ endif()
# Windows MSVC
if(MSVC)
- set(QT_CFLAGS_OPTIMIZE "-O2")
+ set(QT_CFLAGS_OPTIMIZE "-O2 -Ob3") # -Ob3 was introduced in Visual Studio 2019 version 16.0
set(QT_CFLAGS_OPTIMIZE_DEBUG "-Od")
set(QT_CFLAGS_OPTIMIZE_SIZE "-O1")
- set(QT_CFLAGS_OPTIMIZE_VALID_VALUES "/O2" "/O1" "/Od" "/Ob0" "/Ob1" "/Ob2" "/O0" "-O0")
+ set(QT_CFLAGS_OPTIMIZE_VALID_VALUES "/O2" "/O1" "/Od" "/Ob0" "/Ob1" "/Ob2" "/Ob3" "/O0" "-O0")
if(CLANG)
set(QT_CFLAGS_OPTIMIZE_FULL "/clang:-O3")