make use of thinlto for release builds
This commit is contained in:
parent
b683594013
commit
92de2c00c0
@ -156,7 +156,7 @@ function(give_options_without_warnings target)
|
||||
|
||||
set(BUILD_FLAGS_RELEASE
|
||||
-O3
|
||||
-flto=auto
|
||||
-flto=$<IF:$<STREQUAL:${CMAKE_C_COMPILER_ID},Clang>,thin,auto>
|
||||
-mavx -mavx2
|
||||
-Wl,--gc-sections
|
||||
-fdata-sections
|
||||
@ -173,6 +173,10 @@ function(give_options_without_warnings target)
|
||||
$<$<BOOL:${TWN_SANITIZE}>:-fstack-protector-all -fsanitize=undefined -fsanitize=address>
|
||||
$<$<BOOL:${EMSCRIPTEN}>:-gsource-map>)
|
||||
|
||||
set(BUILD_SHARED_LIBRARY_FLAGS_RELEASE
|
||||
$<$<STREQUAL:${CMAKE_C_COMPILER_ID},Clang>:-Wl,-plugin-opt,cache-dir=${CMAKE_CURRENT_BINARY_DIR}/linker-cache/>
|
||||
$<$<STREQUAL:${CMAKE_C_COMPILER_ID},Clang>:-Wl,-plugin-opt,cache-policy=prune_after=30m>)
|
||||
|
||||
target_compile_options(${target} PUBLIC
|
||||
${BUILD_FLAGS}
|
||||
$<$<CONFIG:Release>:${BUILD_FLAGS_RELEASE}>
|
||||
@ -186,6 +190,15 @@ function(give_options_without_warnings target)
|
||||
-Bsymbolic-functions
|
||||
$<$<BOOL:${LINUX}>:-Wl,--hash-style=gnu>)
|
||||
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if (target_type MATCHES SHARED_LIBRARY)
|
||||
target_compile_options(${target} PUBLIC
|
||||
$<$<CONFIG:Release>:${BUILD_SHARED_LIBRARY_FLAGS_RELEASE}>)
|
||||
|
||||
target_link_options(${target} PUBLIC
|
||||
$<$<CONFIG:Release>:${BUILD_SHARED_LIBRARY_FLAGS_RELEASE}>)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${target} PRIVATE
|
||||
$<$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>:TWN_FEATURE_DYNLIB_GAME>
|
||||
$<$<BOOL:${LINUX}>:_GNU_SOURCE>)
|
||||
|
Loading…
Reference in New Issue
Block a user