From 51becfbd234d9152726446af0e3718644fcf00df Mon Sep 17 00:00:00 2001 From: Yuhang Zhao Date: Tue, 23 May 2023 15:59:24 +0800 Subject: [PATCH] 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 Reviewed-by: Joerg Bornemann --- cmake/QtCompilerOptimization.cmake | 4 ++-- 1 file 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")