mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 17:44:48 +09:00

Brings in new cmake 2.23.1 and Android NDK23c which fixes an issue with the binary size and perf of libmonosgen-2.0.so In NDK23b they decided to no longer pass -O2 compiler optimization flag (for arm64, armv7 used -Oz) as part of the Android toolchain but delegate to upstream CMake behavior: https://github.com/android/ndk/wiki/Changelog-r23 and https://github.com/android/ndk/issues/1536 CMake defaults to -O3 for Release builds but unfortunately this causes quite a noticable binary size increase and perf regression. The Xamarin Android team measured startup time on an average of 10 runs of `dotnet new maui` on a Pixel 5: ``` -O3: 893.7ms -O2: 600.2ms -Oz: 649.1ms ``` We now explicitly pass in -O2 for Android builds. Fixes https://github.com/dotnet/runtime/issues/68330
22 lines
1.1 KiB
CMake
22 lines
1.1 KiB
CMake
if(CLR_CMAKE_HOST_WIN32)
|
|
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Debug>>:/Od>)
|
|
if (CLR_CMAKE_HOST_ARCH_I386)
|
|
# The Windows x86 Checked CLR has some kind of problem with exception handling
|
|
# when compiled with /O2. Issue: https://github.com/dotnet/runtime/issues/59845.
|
|
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Checked>>:/O1>)
|
|
else()
|
|
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Checked>>:/O2>)
|
|
endif()
|
|
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Release>>:/Ox>)
|
|
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:RelWithDebInfo>>:/O2>)
|
|
elseif(CLR_CMAKE_HOST_UNIX)
|
|
add_compile_options($<$<CONFIG:Debug>:-O0>)
|
|
add_compile_options($<$<CONFIG:Checked>:-O2>)
|
|
if(CLR_CMAKE_TARGET_ANDROID)
|
|
# -O2 optimization generates faster/smaller code on Android
|
|
add_compile_options($<$<CONFIG:Release>:-O2>)
|
|
else()
|
|
add_compile_options($<$<CONFIG:Release>:-O3>)
|
|
endif()
|
|
add_compile_options($<$<CONFIG:RelWithDebInfo>:-O2>)
|
|
endif()
|