(android): apply size optimization flags to RelWithDebInfo build config (#4247)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
@@ -11,20 +11,24 @@ include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake)
|
||||
include(${PROJECT_SOURCE_DIR}/vendor/sqlite.cmake)
|
||||
|
||||
# cmake-format: off
|
||||
target_compile_options(mbgl-vendor-csscolorparser PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
|
||||
target_compile_options(mbgl-vendor-icu PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
|
||||
target_compile_options(mbgl-vendor-parsedate PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
|
||||
target_compile_options(mbgl-vendor-sqlite PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
|
||||
target_compile_options(mbgl-compiler-options INTERFACE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
|
||||
# Apply size optimizations for both Release and RelWithDebInfo configs.
|
||||
# Android AGP maps the release build variant to RelWithDebInfo (not Release), so we must
|
||||
# include RelWithDebInfo here to ensure these flags are actually applied.
|
||||
set(_OPT_CONFIGS "$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>")
|
||||
target_compile_options(mbgl-vendor-csscolorparser PRIVATE $<${_OPT_CONFIGS}:-Oz> $<${_OPT_CONFIGS}:-Qunused-arguments> $<${_OPT_CONFIGS}:-flto>)
|
||||
target_compile_options(mbgl-vendor-icu PRIVATE $<${_OPT_CONFIGS}:-Oz> $<${_OPT_CONFIGS}:-Qunused-arguments> $<${_OPT_CONFIGS}:-flto>)
|
||||
target_compile_options(mbgl-vendor-parsedate PRIVATE $<${_OPT_CONFIGS}:-Oz> $<${_OPT_CONFIGS}:-Qunused-arguments> $<${_OPT_CONFIGS}:-flto>)
|
||||
target_compile_options(mbgl-vendor-sqlite PRIVATE $<${_OPT_CONFIGS}:-Oz> $<${_OPT_CONFIGS}:-Qunused-arguments> $<${_OPT_CONFIGS}:-flto>)
|
||||
target_compile_options(mbgl-compiler-options INTERFACE $<${_OPT_CONFIGS}:-Oz> $<${_OPT_CONFIGS}:-Qunused-arguments> $<${_OPT_CONFIGS}:-flto>)
|
||||
# cmake-format: on
|
||||
|
||||
target_link_libraries(
|
||||
mbgl-compiler-options
|
||||
INTERFACE
|
||||
$<$<CONFIG:Release>:-O2>
|
||||
$<$<CONFIG:Release>:-Wl,--icf=all>
|
||||
$<$<CONFIG:Release>:-flto>
|
||||
$<$<CONFIG:Release>:-fuse-ld=gold>
|
||||
$<${_OPT_CONFIGS}:-O2>
|
||||
$<${_OPT_CONFIGS}:-Wl,--icf=all>
|
||||
$<${_OPT_CONFIGS}:-flto>
|
||||
$<${_OPT_CONFIGS}:-fuse-ld=lld>
|
||||
)
|
||||
|
||||
target_sources(
|
||||
|
||||
Reference in New Issue
Block a user