mirror of https://github.com/PCSX2/pcsx2.git
CMake: Add option for partial LTO
This commit is contained in:
parent
7ede817241
commit
83e9513623
|
@ -18,6 +18,7 @@ set(PCSX2_DEFS "")
|
|||
option(DISABLE_BUILD_DATE "Disable including the binary compile date")
|
||||
option(ENABLE_TESTS "Enables building the unit tests" ON)
|
||||
option(USE_SYSTEM_YAML "Uses a system version of yaml, if found")
|
||||
option(LTO_PCSX2_CORE "Enable LTO/IPO/LTCG on the subset of pcsx2 that benefits most from it but not anything else")
|
||||
|
||||
if(WIN32)
|
||||
set(DEFAULT_NATIVE_TOOLS ON)
|
||||
|
|
|
@ -1364,10 +1364,27 @@ set(pcsx2x86Headers
|
|||
x86/R5900_Profiler.h
|
||||
)
|
||||
|
||||
# common Sources
|
||||
target_sources(PCSX2 PRIVATE
|
||||
# These ones benefit a lot from LTO
|
||||
set(pcsx2LTOSources
|
||||
${pcsx2Sources}
|
||||
${pcsx2Headers}
|
||||
${pcsx2IPUSources}
|
||||
${pcsx2IPUHeaders}
|
||||
${pcsx2x86Sources}
|
||||
${pcsx2x86Headers}
|
||||
)
|
||||
|
||||
if(LTO_PCSX2_CORE)
|
||||
add_library(PCSX2_LTO ${pcsx2LTOSources})
|
||||
target_link_libraries(PCSX2_LTO PRIVATE PCSX2_FLAGS)
|
||||
target_link_libraries(PCSX2 PRIVATE PCSX2_LTO)
|
||||
set_target_properties(PCSX2_LTO PROPERTIES INTERPROCEDURAL_OPTIMIZATION true)
|
||||
else()
|
||||
target_sources(PCSX2 PRIVATE ${pcsx2LTOSources})
|
||||
endif()
|
||||
|
||||
# common Sources
|
||||
target_sources(PCSX2 PRIVATE
|
||||
${pcsx2CDVDSources}
|
||||
${pcsx2CDVDHeaders}
|
||||
${pcsx2SPU2Sources}
|
||||
|
@ -1383,8 +1400,6 @@ target_sources(PCSX2 PRIVATE
|
|||
${pcsx2GuiSources}
|
||||
${pcsx2GuiResources}
|
||||
${pcsx2GuiHeaders}
|
||||
${pcsx2IPUSources}
|
||||
${pcsx2IPUHeaders}
|
||||
${pcsx2ps2Sources}
|
||||
${pcsx2ps2Headers}
|
||||
${pcsx2RecordingSources}
|
||||
|
@ -1394,8 +1409,6 @@ target_sources(PCSX2 PRIVATE
|
|||
${pcsx2SystemHeaders}
|
||||
${pcsx2UtilitiesSources}
|
||||
${pcsx2UtilitiesHeaders}
|
||||
${pcsx2x86Sources}
|
||||
${pcsx2x86Headers}
|
||||
${pcsx2ZipToolsSources}
|
||||
${pcsx2ZipToolsHeaders})
|
||||
|
||||
|
|
Loading…
Reference in New Issue