MSVC static library split hack

This commit is contained in:
Jack Andersen 2019-02-06 18:10:07 -10:00
parent 825acbaa0d
commit 5600bf5172
1 changed files with 89 additions and 73 deletions

View File

@ -48,83 +48,99 @@ if(APPLE)
list(APPEND PLAT_SRCS startButton.cpp CGameOptionsTouchBarMac.mm) list(APPEND PLAT_SRCS startButton.cpp CGameOptionsTouchBarMac.mm)
endif() endif()
add_library(RuntimeCommon set(RUNTIME_SOURCES_A
RetroTypes.hpp RetroTypes.cpp RetroTypes.hpp RetroTypes.cpp
${CLIENT_SOURCES} ${CLIENT_SOURCES}
${MP1_SOURCES} ${MP1_SOURCES}
${AUDIO_SOURCES} ${AUDIO_SOURCES}
${AUTOMAPPER_SOURCES} ${AUTOMAPPER_SOURCES}
${CAMERA_SOURCES} ${CAMERA_SOURCES}
${CHARACTER_SOURCES} ${CHARACTER_SOURCES}
${COLLISION_SOURCES} ${COLLISION_SOURCES})
${GRAPHICS_SOURCES}
${GUISYS_SOURCES} set(RUNTIME_SOURCES_B
${INPUT_SOURCES} ${GRAPHICS_SOURCES}
${PARTICLE_SOURCES} ${GUISYS_SOURCES}
${WORLD_SOURCES} ${INPUT_SOURCES}
${WEAPON_SOURCES} ${PARTICLE_SOURCES}
ITweak.hpp ${WORLD_SOURCES}
IMain.hpp ${WEAPON_SOURCES}
CStopwatch.hpp ITweak.hpp
CGameAllocator.hpp CGameAllocator.cpp IMain.hpp
CMemoryCardSys.hpp CMemoryCardSys.cpp CStopwatch.hpp
CScannableObjectInfo.hpp CScannableObjectInfo.cpp CGameAllocator.hpp CGameAllocator.cpp
CSaveWorld.hpp CSaveWorld.cpp CMemoryCardSys.hpp CMemoryCardSys.cpp
CDependencyGroup.hpp CDependencyGroup.cpp CScannableObjectInfo.hpp CScannableObjectInfo.cpp
CBasics.hpp CBasicsPC.cpp CSaveWorld.hpp CSaveWorld.cpp
CIOWin.hpp CDependencyGroup.hpp CDependencyGroup.cpp
CIOWinManager.hpp CIOWinManager.cpp CBasics.hpp CBasicsPC.cpp
CStateManager.hpp CStateManager.cpp CIOWin.hpp
CGameState.hpp CGameState.cpp CIOWinManager.hpp CIOWinManager.cpp
CRelayTracker.hpp CRelayTracker.cpp CStateManager.hpp CStateManager.cpp
CPlayerState.hpp CPlayerState.cpp CGameState.hpp CGameState.cpp
CRandom16.hpp CRandom16.cpp CRelayTracker.hpp CRelayTracker.cpp
CResFactory.hpp CResFactory.cpp CPlayerState.hpp CPlayerState.cpp
CResLoader.hpp CResLoader.cpp CRandom16.hpp CRandom16.cpp
CDvdRequest.hpp CResFactory.hpp CResFactory.cpp
CDvdFile.hpp CDvdFile.cpp CResLoader.hpp CResLoader.cpp
IObjectStore.hpp CDvdRequest.hpp
CSimplePool.hpp CSimplePool.cpp CDvdFile.hpp CDvdFile.cpp
CGameOptions.hpp CGameOptions.cpp IObjectStore.hpp
CGameOptionsTouchBar.hpp CGameOptionsTouchBar.cpp CSimplePool.hpp CSimplePool.cpp
CStaticInterference.hpp CStaticInterference.cpp CGameOptions.hpp CGameOptions.cpp
CCRC32.hpp CCRC32.cpp CGameOptionsTouchBar.hpp CGameOptionsTouchBar.cpp
IFactory.hpp CStaticInterference.hpp CStaticInterference.cpp
IObjFactory.hpp CCRC32.hpp CCRC32.cpp
CObjectList.hpp CObjectList.cpp IFactory.hpp
GameObjectLists.hpp GameObjectLists.cpp IObjFactory.hpp
CSortedLists.hpp CSortedLists.cpp CObjectList.hpp CObjectList.cpp
CArchitectureMessage.hpp GameObjectLists.hpp GameObjectLists.cpp
CArchitectureQueue.hpp CSortedLists.hpp CSortedLists.cpp
IObj.hpp CArchitectureMessage.hpp
IVParamObj.hpp CArchitectureQueue.hpp
CTimeProvider.hpp CTimeProvider.cpp IObj.hpp
CToken.hpp CToken.cpp IVParamObj.hpp
CFactoryMgr.hpp CFactoryMgr.cpp CTimeProvider.hpp CTimeProvider.cpp
CPakFile.hpp CPakFile.cpp CToken.hpp CToken.cpp
CStringExtras.hpp CFactoryMgr.hpp CFactoryMgr.cpp
IOStreams.hpp IOStreams.cpp CPakFile.hpp CPakFile.cpp
CMainFlowBase.hpp CMainFlowBase.cpp CStringExtras.hpp
CMFGameBase.hpp IOStreams.hpp IOStreams.cpp
CInGameTweakManagerBase.hpp CMainFlowBase.hpp CMainFlowBase.cpp
CPlayMovieBase.hpp CMFGameBase.hpp
CGameDebug.hpp CInGameTweakManagerBase.hpp
CGameHintInfo.hpp CGameHintInfo.cpp CPlayMovieBase.hpp
rstl.hpp CGameDebug.hpp
GameGlobalObjects.hpp GameGlobalObjects.cpp CGameHintInfo.hpp CGameHintInfo.cpp
MkCastTo.py rstl.hpp
TCastTo.hpp TCastTo.cpp GameGlobalObjects.hpp GameGlobalObjects.cpp
GCNTypes.hpp MkCastTo.py
${PLAT_SRCS}) TCastTo.hpp TCastTo.cpp
GCNTypes.hpp
${PLAT_SRCS})
function(add_runtime_common_library name)
add_library(${name} ${ARGN})
if(COMMAND add_sanitizers) if(COMMAND add_sanitizers)
add_sanitizers(RuntimeCommon) add_sanitizers(${name})
endif() endif()
if(COMMAND cotire) if(COMMAND cotire)
set_target_properties(RuntimeCommon PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) set_target_properties(${name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(RuntimeCommon) cotire(${name})
endif() endif()
add_dependencies(RuntimeCommon ${HECL_APPLICATION_REPS_TARGETS_LIST}) add_dependencies(${name} ${HECL_APPLICATION_REPS_TARGETS_LIST})
if(WINDOWS_STORE) if(WINDOWS_STORE)
set_property(TARGET RuntimeCommon PROPERTY VS_WINRT_COMPONENT TRUE) set_property(TARGET ${name} PROPERTY VS_WINRT_COMPONENT TRUE)
endif()
endfunction()
if(MSVC)
# WTF MS???? LINK.EXE is unable to address static libraries larger than 4GB.
# This is a hack to split this large library in two.
add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A})
add_runtime_common_library(RuntimeCommonB ${RUNTIME_SOURCES_B})
target_link_libraries(RuntimeCommon RuntimeCommonB)
else()
add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A} ${RUNTIME_SOURCES_B})
endif() endif()