mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Apply whole program optimization for certain targets
Only applied to certain targets to prevent bombing compile times; other projects don't really benefit of this.
This commit is contained in:
parent
5ba0beab40
commit
e5a455e7c7
@ -75,3 +75,15 @@ macro( define_compiler_variables )
|
||||
message( FATAL_ERROR "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}" )
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Apply whole program optimization for this target in release ( !slow! )
|
||||
# -----------------------------------------------------------------------------
|
||||
macro( whole_program_optimization )
|
||||
target_compile_options( ${PROJECT_NAME} PRIVATE
|
||||
$<$<CONFIG:Release>:/GL>
|
||||
)
|
||||
target_link_options( ${PROJECT_NAME} PRIVATE
|
||||
$<$<CONFIG:Release>:/LTCG>
|
||||
)
|
||||
endmacro()
|
||||
|
@ -57,7 +57,11 @@ add_sources( SOURCE_GROUP "Math"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
whole_program_optimization()
|
||||
|
||||
# Setup precompiled header
|
||||
target_precompile_headers( ${PROJECT_NAME} PRIVATE mathlib_pch.h )
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE -DBUILDING_MATHLIB )
|
||||
target_precompile_headers( ${PROJECT_NAME} PRIVATE
|
||||
"mathlib_pch.h"
|
||||
)
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE
|
||||
"BUILDING_MATHLIB"
|
||||
)
|
||||
|
1
r5dev/thirdparty/fastlz/CMakeLists.txt
vendored
1
r5dev/thirdparty/fastlz/CMakeLists.txt
vendored
@ -9,3 +9,4 @@ add_sources( SOURCE_GROUP "Core"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
whole_program_optimization()
|
||||
|
6
r5dev/thirdparty/lzham/CMakeLists.txt
vendored
6
r5dev/thirdparty/lzham/CMakeLists.txt
vendored
@ -65,4 +65,8 @@ add_sources( SOURCE_GROUP "Include"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE WIN32 )
|
||||
whole_program_optimization()
|
||||
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE
|
||||
"WIN32"
|
||||
)
|
||||
|
10
r5dev/thirdparty/recast/CMakeLists.txt
vendored
10
r5dev/thirdparty/recast/CMakeLists.txt
vendored
@ -22,7 +22,11 @@ add_sources( SOURCE_GROUP "Include"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
target_precompile_headers( ${PROJECT_NAME} PRIVATE Pch.h )
|
||||
whole_program_optimization()
|
||||
|
||||
target_precompile_headers( ${PROJECT_NAME} PRIVATE
|
||||
"Pch.h"
|
||||
)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Detour runtime
|
||||
@ -54,6 +58,7 @@ add_sources( SOURCE_GROUP "Include"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
whole_program_optimization()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Detour crowd
|
||||
@ -83,6 +88,7 @@ add_sources( SOURCE_GROUP "Include"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
whole_program_optimization()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Detour tile cache
|
||||
@ -102,6 +108,7 @@ add_sources( SOURCE_GROUP "Include"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
whole_program_optimization()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Recast runtime
|
||||
@ -131,3 +138,4 @@ add_sources( SOURCE_GROUP "Include"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
whole_program_optimization()
|
||||
|
2
r5dev/thirdparty/spdlog/CMakeLists.txt
vendored
2
r5dev/thirdparty/spdlog/CMakeLists.txt
vendored
@ -132,6 +132,8 @@ add_sources( SOURCE_GROUP "Sinks"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
whole_program_optimization()
|
||||
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE
|
||||
"SPDLOG_COMPILED_LIB"
|
||||
"SPDLOG_NO_EXCEPTIONS"
|
||||
|
Loading…
x
Reference in New Issue
Block a user