Meta: Make the "Release" build type use -O3 and -flto

This doesn't affect the default preset, but the Distribution preset will
now compile with these flags instead.
This commit is contained in:
Jelle Raaijmakers 2025-03-26 12:59:59 +00:00 committed by Andreas Kling
parent da09608156
commit 3bc6870bbf
Notes: github-actions[bot] 2025-04-01 11:45:01 +00:00
3 changed files with 9 additions and 7 deletions

View file

@ -153,10 +153,7 @@
"vcpkg_ci",
"Sanitizer"
],
"displayName": "Sanitizer CI Config",
"cacheVariables": {
"CMAKE_BUILD_TYPE": ""
}
"displayName": "Sanitizer CI Config"
},
{
"name": "Fuzzers",
@ -166,7 +163,6 @@
"binaryDir": "${fileDir}/Build/fuzzers",
"cacheVariables": {
"BUILD_SHARED_LIBS": "OFF",
"CMAKE_BUILD_TYPE": "",
"ENABLE_QT": "OFF",
"VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/distribution-triplets",
"ENABLE_FUZZERS_LIBFUZZER": "ON",

View file

@ -123,7 +123,7 @@ If you do run into such an error, the rest of this section explains how to deal
endif()
- add_cxx_compile_options(-Og)
+ add_cxx_compile_options(-O0)
else()
elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
add_cxx_compile_options(-O2)
if (NOT MSVC)
EOF

View file

@ -30,11 +30,17 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_cxx_compile_options(-ggdb3)
endif()
add_cxx_compile_options(-Og)
else()
elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
add_cxx_compile_options(-O2)
if (NOT MSVC)
add_cxx_compile_options(-g1)
endif()
else()
add_cxx_compile_options(-O3)
include(CheckIPOSupported)
check_ipo_supported()
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
function(add_cxx_linker_flag_if_supported flag)