Skip to content

Commit

Permalink
fix: split apart big Cmake libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphoseer committed Jan 2, 2024
1 parent 1941679 commit c81ac4e
Show file tree
Hide file tree
Showing 51 changed files with 309 additions and 366 deletions.
78 changes: 0 additions & 78 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,78 +215,6 @@ set(INCLUDED_DIRECTORIES

"dNet"

"dScripts"
"dScripts/02_server"
"dScripts/ai"
"dScripts/client"
"dScripts/EquipmentScripts"
"dScripts/EquipmentTriggers"
"dScripts/zone"
"dScripts/02_server/DLU"
"dScripts/02_server/Enemy"
"dScripts/02_server/Equipment"
"dScripts/02_server/Map"
"dScripts/02_server/Minigame"
"dScripts/02_server/Objects"
"dScripts/02_server/Pets"
"dScripts/02_server/Enemy/AG"
"dScripts/02_server/Enemy/AM"
"dScripts/02_server/Enemy/FV"
"dScripts/02_server/Enemy/General"
"dScripts/02_server/Enemy/Survival"
"dScripts/02_server/Enemy/VE"
"dScripts/02_server/Enemy/Waves"
"dScripts/02_server/Map/AG"
"dScripts/02_server/Map/AG_Spider_Queen"
"dScripts/02_server/Map/AM"
"dScripts/02_server/Map/FV"
"dScripts/02_server/Map/General"
"dScripts/02_server/Map/GF"
"dScripts/02_server/Map/njhub"
"dScripts/02_server/Map/NS"
"dScripts/02_server/Map/NT"
"dScripts/02_server/Map/PR"
"dScripts/02_server/Map/Property"
"dScripts/02_server/Map/SS"
"dScripts/02_server/Map/VE"
"dScripts/02_server/Map/FV/Racing"
"dScripts/02_server/Map/General/Ninjago"
"dScripts/02_server/Map/njhub/boss_instance"
"dScripts/02_server/Map/NS/Waves"
"dScripts/02_server/Map/Property/AG_Med"
"dScripts/02_server/Map/Property/AG_Small"
"dScripts/02_server/Map/Property/NS_Med"
"dScripts/02_server/Minigame/General"
"dScripts/ai/ACT"
"dScripts/ai/AG"
"dScripts/ai/FV"
"dScripts/ai/GENERAL"
"dScripts/ai/GF"
"dScripts/ai/MINIGAME"
"dScripts/ai/MINIGAME/Objects"
"dScripts/ai/NP"
"dScripts/ai/NS"
"dScripts/ai/PETS"
"dScripts/ai/PROPERTY"
"dScripts/ai/RACING"
"dScripts/ai/SPEC"
"dScripts/ai/WILD"
"dScripts/ai/ACT/FootRace"
"dScripts/ai/MINIGAME/SG_GF"
"dScripts/ai/MINIGAME/SG_GF/SERVER"
"dScripts/ai/NS/NS_PP_01"
"dScripts/ai/NS/WH"
"dScripts/ai/PROPERTY/AG"
"dScripts/ai/RACING/OBJECTS"
"dScripts/client/ai"
"dScripts/client/ai/PR"
"dScripts/zone/AG"
"dScripts/zone/LUPs"
"dScripts/zone/PROPERTY"
"dScripts/zone/PROPERTY/FV"
"dScripts/zone/PROPERTY/GF"
"dScripts/zone/PROPERTY/NS"

"thirdparty/magic_enum/include/magic_enum"
"thirdparty/raknet/Source"
"thirdparty/tinyxml2"
Expand Down Expand Up @@ -382,12 +310,6 @@ add_subdirectory(dAuthServer)
add_subdirectory(dChatServer)
add_subdirectory(dMasterServer) # Add MasterServer last so it can rely on the other binaries

# Add our precompiled headers
target_precompile_headers(
dGame PRIVATE
${HEADERS_DGAME}
)

target_precompile_headers(
dZoneManager PRIVATE
${HEADERS_DZONEMANAGER}
Expand Down
59 changes: 14 additions & 45 deletions dGame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,27 @@ set(DGAME_SOURCES "Character.cpp"
"User.cpp"
"UserManager.cpp")

add_subdirectory(dBehaviors)
include_directories(
${PROJECT_SOURCE_DIR}/dScripts
${PROJECT_SOURCE_DIR}/dGame
)

foreach(file ${DGAME_DBEHAVIORS_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dBehaviors/${file}")
endforeach()
add_library(dGameBase ${DGAME_SOURCES})
target_precompile_headers(dGameBase PRIVATE ${HEADERS_DGAME})
target_link_libraries(dGameBase
PUBLIC dDatabase dPhysics
INTERFACE dComponents dEntity)

add_subdirectory(dBehaviors)
add_subdirectory(dComponents)

foreach(file ${DGAME_DCOMPONENTS_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dComponents/${file}")
endforeach()

add_subdirectory(dEntity)

foreach(file ${DGAME_DENTITY_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dEntity/${file}")
endforeach()

add_subdirectory(dGameMessages)

foreach(file ${DGAME_DGAMEMESSAGES_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dGameMessages/${file}")
endforeach()

add_subdirectory(dInventory)

foreach(file ${DGAME_DINVENTORY_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dInventory/${file}")
endforeach()

add_subdirectory(dMission)

foreach(file ${DGAME_DMISSION_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dMission/${file}")
endforeach()

add_subdirectory(dPropertyBehaviors)

foreach(file ${DGAME_DPROPERTYBEHAVIORS_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dPropertyBehaviors/${file}")
endforeach()

add_subdirectory(dUtilities)

foreach(file ${DGAME_DUTILITIES_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dUtilities/${file}")
endforeach()

foreach(file ${DSCRIPTS_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "${PROJECT_SOURCE_DIR}/dScripts/${file}")
endforeach()

add_library(dGame STATIC ${DGAME_SOURCES})

target_link_libraries(dGame dDatabase Recast Detour)
add_library(dGame INTERFACE)
target_link_libraries(dGame INTERFACE
dGameBase dBehaviors dComponents dEntity dGameMessages dInventory dMission dPropertyBehaviors dUtilities dScripts
)
7 changes: 6 additions & 1 deletion dGame/dBehaviors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,9 @@ set(DGAME_DBEHAVIORS_SOURCES "AirMovementBehavior.cpp"
"TargetCasterBehavior.cpp"
"TauntBehavior.cpp"
"VentureVisionBehavior.cpp"
"VerifyBehavior.cpp" PARENT_SCOPE)
"VerifyBehavior.cpp")

add_library(dBehaviors STATIC ${DGAME_DBEHAVIORS_SOURCES})
target_link_libraries(dBehaviors
PUBLIC dPhysics)
target_precompile_headers(dBehaviors REUSE_FROM dGameBase)
11 changes: 9 additions & 2 deletions dGame/dComponents/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set(DGAME_DCOMPONENTS_SOURCES "ActivityComponent.cpp"
set(DGAME_DCOMPONENTS_SOURCES
"ActivityComponent.cpp"
"BaseCombatAIComponent.cpp"
"BouncerComponent.cpp"
"BuffComponent.cpp"
Expand Down Expand Up @@ -46,5 +47,11 @@ set(DGAME_DCOMPONENTS_SOURCES "ActivityComponent.cpp"
"HavokVehiclePhysicsComponent.cpp"
"VendorComponent.cpp"
"MiniGameControlComponent.cpp"
PARENT_SCOPE
)

add_library(dComponents STATIC ${DGAME_DCOMPONENTS_SOURCES})
target_include_directories(dComponents PRIVATE ${PROJECT_SOURCE_DIR}/dScripts/02_server/Map/General) # PetDigServer.h
target_precompile_headers(dComponents REUSE_FROM dGameBase)
target_link_libraries(dComponents
PUBLIC dPhysics dDatabase
INTERFACE dUtilities dCommon dBehaviors dChatFilter dMission dInventory)
8 changes: 6 additions & 2 deletions dGame/dEntity/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
set(DGAME_DENTITY_SOURCES "EntityCallbackTimer.cpp"
"EntityTimer.cpp" PARENT_SCOPE)
set(DGAME_DENTITY_SOURCES
"EntityCallbackTimer.cpp"
"EntityTimer.cpp")

add_library(dEntity STATIC ${DGAME_DENTITY_SOURCES})
target_precompile_headers(dEntity REUSE_FROM dGameBase)
9 changes: 7 additions & 2 deletions dGame/dGameMessages/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
set(DGAME_DGAMEMESSAGES_SOURCES "GameMessageHandler.cpp"
set(DGAME_DGAMEMESSAGES_SOURCES
"GameMessageHandler.cpp"
"GameMessages.cpp"
"PropertyDataMessage.cpp"
"PropertySelectQueryProperty.cpp" PARENT_SCOPE)
"PropertySelectQueryProperty.cpp")

add_library(dGameMessages STATIC ${DGAME_DGAMEMESSAGES_SOURCES})
target_link_libraries(dGameMessages PUBLIC dDatabase)
target_precompile_headers(dGameMessages REUSE_FROM dGameBase)
8 changes: 6 additions & 2 deletions dGame/dInventory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
set(DGAME_DINVENTORY_SOURCES "EquippedItem.cpp"
set(DGAME_DINVENTORY_SOURCES
"EquippedItem.cpp"
"Inventory.cpp"
"Item.cpp"
"ItemSet.cpp"
"ItemSetPassiveAbility.cpp" PARENT_SCOPE)
"ItemSetPassiveAbility.cpp")

add_library(dInventory STATIC ${DGAME_DINVENTORY_SOURCES})
target_precompile_headers(dInventory REUSE_FROM dGameBase)
9 changes: 7 additions & 2 deletions dGame/dMission/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
set(DGAME_DMISSION_SOURCES "Mission.cpp"
set(DGAME_DMISSION_SOURCES
"Mission.cpp"
"MissionPrerequisites.cpp"
"MissionTask.cpp" PARENT_SCOPE)
"MissionTask.cpp")

add_library(dMission STATIC ${DGAME_DMISSION_SOURCES})
target_link_libraries(dMission PUBLIC dDatabase)
target_precompile_headers(dMission REUSE_FROM dGameBase)
3 changes: 2 additions & 1 deletion dGame/dPropertyBehaviors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ foreach(file ${DGAME_DPROPERTYBEHAVIORS_CONTROLBEHAVIORMESSAGES})
set(DGAME_DPROPERTYBEHAVIORS_SOURCES ${DGAME_DPROPERTYBEHAVIORS_SOURCES} "ControlBehaviorMessages/${file}")
endforeach()

set(DGAME_DPROPERTYBEHAVIORS_SOURCES ${DGAME_DPROPERTYBEHAVIORS_SOURCES} PARENT_SCOPE)
add_library(dPropertyBehaviors STATIC ${DGAME_DPROPERTYBEHAVIORS_SOURCES})
target_precompile_headers(dPropertyBehaviors REUSE_FROM dGameBase)
8 changes: 7 additions & 1 deletion dGame/dUtilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ set(DGAME_DUTILITIES_SOURCES "BrickDatabase.cpp"
"Mail.cpp"
"Preconditions.cpp"
"SlashCommandHandler.cpp"
"VanityUtilities.cpp" PARENT_SCOPE)
"VanityUtilities.cpp")

add_library(dUtilities STATIC ${DGAME_DUTILITIES_SOURCES})
target_precompile_headers(dUtilities REUSE_FROM dGameBase)
target_link_libraries(dUtilities
PUBLIC dDatabase dPhysics
INTERFACE dZoneManager)
8 changes: 7 additions & 1 deletion dNet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ set(DNET_SOURCES "AuthPackets.cpp"
"ZoneInstanceManager.cpp")

add_library(dNet STATIC ${DNET_SOURCES})
target_link_libraries(dNet dCommon dDatabase)
target_include_directories(dNet PRIVATE
${PROJECT_SOURCE_DIR}/dGame/dComponents
${PROJECT_SOURCE_DIR}/dScripts # transitive through components
)
target_link_libraries(dNet
PUBLIC dCommon dDatabase
INTERFACE dZoneManager)
4 changes: 3 additions & 1 deletion dPhysics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ set(DPHYSICS_SOURCES "dpCollisionChecks.cpp"
"dpWorld.cpp")

add_library(dPhysics STATIC ${DPHYSICS_SOURCES})
target_link_libraries(dPhysics Recast Detour)
target_link_libraries(dPhysics
PUBLIC Recast Detour
INTERFACE dNavigation)
25 changes: 12 additions & 13 deletions dScripts/02_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ endforeach()

add_subdirectory(Enemy)

foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Enemy/${file}")
endforeach()

add_subdirectory(Equipment)

foreach(file ${DSCRIPTS_SOURCES_02_SERVER_EQUIPMENT})
Expand All @@ -20,10 +16,6 @@ endforeach()

add_subdirectory(Map)

foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Map/${file}")
endforeach()

add_subdirectory(Minigame)

foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MINIGAME})
Expand All @@ -38,8 +30,15 @@ endforeach()

add_subdirectory(Pets)

foreach(file ${DSCRIPTS_SOURCES_02_SERVER_PETS})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Pets/${file}")
endforeach()

set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} PARENT_SCOPE)
add_library(dScriptsServer STATIC ${DSCRIPTS_SOURCES_02_SERVER})
target_include_directories(dScriptsServer PUBLIC "."
"DLU"
"Equipment"
"Minigame"
"Minigame/General"
"Objects"
"Pets")
target_link_libraries(dScriptsServer INTERFACE
dScriptsServerEnemy
dScriptsServerMap)
target_precompile_headers(dScriptsServer REUSE_FROM dScriptsBase)
13 changes: 12 additions & 1 deletion dScripts/02_server/Enemy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,15 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_WAVES})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "Waves/${file}")
endforeach()

set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} PARENT_SCOPE)
add_library(dScriptsServerEnemy STATIC ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
target_link_libraries(dScriptsServerEnemy dScriptsBase)
target_include_directories(dScriptsServerEnemy PUBLIC "."
"AG"
"AM"
"FV"
"General"
"Survival"
"VE"
"Waves"
)
target_precompile_headers(dScriptsServerEnemy PRIVATE ${HEADERS_DGAME})
7 changes: 5 additions & 2 deletions dScripts/02_server/Map/AG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG
"AgMonumentRaceGoal.cpp"
"AgMonumentRaceCancel.cpp"
"NpcCowboyServer.cpp"
"NpcPirateServer.cpp"
PARENT_SCOPE)
"NpcPirateServer.cpp")

add_library(dScriptsServerMapAG ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
target_include_directories(dScriptsServerMapAG PUBLIC ".")
target_precompile_headers(dScriptsServerMapAG REUSE_FROM dScriptsBase)
8 changes: 6 additions & 2 deletions dScripts/02_server/Map/AG_Spider_Queen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN
"ZoneAgSpiderQueen.cpp"
"SpiderBossTreasureChestServer.cpp"
PARENT_SCOPE)
"SpiderBossTreasureChestServer.cpp")

add_library(dScriptsServerMapAGSpiderQueen ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
target_include_directories(dScriptsServerMapAGSpiderQueen PUBLIC ".")
target_link_libraries(dScriptsServerMapAGSpiderQueen dScriptsServerMapProperty)
target_precompile_headers(dScriptsServerMapAGSpiderQueen REUSE_FROM dScriptsBase)
7 changes: 5 additions & 2 deletions dScripts/02_server/Map/AM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
"AmSkullkinDrillStand.cpp"
"AmSkullkinTower.cpp"
"AmBlueX.cpp"
"AmTeapotServer.cpp"
PARENT_SCOPE)
"AmTeapotServer.cpp")

add_library(dScriptsServerMapAM ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
target_include_directories(dScriptsServerMapAM PUBLIC ".")
target_precompile_headers(dScriptsServerMapAM REUSE_FROM dScriptsBase)
Loading

0 comments on commit c81ac4e

Please sign in to comment.