CMake: Introduce CMake-only optimize_full feature
Enabling it will force usage of '-O3' flag when building Qt. If the platform has no '-O3' flag, use '-O2' as a fallback. Task-number: QTBUG-86866 Change-Id: If13f7de954ba5c01dc9634f06a85529828fe90a9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
07b6d3367d
commit
98bea5857a
1092
.prev_configure.cmake
Normal file
1092
.prev_configure.cmake
Normal file
File diff suppressed because it is too large
Load Diff
@ -793,6 +793,15 @@ function(qt_internal_set_up_config_optimizations_like_in_qmake)
|
||||
set(value_to_append "${QT_CFLAGS_OPTIMIZE_SIZE}")
|
||||
endif()
|
||||
|
||||
# Check if the fake 'optimize_full' feature is enabled.
|
||||
# Use the max optimization level flag for all release configs, effectively
|
||||
# overriding any previous setting.
|
||||
set(configs_for_optimize RELEASE RELWITHDEBINFO MINSIZEREL)
|
||||
if(QT_FEATURE_optimize_full AND config IN_LIST configs_for_optimize)
|
||||
qt_internal_get_optimize_full_flags(optimize_full_flags)
|
||||
set(value_to_append "${optimize_full_flags}")
|
||||
endif()
|
||||
|
||||
# Assign value to the cache entry.
|
||||
if(value_to_append)
|
||||
string(APPEND "${flag_var_name}" " ${value_to_append}")
|
||||
|
@ -431,6 +431,13 @@ qt_feature("optimize_size"
|
||||
CONDITION NOT QT_FEATURE_debug OR QT_FEATURE_debug_and_release
|
||||
)
|
||||
qt_feature_config("optimize_size" QMAKE_PRIVATE_CONFIG)
|
||||
# special case begin
|
||||
qt_feature("optimize_full"
|
||||
LABEL "Fully optimize release builds (-O3)"
|
||||
AUTODETECT OFF
|
||||
)
|
||||
qt_feature_config("optimize_full" QMAKE_PRIVATE_CONFIG)
|
||||
# special case end
|
||||
qt_feature("pkg-config" PUBLIC
|
||||
LABEL "Using pkg-config"
|
||||
AUTODETECT NOT APPLE AND NOT WIN32 AND NOT ANDROID
|
||||
@ -940,6 +947,9 @@ qt_configure_add_summary_entry(
|
||||
ARGS "optimize_size"
|
||||
CONDITION NOT QT_FEATURE_debug OR QT_FEATURE_debug_and_release
|
||||
)
|
||||
qt_configure_add_summary_entry(
|
||||
ARGS "optimize_full"
|
||||
)
|
||||
qt_configure_add_summary_entry(ARGS "shared")
|
||||
qt_configure_add_summary_entry(
|
||||
TYPE "firstAvailableFeature"
|
||||
|
Loading…
Reference in New Issue
Block a user