mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Enable LTCG for executables and shared libraries
Enable Link Time Code Generation as some libraries are compiled using /GL (Whole Program Optimization) which requires the code generation to be delayed to link time. Not doing this will result in longer build times, as the linker has to terminate its progress if it links a library compiled with /GL, and restart this operation using /LTCG.
This commit is contained in:
parent
0c25246f91
commit
2fd62b7091
@ -48,8 +48,14 @@ macro( add_module MODULE_TYPE MODULE_NAME REUSE_PCH FOLDER_NAME )
|
|||||||
add_library( ${PROJECT_NAME} )
|
add_library( ${PROJECT_NAME} )
|
||||||
elseif( ${MODULE_TYPE} STREQUAL "shared_lib" )
|
elseif( ${MODULE_TYPE} STREQUAL "shared_lib" )
|
||||||
add_library( ${PROJECT_NAME} SHARED )
|
add_library( ${PROJECT_NAME} SHARED )
|
||||||
|
target_link_options( ${PROJECT_NAME} PRIVATE
|
||||||
|
"$<$<CONFIG:Release>:/LTCG>"
|
||||||
|
)
|
||||||
elseif(${MODULE_TYPE} STREQUAL "exe")
|
elseif(${MODULE_TYPE} STREQUAL "exe")
|
||||||
add_executable( ${PROJECT_NAME} )
|
add_executable( ${PROJECT_NAME} )
|
||||||
|
target_link_options( ${PROJECT_NAME} PRIVATE
|
||||||
|
"$<$<CONFIG:Release>:/LTCG>"
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
message( FATAL_ERROR "Invalid module type: ${MODULE_TYPE}; expected 'lib', 'shared_lib', or 'exe'." )
|
message( FATAL_ERROR "Invalid module type: ${MODULE_TYPE}; expected 'lib', 'shared_lib', or 'exe'." )
|
||||||
endif()
|
endif()
|
||||||
@ -83,7 +89,4 @@ macro( whole_program_optimization )
|
|||||||
target_compile_options( ${PROJECT_NAME} PRIVATE
|
target_compile_options( ${PROJECT_NAME} PRIVATE
|
||||||
$<$<CONFIG:Release>:/GL>
|
$<$<CONFIG:Release>:/GL>
|
||||||
)
|
)
|
||||||
target_link_options( ${PROJECT_NAME} PRIVATE
|
|
||||||
$<$<CONFIG:Release>:/LTCG>
|
|
||||||
)
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user