-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
configureoptimization.cmake
22 lines (22 loc) · 1.08 KB
/
configureoptimization.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()