From 676e2cab30befdae76129023229fea50029d0324 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Mon, 23 Oct 2023 00:41:19 +0200 Subject: [PATCH] Split cmake files This moves stuff in Source/CMakeLists.txt into parent or into Game specific Also replaces INCLUDE_DIRECTORIES with target specific includes to avoid mixup StdAfx has been deduplicated by renaming other modules StdAfx's --- CMakeLists.txt | 103 +++++ Source/AI/CMakeLists.txt | 24 ++ Source/CMakeLists.txt | 395 +----------------- Source/Exodus/CMakeLists.txt | 25 +- Source/Game/CMakeLists.txt | 190 +++++++++ Source/Game/GameContent.cpp | 1 + Source/Game/PerimeterDataChannel.cpp | 1 - Source/Game/StdAfx.h | 5 - Source/Game/Texts.cpp | 1 + Source/Game/Universe.h | 2 + Source/GeoLogic/CMakeLists.txt | 16 + Source/HT/CMakeLists.txt | 24 ++ Source/HT/ht.cpp | 2 +- Source/Network/CMakeLists.txt | 29 +- Source/Physics/CMakeLists.txt | 25 ++ Source/Physics/Missile.cpp | 2 +- Source/Physics/MultiBodyDispatcher.cpp | 1 + Source/Physics/Mutation.cpp | 3 +- Source/Physics/RigidBody.cpp | 5 +- Source/Physics/RigidBody.h | 2 +- Source/Physics/Rocket.cpp | 2 +- Source/PluginMAX/CMakeLists.txt | 13 +- Source/Render/CMakeLists.txt | 38 +- Source/Render/sokol/CMakeLists.txt | 12 +- Source/Scripts/SquadShellEnums.inl | 2 + Source/Sound/AudioPlayer.cpp | 2 +- Source/Sound/C3D.cpp | 2 +- Source/Sound/CMakeLists.txt | 15 +- Source/Sound/PerimeterSound.cpp | 2 +- Source/Sound/Sample.cpp | 2 +- Source/Sound/SoftwareBuffer.cpp | 2 +- Source/Sound/SoundScript.cpp | 2 +- Source/Sound/{StdAfx.h => StdAfxSound.h} | 1 + Source/Sound/TextConverter/MessageBlock.cpp | 2 +- Source/Terra/CMakeLists.txt | 15 +- Source/TriggerEditor/StdAfx.cpp | 2 +- .../{StdAfx.h => StdAfxTriggerEditor.h} | 0 Source/TriggerEditor/TEFrame.cpp | 2 +- Source/TriggerEditor/TriggerEditor.cpp | 2 +- Source/TriggerEditor/TriggerEditorApp.cpp | 2 +- Source/TriggerEditor/TriggerExport.cpp | 2 +- Source/Units/CMakeLists.txt | 69 +++ Source/Units/EnergyConsumer.cpp | 2 +- Source/Units/GenericControls.cpp | 5 +- Source/Units/IronLegion.cpp | 3 - Source/Units/RealInterpolation.cpp | 1 + Source/Units/RealUnit.cpp | 2 +- Source/Units/RealUnit.h | 6 +- Source/Units/UnitAttribute.h | 2 - Source/UserInterface/BGScene.cpp | 3 + Source/UserInterface/BattleMenu.cpp | 2 +- Source/UserInterface/BelligerentSelect.cpp | 2 +- Source/UserInterface/CMakeLists.txt | 65 +++ Source/UserInterface/LogicUpdater.cpp | 2 + Source/UserInterface/MainMenu.cpp | 2 +- Source/UserInterface/Menu/AddonsMenu.cpp | 2 +- Source/UserInterface/Menu/CommunityMenu.cpp | 2 +- .../UserInterface/Menu/MultiplayerCommon.cpp | 2 +- Source/UserInterface/Menu/MultiplayerHost.cpp | 2 +- Source/UserInterface/Menu/MultiplayerJoin.cpp | 2 +- Source/UserInterface/Menu/MultiplayerList.cpp | 2 +- Source/UserInterface/Menu/SingleMenu.cpp | 2 +- Source/UserInterface/MessageBox.cpp | 2 +- Source/UserInterface/MissionEdit.cpp | 4 +- Source/Util/CMakeLists.txt | 35 ++ Source/Util/DebugUtil.cpp | 2 +- Source/Util/MissionDescription.cpp | 2 + Source/Util/SaveSQSH.cpp | 2 + Source/Util/SystemUtil.cpp | 1 + Source/XPrm/CMakeLists.txt | 44 +- Source/XPrm/MemStat.cpp | 2 +- Source/XPrm/Params.cpp | 2 +- Source/XPrm/RunTimeCompiler.cpp | 4 +- Source/XPrm/Statistics.cpp | 2 +- Source/XPrm/StdAfx.cpp | 2 +- Source/XPrm/{stdafx.h => StdAfxXPrm.h} | 0 Source/XPrm/Token.cpp | 2 +- Source/XPrm/XPrm.cpp | 2 +- Source/XPrm/XPrmTest.cpp | 2 +- Source/XPrm/multipad.cpp | 2 +- Source/XTool/CMakeLists.txt | 59 ++- Source/tx3d/CMakeLists.txt | 13 +- 82 files changed, 772 insertions(+), 570 deletions(-) create mode 100644 Source/AI/CMakeLists.txt create mode 100644 Source/Game/CMakeLists.txt create mode 100644 Source/GeoLogic/CMakeLists.txt create mode 100644 Source/HT/CMakeLists.txt create mode 100644 Source/Physics/CMakeLists.txt rename Source/Sound/{StdAfx.h => StdAfxSound.h} (91%) rename Source/TriggerEditor/{StdAfx.h => StdAfxTriggerEditor.h} (100%) create mode 100644 Source/Units/CMakeLists.txt create mode 100644 Source/UserInterface/CMakeLists.txt create mode 100644 Source/Util/CMakeLists.txt rename Source/XPrm/{stdafx.h => StdAfxXPrm.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae2279696..6dcb28a8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -368,6 +368,7 @@ ADD_DEFINITIONS(-DPERIMETER_VERSION=${PERIMETER_VERSION_STR}) UNSET(PERIMETER_VERSION_STR) ADD_DEFINITIONS(-D_PERIMETER_) +add_definitions(-D_TX3D_LIBRARY_) IF(OPTION_FINAL_VERSION) ADD_DEFINITIONS(-D_FINAL_VERSION_) ELSE() @@ -393,4 +394,106 @@ IF(PERIMETER_EXODUS_SOUND) ADD_DEFINITIONS(-DPERIMETER_EXODUS_SOUND) ENDIF() +#simpleini +FetchContent_Declare(simpleini + GIT_REPOSITORY https://github.com/brofield/simpleini + GIT_TAG "7350fcc9228f410309734c3fb6dae2bf513cdd98" + GIT_SHALLOW OFF +) +FetchContent_MakeAvailable(simpleini) +INCLUDE_DIRECTORIES(${simpleini_SOURCE_DIR}) + +IF(NOT PERIMETER_WINDOWS) + #Non Windows target specifics + + #pevents retrieval + FetchContent_Declare(pevents + GIT_REPOSITORY https://github.com/neosmart/pevents + GIT_TAG "d6afcbc629cf806f6465238849278e530e1d56fb" + GIT_SHALLOW OFF + ) + FetchContent_MakeAvailable(pevents) + ADD_DEFINITIONS(-DWFMO) + + #Includes + INCLUDE_DIRECTORIES( + "${PROJECT_SOURCE_DIR}/Source/Exodus" + "${pevents_SOURCE_DIR}/src" + ) +ENDIF() + +IF(OPTION_D3D9) + #D3D9 Renderer enabled + IF(PERIMETER_WINDOWS) + #DirectX SDK libs + INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/MSDXSDK_02_06/Include") + ELSE() + #For non windows we use DXVK to provide headers and impl + MESSAGE("Using DXVK for D3D9 API") + + SET(DXVK_BUILD_OPTIONS --buildtype=release -Denable_d3d9=true -Denable_d3d11=false -Denable_d3d10=false -Denable_dxgi=false) + #DXVK wrapper lib retrieval and building + IF (MACOS) + IF (CMAKE_OSX_ARCHITECTURES) + #Cross compile script, this assumes CMAKE_OSX_ARCHITECTURES only contains 1 arch + SET(DXVK_BUILD_COMMAND + ${PROJECT_SOURCE_DIR}/macos/dxvk-native.sh + ${CMAKE_OSX_ARCHITECTURES} + ${PROJECT_SOURCE_DIR}/macos/ + ) + ENDIF() + #TODO change this to upstream once DXVK2 works with MoltenVK and MacOS + SET(OPTION_DXVK_1 ON) + ENDIF() + IF(OPTION_DXVK_1) + set(DXVK_GIT_URL https://github.com/IonAgorria/dxvk-native) + set(DXVK_GIT_TAG "43aedc756cbd620b9ee8b1cf2c17b17cc49b3781") + ELSE() + set(DXVK_GIT_URL https://github.com/doitsujin/dxvk) + set(DXVK_GIT_TAG "80e075406b1b7d9d2508c9dc05e9745b3d3cf7e2") # v2.3 + set(DXVK_BUILD_OPTIONS ${DXVK_BUILD_OPTIONS} -Ddxvk_native_wsi=sdl2) + ENDIF() + IF("${DXVK_BUILD_COMMAND}" STREQUAL "") + SET(DXVK_BUILD_COMMAND meson setup) + ENDIF() + IF(OPTION_DXVK_SOURCE_DIR) + MESSAGE("DXVK Source path provided: ${OPTION_DXVK_SOURCE_DIR}") + ExternalProject_Add(dxvk + SOURCE_DIR ${OPTION_DXVK_SOURCE_DIR} + BUILD_ALWAYS OFF + CONFIGURE_HANDLED_BY_BUILD ON + CONFIGURE_COMMAND ${DXVK_BUILD_COMMAND} ${OPTION_DXVK_SOURCE_DIR} ${DXVK_BUILD_OPTIONS} + BUILD_COMMAND ninja + INSTALL_COMMAND "" + ) + ELSE() + ExternalProject_Add(dxvk + GIT_REPOSITORY ${DXVK_GIT_URL} + GIT_TAG ${DXVK_GIT_TAG} + GIT_SHALLOW OFF + BUILD_ALWAYS OFF + CONFIGURE_HANDLED_BY_BUILD ON + CONFIGURE_COMMAND ${DXVK_BUILD_COMMAND} ../dxvk ${DXVK_BUILD_OPTIONS} + BUILD_COMMAND ninja + INSTALL_COMMAND "" + ) + ENDIF() + ExternalProject_Get_property(dxvk SOURCE_DIR BINARY_DIR) + set(DXVK_INCLUDE_DIRS + "${SOURCE_DIR}/include/native/directx" + "${SOURCE_DIR}/include/native/windows" + ) + IF (MACOS) + set(DXVK_D3D9_LIB ${BINARY_DIR}/src/d3d9/libdxvk_d3d9.dylib) + ELSE() + set(DXVK_D3D9_LIB ${BINARY_DIR}/src/d3d9/libdxvk_d3d9.so) + ENDIF() + + INCLUDE_DIRECTORIES("${DXVK_INCLUDE_DIRS}") + ENDIF() +ENDIF() + +#This is the only way I know to force download of external project from any targets +ADD_CUSTOM_TARGET(dependencies ALL) + ADD_SUBDIRECTORY("Source") diff --git a/Source/AI/CMakeLists.txt b/Source/AI/CMakeLists.txt new file mode 100644 index 000000000..1b9c02b47 --- /dev/null +++ b/Source/AI/CMakeLists.txt @@ -0,0 +1,24 @@ +add_library(AI STATIC + AiBuilding.cpp + AIMain.cpp + AITileMap.cpp + ClusterFind.cpp +) + +target_include_directories(AI PRIVATE + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Render/client" + "${PROJECT_SOURCE_DIR}/Source/Physics" + "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/Network" + "${PROJECT_SOURCE_DIR}/Source/Units" + "${PROJECT_SOURCE_DIR}/Source/UserInterface" + "${PROJECT_SOURCE_DIR}/Source/Sound" + "${PROJECT_SOURCE_DIR}/Source/Game" + . +) + +target_compile_options(AI PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 94abce898..2e02f1ecb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -1,125 +1,3 @@ -SET(perimeter_SRCS "") -SET(perimeter_LINK_LIBS - #Our libs - XTool - PluginMAX - Terra - tx3d - Render - Sound - Network -) - -IF(FFMPEG_FOUND) - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${FFMPEG_LIBRARIES}) - IF(OPTION_FFMPEG_MOVIES) - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${FFMPEG_LIBSWSCALE_LIBRARIES} ${FFMPEG_LIBAVFILTER_LIBRARIES}) - ENDIF() - #Optionally link since static ffmpeg builds require libswresample - IF(FFMPEG_LIBSWRESAMPLE_FOUND) - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${FFMPEG_LIBSWRESAMPLE_LIBRARIES}) - ENDIF() -ENDIF() - -#simpleini -FetchContent_Declare(simpleini - GIT_REPOSITORY https://github.com/brofield/simpleini - GIT_TAG "7350fcc9228f410309734c3fb6dae2bf513cdd98" - GIT_SHALLOW OFF -) -FetchContent_MakeAvailable(simpleini) -INCLUDE_DIRECTORIES(${simpleini_SOURCE_DIR}) - -IF(NOT PERIMETER_WINDOWS) - #Non Windows target specifics - - #pevents retrieval - FetchContent_Declare(pevents - GIT_REPOSITORY https://github.com/neosmart/pevents - GIT_TAG "d6afcbc629cf806f6465238849278e530e1d56fb" - GIT_SHALLOW OFF - ) - FetchContent_MakeAvailable(pevents) - ADD_DEFINITIONS(-DWFMO) - - #Includes - INCLUDE_DIRECTORIES( - "${PROJECT_SOURCE_DIR}/Source/Exodus" - "${pevents_SOURCE_DIR}/src" - ) - - IF (OPTION_D3D9) - MESSAGE("Using DXVK for D3D9 API") - - SET(DXVK_BUILD_OPTIONS --buildtype=release -Denable_d3d9=true -Denable_d3d11=false -Denable_d3d10=false -Denable_dxgi=false) - #DXVK wrapper lib retrieval and building - IF (MACOS) - IF (CMAKE_OSX_ARCHITECTURES) - #Cross compile script, this assumes CMAKE_OSX_ARCHITECTURES only contains 1 arch - SET(DXVK_BUILD_COMMAND - ${PROJECT_SOURCE_DIR}/macos/dxvk-native.sh - ${CMAKE_OSX_ARCHITECTURES} - ${PROJECT_SOURCE_DIR}/macos/ - ) - ENDIF() - #TODO change this to upstream once DXVK2 works with MoltenVK and MacOS - SET(OPTION_DXVK_1 ON) - ENDIF() - IF(OPTION_DXVK_1) - set(DXVK_GIT_URL https://github.com/IonAgorria/dxvk-native) - set(DXVK_GIT_TAG "43aedc756cbd620b9ee8b1cf2c17b17cc49b3781") - ELSE() - set(DXVK_GIT_URL https://github.com/doitsujin/dxvk) - set(DXVK_GIT_TAG "80e075406b1b7d9d2508c9dc05e9745b3d3cf7e2") # v2.3 - set(DXVK_BUILD_OPTIONS ${DXVK_BUILD_OPTIONS} -Ddxvk_native_wsi=sdl2) - ENDIF() - IF("${DXVK_BUILD_COMMAND}" STREQUAL "") - SET(DXVK_BUILD_COMMAND meson setup) - ENDIF() - IF(OPTION_DXVK_SOURCE_DIR) - MESSAGE("DXVK Source path provided: ${OPTION_DXVK_SOURCE_DIR}") - ExternalProject_Add(dxvk - SOURCE_DIR ${OPTION_DXVK_SOURCE_DIR} - BUILD_ALWAYS OFF - CONFIGURE_HANDLED_BY_BUILD ON - CONFIGURE_COMMAND ${DXVK_BUILD_COMMAND} ${OPTION_DXVK_SOURCE_DIR} ${DXVK_BUILD_OPTIONS} - BUILD_COMMAND ninja - INSTALL_COMMAND "" - ) - ELSE() - ExternalProject_Add(dxvk - GIT_REPOSITORY ${DXVK_GIT_URL} - GIT_TAG ${DXVK_GIT_TAG} - GIT_SHALLOW OFF - BUILD_ALWAYS OFF - CONFIGURE_HANDLED_BY_BUILD ON - CONFIGURE_COMMAND ${DXVK_BUILD_COMMAND} ../dxvk ${DXVK_BUILD_OPTIONS} - BUILD_COMMAND ninja - INSTALL_COMMAND "" - ) - ENDIF() - ExternalProject_Get_property(dxvk SOURCE_DIR BINARY_DIR) - set(DXVK_INCLUDE_DIRS - "${SOURCE_DIR}/include/native/directx" - "${SOURCE_DIR}/include/native/windows" - ) - IF (MACOS) - set(DXVK_D3D9_LIB ${BINARY_DIR}/src/d3d9/libdxvk_d3d9.dylib) - ELSE() - set(DXVK_D3D9_LIB ${BINARY_DIR}/src/d3d9/libdxvk_d3d9.so) - ENDIF() - - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${DXVK_D3D9_LIB}) - INCLUDE_DIRECTORIES("${DXVK_INCLUDE_DIRS}") - ENDIF() -ELSEIF(OPTION_D3D9) - #DirectX SDK libs - INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/MSDXSDK_02_06/Include") -ENDIF() - -#This is the only way I know to force download of external project from any targets -ADD_CUSTOM_TARGET(dependencies ALL) - ADD_SUBDIRECTORY("XPrm") ADD_SUBDIRECTORY("Scripts") ADD_SUBDIRECTORY("XTool") @@ -129,275 +7,20 @@ ADD_SUBDIRECTORY("tx3d") ADD_SUBDIRECTORY("Render") ADD_SUBDIRECTORY("Sound") ADD_SUBDIRECTORY("Network") +ADD_SUBDIRECTORY("Util") +ADD_SUBDIRECTORY("Units") +ADD_SUBDIRECTORY("UserInterface") +ADD_SUBDIRECTORY("Physics") +ADD_SUBDIRECTORY("AI") +ADD_SUBDIRECTORY("GeoLogic") +ADD_SUBDIRECTORY("HT") IF(PERIMETER_EXODUS) - MESSAGE("Using Exodus wrapper - WARNING: EXPERIMENTAL!") ADD_SUBDIRECTORY("Exodus") - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} Exodus) - IF (OPTION_D3D9) - #Make Exodus depend on lib that provides D3D9 API - ADD_DEPENDENCIES(Exodus dxvk) - #Make other modules depend on Exodus - ADD_DEPENDENCIES(dependencies Exodus) - ENDIF() -ENDIF() -if(NOT OPTION_FINAL_VERSION) - ADD_SUBDIRECTORY("TriggerEditor") -ENDIF() - -#Add Windows and DirectX libs -IF(PERIMETER_WINDOWS) - #DirectX 64 or 32 libs - IF(PERIMETER_ARCH_64) - MESSAGE("Linking against DirectX 64 bits") - SET(LIBS_MSDXSDK ${PROJECT_SOURCE_DIR}/MSDXSDK_02_06/Lib/x64) - ELSE() - MESSAGE("Linking against DirectX 32 bits") - SET(LIBS_MSDXSDK ${PROJECT_SOURCE_DIR}/MSDXSDK_02_06/Lib/x86) - ENDIF() - LINK_DIRECTORIES(BEFORE ${LIBS_MSDXSDK}) - - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} - ${LIBS_MSDXSDK}/d3d9.lib - ${LIBS_MSDXSDK}/d3dx9.lib - ${LIBS_MSDXSDK}/DxErr.lib - ) - - #Use these libs as AVI fallback - IF(NOT FFMPEG_FOUND) - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} - vfw32 - ) - ENDIF() - - IF(MSVC_CL_BUILD) - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} - legacy_stdio_definitions - ) - ELSE() - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} - mingw32 - ) - ENDIF() ENDIF() -INCLUDE_DIRECTORIES( - "${PROJECT_SOURCE_DIR}/Source/Game" - "${PROJECT_SOURCE_DIR}/Source/XTool" - "${PROJECT_SOURCE_DIR}/Source/XPrm" #For Statistics.h - "${PROJECT_SOURCE_DIR}/Source/Util" - "${PROJECT_SOURCE_DIR}/Source/Render/inc" - "${PROJECT_SOURCE_DIR}/Source/Terra" - "${PROJECT_SOURCE_DIR}/Source/UserInterface" - "${PROJECT_SOURCE_DIR}/Source/GeoLogic" - "${PROJECT_SOURCE_DIR}/Source/Network" - "${PROJECT_SOURCE_DIR}/Source/Units" - "${PROJECT_SOURCE_DIR}/Source/Render/client" - "${PROJECT_SOURCE_DIR}/Source/Physics" - "${PROJECT_SOURCE_DIR}/Source/AI" - "${PROJECT_SOURCE_DIR}/Source/Sound" - "${PROJECT_SOURCE_DIR}/Source/Scripts" - "${PROJECT_SOURCE_DIR}/Source/tx3d" - "${PROJECT_SOURCE_DIR}/Source/Game/Scripts" -) - -SET(perimeter_SRCS ${perimeter_SRCS} - Game/CameraManager.cpp - Game/MonkManager.cpp - Game/MusicManager.cpp - Game/VideoPlayer.cpp - Game/qd_textdb.cpp - Game/Texts.cpp - Units/Economic.cpp - Game/Player.cpp - Game/Universe.cpp - Game/PerimeterDataChannel.cpp - Game/Runtime.cpp - Game/CopyToGraph.cpp - Game/Region.cpp - Game/GameContent.cpp - Units/DefenceMap.cpp - Units/GenericControls.cpp - Units/GeoControl.cpp - Units/Interpolation.cpp - Units/MutationEngine.cpp - Units/ToolzerController.cpp - Units/UnitAttribute.cpp - Units/GenericUnit.cpp - Units/TrustMap.cpp - Units/CorpseDynamic.cpp - Units/Nature.cpp - Units/RealInterpolation.cpp - Units/RealUnit.cpp - Units/IronBullet.cpp - Units/IronExplosion.cpp - Units/IronLegion.cpp - Units/SecondGun.cpp - Units/Squad.cpp - Units/BuildingBlock.cpp - Units/BuildMaster.cpp - Units/FrameChild.cpp - Units/FrameCore.cpp - Units/FrameField.cpp - Units/FrameLegion.cpp - Units/FramePlant.cpp - Units/IronBuilding.cpp - Units/IronClusterUnit.cpp - Units/IronDigger.cpp - Units/IronFrame.cpp - Units/IronPort.cpp - Units/TerrainMaster.cpp - Units/WarBuilding.cpp - Units/FilthAnts.cpp - Units/FilthCrow.cpp - Units/FilthDaemon.cpp - Units/FilthDragon.cpp - Units/FilthEye.cpp - Units/FilthGhost.cpp - Units/FilthRat.cpp - Units/FilthShark.cpp - Units/FilthVolcano.cpp - Units/FilthWasp.cpp - Units/FilthWorm.cpp - Units/GenericFilth.cpp - Util/BinaryArchive.cpp - Game/Config.cpp - Util/DebugPrm.cpp - Util/DebugUtil.cpp - Util/EditArchive.cpp - Util/MissionDescription.cpp - Util/SaveSQSH.cpp - Util/SaveConditions.cpp - Util/SaveActions.cpp - Util/SaveOthers.cpp - Util/Save.cpp - Util/AVWrapper.cpp - Util/SynchroTimer.cpp - Util/SystemUtil.cpp - Util/XPrmArchive.cpp - Util/Localization.cpp - Util/ANIFile.cpp - UserInterface/BGScene.cpp - UserInterface/chaos.cpp - UserInterface/controls.cpp - UserInterface/ExternalShow.cpp - UserInterface/SourceUIResolution.cpp - UserInterface/GameShell.cpp - UserInterface/HotKey.cpp - UserInterface/Installer.cpp - UserInterface/InterfaceScript.cpp - UserInterface/LogicUpdater.cpp - UserInterface/MissionEdit.cpp - UserInterface/PerimeterShellDisp.cpp - UserInterface/PerimeterShellUI.cpp - UserInterface/ReelManager.cpp - UserInterface/SelectManager.cpp - UserInterface/ShellCmd.cpp - UserInterface/ShellLogDisp.cpp - UserInterface/ShellUtils.cpp - UserInterface/UserSingleProfile.cpp - UserInterface/SCodeInterpreter/Commands.cpp - UserInterface/SCodeInterpreter/Containers.cpp - UserInterface/SCodeInterpreter/Frame.cpp - UserInterface/SCodeInterpreter/Interpreter.cpp - UserInterface/SCodeInterpreter/Knowledge.cpp - UserInterface/SCodeInterpreter/World.cpp - UserInterface/History3D.cpp - UserInterface/HistoryScene.cpp - UserInterface/HistorySceneCamera.cpp - UserInterface/BelligerentSelect.cpp - UserInterface/BattleMenu.cpp - UserInterface/GraphicsOptions.cpp - UserInterface/MainMenu.cpp - UserInterface/Menu/SingleMenu.cpp - UserInterface/Menu/AddonsMenu.cpp - UserInterface/Menu/CommunityMenu.cpp - UserInterface/Menu/MultiplayerList.cpp - UserInterface/Menu/MultiplayerHost.cpp - UserInterface/Menu/MultiplayerJoin.cpp - UserInterface/Menu/MultiplayerLobby.cpp - UserInterface/MessageBox.cpp - UserInterface/MonoSelect.cpp - UserInterface/OptionsMenu.cpp - Physics/Missile.cpp - Physics/MultiBodyDispatcher.cpp - Physics/Mutation.cpp - Physics/RigidBody.cpp - Physics/Rocket.cpp - AI/AiBuilding.cpp - AI/AIMain.cpp - AI/AITileMap.cpp - AI/ClusterFind.cpp - GeoLogic/LineAntiAlias.cpp - GeoLogic/TerraCleft.cpp - HT/ht.cpp - HT/LagStatistic.cpp - HT/StreamInterpolation.cpp - Units/EnergyConsumer.cpp - TriggerEditor/TriggerExport.cpp - Units/Triggers.cpp - UserInterface/Menu/MultiplayerCommon.cpp) - -ADD_EXECUTABLE(perimeter ${PERIMETER_EXE_FLAGS} ${perimeter_SRCS}) - -#Add TriggerEditor if(NOT OPTION_FINAL_VERSION) - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} TriggerEditor) -ENDIF() - -#Add gperftools -IF(OPTION_GPERFTOOLS) - MESSAGE("WARNING: Linking gperftools") - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} -ltcmalloc -lprofiler) -ENDIF() - -#Add XPrmLib if Debug build -IF(PERIMETER_DEBUG) - ADD_DEPENDENCIES(dependencies XPrmLib) - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} XPrmLib) -ENDIF() - -SET(perimeter_LINK_LIBS - #Libraries - ${EXE_LINK_LIBS_PRE} - ${perimeter_LINK_LIBS} - ${SDL2_LIBRARY} - ${SDL2_IMAGE_LIBRARY} - ${SDL2_MIXER_LIBRARY} - ${SDL2_NET_LIBRARY} - ${EXE_LINK_LIBS_POST} -) - -IF(PERIMETER_WINDOWS) - SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${SDL2MAIN_LIBRARY}) -ENDIF() - -TARGET_LINK_LIBRARIES(perimeter PRIVATE ${perimeter_LINK_LIBS}) - -IF(OPTION_PROCESS_SCRIPTS) - ADD_DEPENDENCIES(dependencies ScriptsCompile) - MESSAGE("Scripts will be compiled") -ELSE() - MESSAGE("Not compiling Scripts") -ENDIF() -IF(OPTION_CHECK_SCRIPTS) - ADD_DEPENDENCIES(dependencies ScriptsCheck) - MESSAGE("Scripts will be checked") -ELSE() - MESSAGE("Not checking Scripts") + ADD_SUBDIRECTORY("TriggerEditor") ENDIF() -ADD_DEPENDENCIES(PluginMAX dependencies) -ADD_DEPENDENCIES(Terra dependencies) -ADD_DEPENDENCIES(tx3d dependencies) -ADD_DEPENDENCIES(Render dependencies) -ADD_DEPENDENCIES(Sound dependencies) -ADD_DEPENDENCIES(Network dependencies) -ADD_DEPENDENCIES(perimeter dependencies) -target_compile_options(perimeter PRIVATE ${PERIMETER_COMPILE_OPTIONS}) - -#Install rules -IF(OPTION_D3D9 AND NOT PERIMETER_WINDOWS) - install (FILES ${DXVK_D3D9_LIB} TYPE LIB) -ENDIF() -install (TARGETS perimeter RUNTIME) +ADD_SUBDIRECTORY("Game") diff --git a/Source/Exodus/CMakeLists.txt b/Source/Exodus/CMakeLists.txt index cc5f4a6a8..499f62c8c 100644 --- a/Source/Exodus/CMakeLists.txt +++ b/Source/Exodus/CMakeLists.txt @@ -1,18 +1,23 @@ -INCLUDE_DIRECTORIES( - BEFORE . - "${PROJECT_SOURCE_DIR}/Source/XTool" -) - -SET(Exodus_SRCS +add_library(Exodus STATIC exodus.cpp ${pevents_SOURCE_DIR}/src/pevents.cpp ) -IF(OPTION_D3D9) - SET(Exodus_SRCS ${Exodus_SRCS} d3dx9.cpp) -ENDIF() +target_include_directories(Exodus PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/XTool" +) -ADD_LIBRARY(Exodus STATIC ${Exodus_SRCS}) target_compile_options(Exodus PRIVATE ${PERIMETER_COMPILE_OPTIONS}) +IF(OPTION_D3D9) + add_library(ExodusD3D9 STATIC d3dx9.cpp) + + target_include_directories(ExodusD3D9 PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/XTool" + ) + + target_compile_options(ExodusD3D9 PRIVATE ${PERIMETER_COMPILE_OPTIONS}) +ENDIF() diff --git a/Source/Game/CMakeLists.txt b/Source/Game/CMakeLists.txt new file mode 100644 index 000000000..049e04787 --- /dev/null +++ b/Source/Game/CMakeLists.txt @@ -0,0 +1,190 @@ +add_executable(perimeter ${PERIMETER_EXE_FLAGS} + CameraManager.cpp + MonkManager.cpp + MusicManager.cpp + VideoPlayer.cpp + qd_textdb.cpp + Texts.cpp + Player.cpp + Universe.cpp + PerimeterDataChannel.cpp + Runtime.cpp + CopyToGraph.cpp + Region.cpp + GameContent.cpp + Config.cpp + "${PROJECT_SOURCE_DIR}/Source/TriggerEditor/TriggerExport.cpp" +) + +target_include_directories(perimeter PRIVATE + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/XPrm" #For Statistics.h + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Render/client" + "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/UserInterface" + "${PROJECT_SOURCE_DIR}/Source/Network" + "${PROJECT_SOURCE_DIR}/Source/Units" + "${PROJECT_SOURCE_DIR}/Source/Physics" + "${PROJECT_SOURCE_DIR}/Source/AI" + "${PROJECT_SOURCE_DIR}/Source/Sound" + "${PROJECT_SOURCE_DIR}/Source/Scripts" + "${PROJECT_SOURCE_DIR}/Source/Game/Scripts" + . +) + +SET(perimeter_LINK_LIBS + #Our libs + XTool + PluginMAX + Terra + tx3d + Render + Sound + Network + Util + Units + UserInterface + Physics + AI + GeoLogic + HT +) + +IF(PERIMETER_WINDOWS) + #Add Windows and DirectX libs + + #DirectX 64 or 32 libs + IF(OPTION_D3D9) + IF(PERIMETER_ARCH_64) + MESSAGE("Linking against DirectX 64 bits") + SET(LIBS_MSDXSDK ${PROJECT_SOURCE_DIR}/MSDXSDK_02_06/Lib/x64) + ELSE() + MESSAGE("Linking against DirectX 32 bits") + SET(LIBS_MSDXSDK ${PROJECT_SOURCE_DIR}/MSDXSDK_02_06/Lib/x86) + ENDIF() + LINK_DIRECTORIES(BEFORE ${LIBS_MSDXSDK}) + + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} + ${LIBS_MSDXSDK}/d3d9.lib + ${LIBS_MSDXSDK}/d3dx9.lib + ${LIBS_MSDXSDK}/DxErr.lib + ) + ENDIF() + + #Use these libs as AVI fallback + IF(NOT FFMPEG_FOUND) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} + vfw32 + ) + ENDIF() + + IF(MSVC_CL_BUILD) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} + legacy_stdio_definitions + ) + ELSE() + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} + mingw32 + ) + ENDIF() +ELSE() + IF(OPTION_D3D9) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${DXVK_D3D9_LIB}) + ENDIF () +ENDIF() + +#Add TriggerEditor +if(NOT OPTION_FINAL_VERSION) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} TriggerEditor) +ENDIF() + + +#Add gperftools +IF(OPTION_GPERFTOOLS) + MESSAGE("WARNING: Linking gperftools") + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} -ltcmalloc -lprofiler) +ENDIF() + +#Add XPrmLib if Debug build +IF(PERIMETER_DEBUG) + ADD_DEPENDENCIES(dependencies XPrmLib) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} XPrmLib) +ENDIF() + +#FFMPEG +IF(FFMPEG_FOUND) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${FFMPEG_LIBRARIES}) + IF(OPTION_FFMPEG_MOVIES) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${FFMPEG_LIBSWSCALE_LIBRARIES} ${FFMPEG_LIBAVFILTER_LIBRARIES}) + ENDIF() + #Optionally link since static ffmpeg builds require libswresample + IF(FFMPEG_LIBSWRESAMPLE_FOUND) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${FFMPEG_LIBSWRESAMPLE_LIBRARIES}) + ENDIF() +ENDIF() + +IF(PERIMETER_EXODUS) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} Exodus) + IF (OPTION_D3D9) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ExodusD3D9) + #Make Exodus depend on lib that provides D3D9 API + ADD_DEPENDENCIES(ExodusD3D9 dxvk) + #Make other modules depend on Exodus + ADD_DEPENDENCIES(dependencies ExodusD3D9) + ENDIF() +ENDIF() + +IF(OPTION_PROCESS_SCRIPTS) + ADD_DEPENDENCIES(dependencies ScriptsCompile) + MESSAGE("Scripts will be compiled") +ELSE() + MESSAGE("Not compiling Scripts") +ENDIF() +IF(OPTION_CHECK_SCRIPTS) + ADD_DEPENDENCIES(dependencies ScriptsCheck) + MESSAGE("Scripts will be checked") +ELSE() + MESSAGE("Not checking Scripts") +ENDIF() + +ADD_DEPENDENCIES(PluginMAX dependencies) +ADD_DEPENDENCIES(Terra dependencies) +ADD_DEPENDENCIES(tx3d dependencies) +ADD_DEPENDENCIES(Render dependencies) +ADD_DEPENDENCIES(Sound dependencies) +ADD_DEPENDENCIES(Network dependencies) +ADD_DEPENDENCIES(Util dependencies) +ADD_DEPENDENCIES(Units dependencies) +ADD_DEPENDENCIES(UserInterface dependencies) +ADD_DEPENDENCIES(Physics dependencies) +ADD_DEPENDENCIES(AI dependencies) +ADD_DEPENDENCIES(GeoLogic dependencies) +ADD_DEPENDENCIES(HT dependencies) +ADD_DEPENDENCIES(perimeter dependencies) +target_compile_options(perimeter PRIVATE ${PERIMETER_COMPILE_OPTIONS}) + +SET(perimeter_LINK_LIBS + #Libraries + ${EXE_LINK_LIBS_PRE} + ${perimeter_LINK_LIBS} + ${SDL2_LIBRARY} + ${SDL2_IMAGE_LIBRARY} + ${SDL2_MIXER_LIBRARY} + ${SDL2_NET_LIBRARY} + ${EXE_LINK_LIBS_POST} +) + +IF(PERIMETER_WINDOWS) + SET(perimeter_LINK_LIBS ${perimeter_LINK_LIBS} ${SDL2MAIN_LIBRARY}) +ENDIF() + +target_link_libraries(perimeter PRIVATE ${perimeter_LINK_LIBS}) + +#Install rules +IF(OPTION_D3D9 AND NOT PERIMETER_WINDOWS) + install (FILES ${DXVK_D3D9_LIB} TYPE LIB) +ENDIF() +install (TARGETS perimeter RUNTIME) diff --git a/Source/Game/GameContent.cpp b/Source/Game/GameContent.cpp index 4b92c0999..baad2f88e 100644 --- a/Source/Game/GameContent.cpp +++ b/Source/Game/GameContent.cpp @@ -1,5 +1,6 @@ #include #include "StdAfx.h" +#include "UnitAttribute.h" #include "GameContent.h" #include "files/files.h" diff --git a/Source/Game/PerimeterDataChannel.cpp b/Source/Game/PerimeterDataChannel.cpp index 4c9532747..7020a9480 100644 --- a/Source/Game/PerimeterDataChannel.cpp +++ b/Source/Game/PerimeterDataChannel.cpp @@ -1,5 +1,4 @@ #include "StdAfx.h" -#include "NetPlayer.h" #include "Runtime.h" #include "GameShell.h" #include "CameraManager.h" diff --git a/Source/Game/StdAfx.h b/Source/Game/StdAfx.h index 5edda9f10..da4f29f72 100644 --- a/Source/Game/StdAfx.h +++ b/Source/Game/StdAfx.h @@ -48,8 +48,3 @@ #include "SystemUtil.h" #include "DebugUtil.h" - -#include "NetConnection.h" -#include "NetComEventBuffer.h" -#include "CommonEvents.h" - diff --git a/Source/Game/Texts.cpp b/Source/Game/Texts.cpp index 59009b54e..dfccf39d4 100644 --- a/Source/Game/Texts.cpp +++ b/Source/Game/Texts.cpp @@ -1,6 +1,7 @@ #include #include "StdAfx.h" #include "xutl.h" +#include "UnitAttribute.h" #include "GameContent.h" #include "qd_textdb.h" diff --git a/Source/Game/Universe.h b/Source/Game/Universe.h index fe5c55515..3010ae5af 100644 --- a/Source/Game/Universe.h +++ b/Source/Game/Universe.h @@ -1,6 +1,8 @@ #ifndef __UNIVERSE_H__ #define __UNIVERSE_H__ +#include "NetConnection.h" +#include "NetComEventBuffer.h" #include "GenericControls.h" #include "SafeMath.h" #include "HyperSpace.h" diff --git a/Source/GeoLogic/CMakeLists.txt b/Source/GeoLogic/CMakeLists.txt new file mode 100644 index 000000000..0d84fe3fa --- /dev/null +++ b/Source/GeoLogic/CMakeLists.txt @@ -0,0 +1,16 @@ +add_library(GeoLogic STATIC + LineAntiAlias.cpp + TerraCleft.cpp +) + +target_include_directories(GeoLogic PRIVATE + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/Game" + . +) + +target_compile_options(GeoLogic PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/HT/CMakeLists.txt b/Source/HT/CMakeLists.txt new file mode 100644 index 000000000..84858f2ee --- /dev/null +++ b/Source/HT/CMakeLists.txt @@ -0,0 +1,24 @@ +add_library(HT STATIC + ht.cpp + LagStatistic.cpp + StreamInterpolation.cpp +) + +target_include_directories(HT PRIVATE + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Render/client" + "${PROJECT_SOURCE_DIR}/Source/Physics" + "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/Network" + "${PROJECT_SOURCE_DIR}/Source/Units" + "${PROJECT_SOURCE_DIR}/Source/UserInterface" + "${PROJECT_SOURCE_DIR}/Source/Sound" + "${PROJECT_SOURCE_DIR}/Source/Game" + "${PROJECT_SOURCE_DIR}/Source/AI" + . +) + +target_compile_options(HT PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/HT/ht.cpp b/Source/HT/ht.cpp index 21e1b0a81..c342f874d 100644 --- a/Source/HT/ht.cpp +++ b/Source/HT/ht.cpp @@ -1,9 +1,9 @@ #include "StdAfx.h" +#include "Universe.h" #include "ht.h" #include "GameShell.h" #include "GenericControls.h" #include "Config.h" -#include "Universe.h" #include "LagStatistic.h" #include #include diff --git a/Source/Network/CMakeLists.txt b/Source/Network/CMakeLists.txt index 2d03c7be9..202d8d0d1 100644 --- a/Source/Network/CMakeLists.txt +++ b/Source/Network/CMakeLists.txt @@ -1,9 +1,22 @@ -INCLUDE_DIRECTORIES( +add_library(Network STATIC + CommonEvents.cpp + NetComEventBuffer.cpp + HyperSpace.cpp + ServerList.cpp + P2P_interface1Th.cpp + P2P_interface2Th.cpp + P2P_interface2ThSDL.cpp + P2P_interfaceAnyTh.cpp + NetConnection.cpp +) + +target_include_directories(Network PRIVATE "${PROJECT_SOURCE_DIR}/Source/Game" "${PROJECT_SOURCE_DIR}/Source/XTool" "${PROJECT_SOURCE_DIR}/Source/Util" "${PROJECT_SOURCE_DIR}/Source/Render/inc" "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" "${PROJECT_SOURCE_DIR}/Source/UserInterface" "${PROJECT_SOURCE_DIR}/Source/Network" "${PROJECT_SOURCE_DIR}/Source/Units" @@ -12,20 +25,6 @@ INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/Source/AI" "${PROJECT_SOURCE_DIR}/Source/Sound" . - "${PROJECT_SOURCE_DIR}/Source/Network/Peer2" -) - -SET(Network_SRCS - CommonEvents.cpp - NetComEventBuffer.cpp - HyperSpace.cpp - ServerList.cpp - P2P_interface1Th.cpp - P2P_interface2Th.cpp - P2P_interface2ThSDL.cpp - P2P_interfaceAnyTh.cpp - NetConnection.cpp ) -ADD_LIBRARY(Network STATIC ${Network_SRCS}) target_compile_options(Network PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/Physics/CMakeLists.txt b/Source/Physics/CMakeLists.txt new file mode 100644 index 000000000..b47f838c8 --- /dev/null +++ b/Source/Physics/CMakeLists.txt @@ -0,0 +1,25 @@ +add_library(Physics STATIC + Missile.cpp + MultiBodyDispatcher.cpp + Mutation.cpp + RigidBody.cpp + Rocket.cpp +) + +target_include_directories(Physics PRIVATE + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Render/client" + "${PROJECT_SOURCE_DIR}/Source/Sound" + "${PROJECT_SOURCE_DIR}/Source/Units" + "${PROJECT_SOURCE_DIR}/Source/Network" + "${PROJECT_SOURCE_DIR}/Source/UserInterface" + "${PROJECT_SOURCE_DIR}/Source/AI" + "${PROJECT_SOURCE_DIR}/Source/Game" + . +) + +target_compile_options(Physics PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/Physics/Missile.cpp b/Source/Physics/Missile.cpp index c366acb97..d1f182b3e 100644 --- a/Source/Physics/Missile.cpp +++ b/Source/Physics/Missile.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "terra.h" -#include "RigidBody.h" #include "ForceField.h" +#include "RigidBody.h" RigidBody* GetMissileTest(RigidBody* object,RigidBody* source,RigidBody* target); diff --git a/Source/Physics/MultiBodyDispatcher.cpp b/Source/Physics/MultiBodyDispatcher.cpp index 410d5f39c..4015dad2c 100644 --- a/Source/Physics/MultiBodyDispatcher.cpp +++ b/Source/Physics/MultiBodyDispatcher.cpp @@ -1,5 +1,6 @@ #include "StdAfx.h" #include "Runtime.h" +#include "TypeLibrary.h" #include "RigidBody.h" MultiBodyDispatcher::MultiBodyDispatcher() diff --git a/Source/Physics/Mutation.cpp b/Source/Physics/Mutation.cpp index b2e74aca1..715d9e53a 100644 --- a/Source/Physics/Mutation.cpp +++ b/Source/Physics/Mutation.cpp @@ -1,11 +1,12 @@ +#include #include "StdAfx.h" #include "Mutation.h" #include "Runtime.h" -#include "RigidBody.h" #include "terra.h" #include "PerimeterSound.h" #include "Universe.h" #include "Scripts/Mutation.hi" +#include "RigidBody.h" static float volume_power = 3; static float Volume(float radius) { return 4./3*XM_PI*xm::pow(radius/debuScales.spheres, 3); } diff --git a/Source/Physics/RigidBody.cpp b/Source/Physics/RigidBody.cpp index 480c2d87d..886b9644e 100644 --- a/Source/Physics/RigidBody.cpp +++ b/Source/Physics/RigidBody.cpp @@ -1,11 +1,10 @@ #include "StdAfx.h" #include "terra.h" -#include "RigidBody.h" -#include "ForceField.h" #include "Universe.h" #include "EditArchive.h" #include "XPrmArchive.h" #include "BinaryArchive.h" +#include "RigidBody.h" int RigidBody::IDs; @@ -705,7 +704,7 @@ void RigidBody::show() if(showDebugRigidBody.wayPoints && controlled()){ Vect3f pos = To3D(position()); - Vect3fList::iterator i; + std::vector::iterator i; FOR_EACH(way_points, i){ Vect3f p=To3D(*i); show_line(pos, p, YELLOW); diff --git a/Source/Physics/RigidBody.h b/Source/Physics/RigidBody.h index cbbe169f7..5fbaa7c7f 100644 --- a/Source/Physics/RigidBody.h +++ b/Source/Physics/RigidBody.h @@ -169,7 +169,7 @@ class RigidBody #endif // Control - Vect3fList way_points; + std::vector way_points; private: int ID; diff --git a/Source/Physics/Rocket.cpp b/Source/Physics/Rocket.cpp index 167b35d56..9391a4b93 100644 --- a/Source/Physics/Rocket.cpp +++ b/Source/Physics/Rocket.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "terra.h" -#include "RigidBody.h" #include "ForceField.h" +#include "RigidBody.h" void RigidBody::startRocket(RigidBody& owner) { diff --git a/Source/PluginMAX/CMakeLists.txt b/Source/PluginMAX/CMakeLists.txt index 8d30b5e3d..0855300f0 100644 --- a/Source/PluginMAX/CMakeLists.txt +++ b/Source/PluginMAX/CMakeLists.txt @@ -1,9 +1,4 @@ -INCLUDE_DIRECTORIES( - BEFORE . - "${PROJECT_SOURCE_DIR}/Source/XTool" -) - -SET(PluginMAX_SRCS +add_library(PluginMAX STATIC Src/AnimationMaterial.cpp Src/AnimationMesh.cpp Src/AnimLight.cpp @@ -25,5 +20,9 @@ SET(PluginMAX_SRCS ZIPStream.cpp ) -ADD_LIBRARY(PluginMAX STATIC ${PluginMAX_SRCS}) target_compile_options(PluginMAX PRIVATE ${PERIMETER_COMPILE_OPTIONS}) + +target_include_directories(PluginMAX PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/XTool" +) diff --git a/Source/Render/CMakeLists.txt b/Source/Render/CMakeLists.txt index a525bc6d7..ad0233a9f 100644 --- a/Source/Render/CMakeLists.txt +++ b/Source/Render/CMakeLists.txt @@ -1,15 +1,3 @@ -INCLUDE_DIRECTORIES( - BEFORE . - "inc" - "src" - "client" - "tracker" - "${PROJECT_SOURCE_DIR}/Source/Util" - "${PROJECT_SOURCE_DIR}/Source/PluginMAX/Inc" - "${PROJECT_SOURCE_DIR}/Source/PluginMAX" - "${PROJECT_SOURCE_DIR}/Source/XTool" -) - SET(Render_SRCS src/Unknown.cpp src/umath.cpp @@ -61,9 +49,6 @@ SET(Render_SRCS ) IF (OPTION_D3D9) - INCLUDE_DIRECTORIES( - "D3D" - ) SET(Render_SRCS ${Render_SRCS} shader/shaders.cpp D3D/AdapterMode.cpp @@ -75,6 +60,24 @@ IF (OPTION_D3D9) ) ENDIF() +add_library(Render STATIC ${Render_SRCS}) + +IF (OPTION_D3D9) + target_include_directories(Render PRIVATE "D3D") +ENDIF() + +target_include_directories(Render PRIVATE + BEFORE . + "inc" + "src" + "client" + "tracker" + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/PluginMAX/Inc" + "${PROJECT_SOURCE_DIR}/Source/PluginMAX" + "${PROJECT_SOURCE_DIR}/Source/XTool" +) + SET(Render_LINK_LIBS PluginMAX) IF (OPTION_SOKOL) @@ -82,7 +85,6 @@ IF (OPTION_SOKOL) SET(Render_LINK_LIBS ${Render_LINK_LIBS} RenderSokol) ENDIF() -ADD_LIBRARY(Render STATIC ${Render_SRCS}) -target_compile_options(Render PRIVATE ${PERIMETER_COMPILE_OPTIONS}) +target_link_libraries(Render PRIVATE ${Render_LINK_LIBS}) -TARGET_LINK_LIBRARIES(Render PRIVATE ${Render_LINK_LIBS}) +target_compile_options(Render PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/Render/sokol/CMakeLists.txt b/Source/Render/sokol/CMakeLists.txt index 7fe9c5f75..7505c4ec8 100644 --- a/Source/Render/sokol/CMakeLists.txt +++ b/Source/Render/sokol/CMakeLists.txt @@ -5,7 +5,6 @@ FetchContent_Declare(sokol GIT_SHALLOW OFF ) FetchContent_MakeAvailable(sokol) -include_directories("${sokol_SOURCE_DIR}/") IF (OPTION_PROCESS_SHADERS) #Download precompiled sokol-shdc @@ -118,4 +117,15 @@ IF (OPTION_PROCESS_SHADERS) ENDIF() ADD_DEPENDENCIES(RenderSokol dependencies) +target_include_directories(RenderSokol PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Render/src" + "${PROJECT_SOURCE_DIR}/Source/Render/client" + "${PROJECT_SOURCE_DIR}/Source/Render/tracker" + "${sokol_SOURCE_DIR}/" +) + target_link_libraries(RenderSokol PRIVATE ${RenderSokol_LINK_LIBS}) diff --git a/Source/Scripts/SquadShellEnums.inl b/Source/Scripts/SquadShellEnums.inl index 73b9dc337..a3f6dc6b0 100644 --- a/Source/Scripts/SquadShellEnums.inl +++ b/Source/Scripts/SquadShellEnums.inl @@ -697,6 +697,8 @@ enum ShellControlID // SQSH_MAX = 0xFFFFFFFF }; +DECLARE_ENUM_DESCRIPTOR(ShellControlID) + enum SHELL_CONTROL_STATE { SQSH_VISIBLE = 1<<0, diff --git a/Source/Sound/AudioPlayer.cpp b/Source/Sound/AudioPlayer.cpp index 6341bd131..609022811 100644 --- a/Source/Sound/AudioPlayer.cpp +++ b/Source/Sound/AudioPlayer.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "StdAfxSound.h" #include "xmath.h" #include "SoundInternal.h" #include "files/files.h" diff --git a/Source/Sound/C3D.cpp b/Source/Sound/C3D.cpp index c4ef833e4..c72fae26f 100644 --- a/Source/Sound/C3D.cpp +++ b/Source/Sound/C3D.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "StdAfxSound.h" #include "../Render/inc/RenderMT.h" #include "C3D.h" #include "SoundInternal.h" diff --git a/Source/Sound/CMakeLists.txt b/Source/Sound/CMakeLists.txt index f527a80f6..e7228aef4 100644 --- a/Source/Sound/CMakeLists.txt +++ b/Source/Sound/CMakeLists.txt @@ -1,10 +1,4 @@ -INCLUDE_DIRECTORIES( - BEFORE . - "${PROJECT_SOURCE_DIR}/Source/Util" - "${PROJECT_SOURCE_DIR}/Source/XTool" -) - -SET(Sound_SRCS +add_library(Sound STATIC SoundScript.cpp C3D.cpp PerimeterSound.cpp @@ -14,5 +8,10 @@ SET(Sound_SRCS AudioPlayer.cpp ) -ADD_LIBRARY(Sound STATIC ${Sound_SRCS}) +target_include_directories(Sound PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/XTool" +) + target_compile_options(Sound PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/Sound/PerimeterSound.cpp b/Source/Sound/PerimeterSound.cpp index 1eac2e57e..fcaf3dc43 100644 --- a/Source/Sound/PerimeterSound.cpp +++ b/Source/Sound/PerimeterSound.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "StdAfxSound.h" #include "PerimeterSound.h" #include "SoundInternal.h" #include "../Render/inc/RenderMT.h" diff --git a/Source/Sound/Sample.cpp b/Source/Sound/Sample.cpp index a095e28f7..367ae82ff 100644 --- a/Source/Sound/Sample.cpp +++ b/Source/Sound/Sample.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "StdAfxSound.h" #include "SoundInternal.h" #include "Sample.h" #include diff --git a/Source/Sound/SoftwareBuffer.cpp b/Source/Sound/SoftwareBuffer.cpp index 164d97ba2..78bc0d123 100644 --- a/Source/Sound/SoftwareBuffer.cpp +++ b/Source/Sound/SoftwareBuffer.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "StdAfxSound.h" #include "PerimeterSound.h" #include "SoundInternal.h" #include "../Render/inc/RenderMT.h" diff --git a/Source/Sound/SoundScript.cpp b/Source/Sound/SoundScript.cpp index 1af55e0af..b6a5db512 100644 --- a/Source/Sound/SoundScript.cpp +++ b/Source/Sound/SoundScript.cpp @@ -1,5 +1,5 @@ -#include "StdAfx.h" +#include "StdAfxSound.h" #include #ifdef _WIN32 diff --git a/Source/Sound/StdAfx.h b/Source/Sound/StdAfxSound.h similarity index 91% rename from Source/Sound/StdAfx.h rename to Source/Sound/StdAfxSound.h index bf39fe00d..c1b12e227 100644 --- a/Source/Sound/StdAfx.h +++ b/Source/Sound/StdAfxSound.h @@ -26,3 +26,4 @@ #include #include #include +#include diff --git a/Source/Sound/TextConverter/MessageBlock.cpp b/Source/Sound/TextConverter/MessageBlock.cpp index 255dcc302..78e40f962 100644 --- a/Source/Sound/TextConverter/MessageBlock.cpp +++ b/Source/Sound/TextConverter/MessageBlock.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "StdAfxSound.h" #include "Parse/ParamParse.h" #include "MessageBlock.h" diff --git a/Source/Terra/CMakeLists.txt b/Source/Terra/CMakeLists.txt index b967f6455..d8b41e71d 100644 --- a/Source/Terra/CMakeLists.txt +++ b/Source/Terra/CMakeLists.txt @@ -1,10 +1,4 @@ -INCLUDE_DIRECTORIES( - BEFORE . - "${PROJECT_SOURCE_DIR}/Source/tx3d" - "${PROJECT_SOURCE_DIR}/Source/XTool" -) - -SET(Terra_SRCS +add_library(Terra STATIC crc.cpp f3d.cpp fastmath.cpp @@ -25,7 +19,10 @@ SET(Terra_SRCS LAND.cpp ) -ADD_DEFINITIONS(-D_TX3D_LIBRARY_) +target_include_directories(Terra PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/XTool" +) -ADD_LIBRARY(Terra STATIC ${Terra_SRCS}) target_compile_options(Terra PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/TriggerEditor/StdAfx.cpp b/Source/TriggerEditor/StdAfx.cpp index 8f23aaa66..7970f4d4b 100644 --- a/Source/TriggerEditor/StdAfx.cpp +++ b/Source/TriggerEditor/StdAfx.cpp @@ -2,5 +2,5 @@ // TriggerEditor.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information -#include "StdAfx.h" +#include "StdAfxTriggerEditor.h" diff --git a/Source/TriggerEditor/StdAfx.h b/Source/TriggerEditor/StdAfxTriggerEditor.h similarity index 100% rename from Source/TriggerEditor/StdAfx.h rename to Source/TriggerEditor/StdAfxTriggerEditor.h diff --git a/Source/TriggerEditor/TEFrame.cpp b/Source/TriggerEditor/TEFrame.cpp index f0276efab..83d69b895 100644 --- a/Source/TriggerEditor/TEFrame.cpp +++ b/Source/TriggerEditor/TEFrame.cpp @@ -1,7 +1,7 @@ // TEFrame.cpp : implementation file // -#include "StdAfx.h" +#include "StdAfxTriggerEditor.h" #include "TEFrame.h" #include "resource.h" diff --git a/Source/TriggerEditor/TriggerEditor.cpp b/Source/TriggerEditor/TriggerEditor.cpp index ad8421fce..45ae2f1c9 100644 --- a/Source/TriggerEditor/TriggerEditor.cpp +++ b/Source/TriggerEditor/TriggerEditor.cpp @@ -2,7 +2,7 @@ // ////////////////////////////////////////////////////////////////////// -#include "StdAfx.h" +#include "StdAfxTriggerEditor.h" #include "resource.h" #include "TriggerExport.h" #include "TriggerEditor.h" diff --git a/Source/TriggerEditor/TriggerEditorApp.cpp b/Source/TriggerEditor/TriggerEditorApp.cpp index 2c2baccb9..6d6b9e8ab 100644 --- a/Source/TriggerEditor/TriggerEditorApp.cpp +++ b/Source/TriggerEditor/TriggerEditorApp.cpp @@ -1,7 +1,7 @@ // TriggerEditor.cpp : Defines the initialization routines for the DLL. // -#include "StdAfx.h" +#include "StdAfxTriggerEditor.h" #include "TriggerEditorApp.h" #ifdef _DEBUG diff --git a/Source/TriggerEditor/TriggerExport.cpp b/Source/TriggerEditor/TriggerExport.cpp index ac23bae15..296a6cba7 100644 --- a/Source/TriggerEditor/TriggerExport.cpp +++ b/Source/TriggerEditor/TriggerExport.cpp @@ -7,7 +7,7 @@ #include #endif -#include "StdAfx.h" +#include "StdAfxTriggerEditor.h" #include "XPrmArchive.h" #include "codepages/codepages.h" #include "TriggerExport.h" diff --git a/Source/Units/CMakeLists.txt b/Source/Units/CMakeLists.txt new file mode 100644 index 000000000..1a8908da9 --- /dev/null +++ b/Source/Units/CMakeLists.txt @@ -0,0 +1,69 @@ +add_library(Units STATIC + Economic.cpp + DefenceMap.cpp + GenericControls.cpp + GeoControl.cpp + Interpolation.cpp + MutationEngine.cpp + ToolzerController.cpp + UnitAttribute.cpp + GenericUnit.cpp + TrustMap.cpp + CorpseDynamic.cpp + Nature.cpp + RealInterpolation.cpp + RealUnit.cpp + IronBullet.cpp + IronExplosion.cpp + IronLegion.cpp + SecondGun.cpp + Squad.cpp + BuildingBlock.cpp + BuildMaster.cpp + FrameChild.cpp + FrameCore.cpp + FrameField.cpp + FrameLegion.cpp + FramePlant.cpp + IronBuilding.cpp + IronClusterUnit.cpp + IronDigger.cpp + IronFrame.cpp + IronPort.cpp + TerrainMaster.cpp + WarBuilding.cpp + FilthAnts.cpp + FilthCrow.cpp + FilthDaemon.cpp + FilthDragon.cpp + FilthEye.cpp + FilthGhost.cpp + FilthRat.cpp + FilthShark.cpp + FilthVolcano.cpp + FilthWasp.cpp + FilthWorm.cpp + GenericFilth.cpp + Triggers.cpp + EnergyConsumer.cpp +) + +target_include_directories(Units PRIVATE + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Render/client" + "${PROJECT_SOURCE_DIR}/Source/Network" + "${PROJECT_SOURCE_DIR}/Source/Physics" + "${PROJECT_SOURCE_DIR}/Source/UserInterface" + "${PROJECT_SOURCE_DIR}/Source/Sound" + "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/GeoLogic" + "${PROJECT_SOURCE_DIR}/Source/AI" + "${PROJECT_SOURCE_DIR}/Source/Game/Scripts" + "${PROJECT_SOURCE_DIR}/Source/Game" + . +) + +target_compile_options(Units PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/Units/EnergyConsumer.cpp b/Source/Units/EnergyConsumer.cpp index 15122bc45..6f7a07dcc 100644 --- a/Source/Units/EnergyConsumer.cpp +++ b/Source/Units/EnergyConsumer.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" +#include "Universe.h" #include "EnergyConsumer.h" -#include "Player.h" EnergyConsumer::EnergyConsumer() : player_(0), diff --git a/Source/Units/GenericControls.cpp b/Source/Units/GenericControls.cpp index 126e79cd8..31ec29b28 100644 --- a/Source/Units/GenericControls.cpp +++ b/Source/Units/GenericControls.cpp @@ -1,6 +1,7 @@ #include "StdAfx.h" -#include "GenericControls.h" +#include "NetConnection.h" +#include "NetComEventBuffer.h" #include "Universe.h" #include "Interpolation.h" @@ -9,6 +10,8 @@ #include "Triggers.h" #include "Config.h" +#include "GenericControls.h" + terUnitBase::terUnitBase(const UnitTemplate& data) { attr_.setKey(AttributeIDBelligerent(data.attribute()->ID, data.attribute()->belligerent)); diff --git a/Source/Units/IronLegion.cpp b/Source/Units/IronLegion.cpp index 185c49049..4f149e8f0 100644 --- a/Source/Units/IronLegion.cpp +++ b/Source/Units/IronLegion.cpp @@ -1,11 +1,8 @@ #include "StdAfx.h" -#include "Player.h" -#include "RealInterpolation.h" #include "Universe.h" #include "Squad.h" #include "SecondLegion.h" -#include "PerimeterSound.h" #include "Triggers.h" #include "AIPrm.h" #include "EditArchive.h" diff --git a/Source/Units/RealInterpolation.cpp b/Source/Units/RealInterpolation.cpp index 3c6891556..fe2d5373d 100644 --- a/Source/Units/RealInterpolation.cpp +++ b/Source/Units/RealInterpolation.cpp @@ -1,5 +1,6 @@ #include "StdAfx.h" +#include "UnitAttribute.h" #include "RealInterpolation.h" #include "RealUnit.h" #include "Universe.h" diff --git a/Source/Units/RealUnit.cpp b/Source/Units/RealUnit.cpp index 7b84dc312..5fb528ce0 100644 --- a/Source/Units/RealUnit.cpp +++ b/Source/Units/RealUnit.cpp @@ -847,7 +847,7 @@ void terUnitReal::ShowInfo() if(selected()){ if(attr()->showPath && !BodyPoint->way_points.empty()){ Vect3f posPrev = interpolatedPosition(); - Vect3fList::const_iterator i; + std::vector::const_iterator i; FOR_EACH(BodyPoint->way_points, i){ terRenderDevice->DrawLine(posPrev, *i, pathColor); posPrev = *i; diff --git a/Source/Units/RealUnit.h b/Source/Units/RealUnit.h index 57c95a9f1..45017d9d6 100644 --- a/Source/Units/RealUnit.h +++ b/Source/Units/RealUnit.h @@ -197,8 +197,8 @@ class terUnitReal : public terUnitGeneric void moveToPoint(const Vect3f& v); - Vect3fList& wayPoints() { return wayPoints_; } - const Vect3fList& wayPoints() const { return wayPoints_; } + std::vector& wayPoints() { return wayPoints_; } + const std::vector& wayPoints() const { return wayPoints_; } bool isMoving() const { return !BodyPoint->way_points.empty(); } @@ -262,7 +262,7 @@ class terUnitReal : public terUnitGeneric bool basementInstalled_; - Vect3fList wayPoints_; + std::vector wayPoints_; terUnitBase* targetUnit_; terUnitReal* ownerUnit_; diff --git a/Source/Units/UnitAttribute.h b/Source/Units/UnitAttribute.h index 6f1d87d00..f9bae7315 100644 --- a/Source/Units/UnitAttribute.h +++ b/Source/Units/UnitAttribute.h @@ -45,7 +45,6 @@ DECLARE_ENUM_DESCRIPTOR(WeaponType) DECLARE_ENUM_DESCRIPTOR(EnvironmentalDamageType) DECLARE_ENUM_DESCRIPTOR(SoundID) DECLARE_ENUM_DESCRIPTOR(ChainNodeID) -DECLARE_ENUM_DESCRIPTOR(ShellControlID) DECLARE_ENUM_DESCRIPTOR(ShellControlType) DECLARE_ENUM_DESCRIPTOR(Difficulty) DECLARE_ENUM_DESCRIPTOR(terBelligerent) @@ -63,7 +62,6 @@ DECLARE_ENUM_DESCRIPTOR_ENCLOSED(RigidBodyPrm, RigidBodyType) typedef std::vector Vect2fVect; typedef std::vector Vect2iVect; typedef std::vector Vect3fVect; -typedef std::vector Vect3fList; class AttributeBase; class EffectKey; diff --git a/Source/UserInterface/BGScene.cpp b/Source/UserInterface/BGScene.cpp index 0a2844a0a..c23186606 100644 --- a/Source/UserInterface/BGScene.cpp +++ b/Source/UserInterface/BGScene.cpp @@ -1,4 +1,7 @@ #include "StdAfx.h" +#include "Umath.h" +#include "IRenderDevice.h" +#include "IVisGeneric.h" #include "BGScene.h" #include "GameShellSq.h" #include "SourceUIResolution.h" diff --git a/Source/UserInterface/BattleMenu.cpp b/Source/UserInterface/BattleMenu.cpp index e57fff4e2..334290f97 100644 --- a/Source/UserInterface/BattleMenu.cpp +++ b/Source/UserInterface/BattleMenu.cpp @@ -1,6 +1,5 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "Config.h" #include "Runtime.h" #include "terra.h" @@ -21,6 +20,7 @@ #include "qd_textdb.h" #include "BelligerentSelect.h" #include "files/files.h" +#include "MainMenu.h" extern MusicPlayer gb_Music; extern MissionDescription missionToExec; diff --git a/Source/UserInterface/BelligerentSelect.cpp b/Source/UserInterface/BelligerentSelect.cpp index 78e900288..6985a1d39 100644 --- a/Source/UserInterface/BelligerentSelect.cpp +++ b/Source/UserInterface/BelligerentSelect.cpp @@ -1,11 +1,11 @@ #include "StdAfx.h" #include "GameShellSq.h" #include "qd_textdb.h" -#include "BelligerentSelect.h" #include "GameShell.h" #include "MainMenu.h" #include "PerimeterShellUI.h" #include "GameContent.h" +#include "BelligerentSelect.h" extern std::string getItemTextFromBase(const char *keyStr); diff --git a/Source/UserInterface/CMakeLists.txt b/Source/UserInterface/CMakeLists.txt new file mode 100644 index 000000000..a15c14d83 --- /dev/null +++ b/Source/UserInterface/CMakeLists.txt @@ -0,0 +1,65 @@ +add_library(UserInterface STATIC + BGScene.cpp + chaos.cpp + controls.cpp + ExternalShow.cpp + SourceUIResolution.cpp + GameShell.cpp + HotKey.cpp + Installer.cpp + InterfaceScript.cpp + LogicUpdater.cpp + MissionEdit.cpp + PerimeterShellDisp.cpp + PerimeterShellUI.cpp + ReelManager.cpp + SelectManager.cpp + ShellCmd.cpp + ShellLogDisp.cpp + ShellUtils.cpp + UserSingleProfile.cpp + SCodeInterpreter/Commands.cpp + SCodeInterpreter/Containers.cpp + SCodeInterpreter/Frame.cpp + SCodeInterpreter/Interpreter.cpp + SCodeInterpreter/Knowledge.cpp + SCodeInterpreter/World.cpp + History3D.cpp + HistoryScene.cpp + HistorySceneCamera.cpp + BelligerentSelect.cpp + BattleMenu.cpp + GraphicsOptions.cpp + MainMenu.cpp + Menu/SingleMenu.cpp + Menu/AddonsMenu.cpp + Menu/CommunityMenu.cpp + Menu/MultiplayerList.cpp + Menu/MultiplayerHost.cpp + Menu/MultiplayerJoin.cpp + Menu/MultiplayerLobby.cpp + MessageBox.cpp + MonoSelect.cpp + OptionsMenu.cpp + Menu/MultiplayerCommon.cpp +) + +target_include_directories(UserInterface PRIVATE + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Util" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Render/client" + "${PROJECT_SOURCE_DIR}/Source/Scripts" + "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/Units" + "${PROJECT_SOURCE_DIR}/Source/Network" + "${PROJECT_SOURCE_DIR}/Source/Physics" + "${PROJECT_SOURCE_DIR}/Source/AI" + "${PROJECT_SOURCE_DIR}/Source/XPrm" + "${PROJECT_SOURCE_DIR}/Source/Sound" + "${PROJECT_SOURCE_DIR}/Source/Game" + . +) + +target_compile_options(UserInterface PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/UserInterface/LogicUpdater.cpp b/Source/UserInterface/LogicUpdater.cpp index 7dbfbb4d9..7aa3aa6eb 100644 --- a/Source/UserInterface/LogicUpdater.cpp +++ b/Source/UserInterface/LogicUpdater.cpp @@ -1,4 +1,6 @@ #include "StdAfx.h" +#include "NetConnection.h" +#include "NetComEventBuffer.h" #include "Universe.h" #include "MusicManager.h" #include "LogicUpdater.h" diff --git a/Source/UserInterface/MainMenu.cpp b/Source/UserInterface/MainMenu.cpp index 21c09e0f4..e401a6109 100644 --- a/Source/UserInterface/MainMenu.cpp +++ b/Source/UserInterface/MainMenu.cpp @@ -1,6 +1,5 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "Config.h" #include "Runtime.h" #include "terra.h" @@ -25,6 +24,7 @@ #include "BelligerentSelect.h" #include "GameContent.h" #include "codepages/codepages.h" +#include "MainMenu.h" extern char _bCursorVisible; extern char _bMenuMode; diff --git a/Source/UserInterface/Menu/AddonsMenu.cpp b/Source/UserInterface/Menu/AddonsMenu.cpp index 1147a499c..3486d5731 100644 --- a/Source/UserInterface/Menu/AddonsMenu.cpp +++ b/Source/UserInterface/Menu/AddonsMenu.cpp @@ -1,11 +1,11 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "GameShell.h" #include "PerimeterShellUI.h" #include "MessageBox.h" #include "files/files.h" #include "GameContent.h" #include +#include "MainMenu.h" extern bool menuChangingDone; bool pendingChanges = false; diff --git a/Source/UserInterface/Menu/CommunityMenu.cpp b/Source/UserInterface/Menu/CommunityMenu.cpp index 31a313133..f66d79303 100644 --- a/Source/UserInterface/Menu/CommunityMenu.cpp +++ b/Source/UserInterface/Menu/CommunityMenu.cpp @@ -1,9 +1,9 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "GameShell.h" #include "PerimeterShellUI.h" #include "MessageBox.h" #include +#include "MainMenu.h" std::string openWebURL; diff --git a/Source/UserInterface/Menu/MultiplayerCommon.cpp b/Source/UserInterface/Menu/MultiplayerCommon.cpp index a4fd8480b..4e09f1b45 100644 --- a/Source/UserInterface/Menu/MultiplayerCommon.cpp +++ b/Source/UserInterface/Menu/MultiplayerCommon.cpp @@ -1,5 +1,4 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "GameShell.h" #include "PerimeterShellUI.h" #include "MessageBox.h" @@ -8,6 +7,7 @@ #include "MultiplayerCommon.h" #include "BelligerentSelect.h" #include "codepages/codepages.h" +#include "MainMenu.h" //This file handles mostly ingame multiplayer stuff but some parts are shared with main menu diff --git a/Source/UserInterface/Menu/MultiplayerHost.cpp b/Source/UserInterface/Menu/MultiplayerHost.cpp index dc747be4e..efad2fc73 100644 --- a/Source/UserInterface/Menu/MultiplayerHost.cpp +++ b/Source/UserInterface/Menu/MultiplayerHost.cpp @@ -1,9 +1,9 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "GameShell.h" #include "PerimeterShellUI.h" #include "MessageBox.h" #include "MultiplayerCommon.h" +#include "MainMenu.h" /// Create host to lobby transition diff --git a/Source/UserInterface/Menu/MultiplayerJoin.cpp b/Source/UserInterface/Menu/MultiplayerJoin.cpp index 40002655f..e2fa3e18b 100644 --- a/Source/UserInterface/Menu/MultiplayerJoin.cpp +++ b/Source/UserInterface/Menu/MultiplayerJoin.cpp @@ -1,9 +1,9 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "GameShell.h" #include "PerimeterShellUI.h" #include "MessageBox.h" #include "MultiplayerCommon.h" +#include "MainMenu.h" /// Join game to lobby handler diff --git a/Source/UserInterface/Menu/MultiplayerList.cpp b/Source/UserInterface/Menu/MultiplayerList.cpp index 85774b5d1..578aaa49e 100644 --- a/Source/UserInterface/Menu/MultiplayerList.cpp +++ b/Source/UserInterface/Menu/MultiplayerList.cpp @@ -1,9 +1,9 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "GameShell.h" #include "PerimeterShellUI.h" #include "MessageBox.h" #include "MultiplayerCommon.h" +#include "MainMenu.h" ///Command line stuff diff --git a/Source/UserInterface/Menu/SingleMenu.cpp b/Source/UserInterface/Menu/SingleMenu.cpp index 547b98aad..08886608e 100644 --- a/Source/UserInterface/Menu/SingleMenu.cpp +++ b/Source/UserInterface/Menu/SingleMenu.cpp @@ -1,11 +1,11 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "GameShell.h" #include "PerimeterShellUI.h" #include "MessageBox.h" #include "HistoryScene.h" #include "BGScene.h" #include "GameContent.h" +#include "MainMenu.h" extern MusicPlayer gb_Music; diff --git a/Source/UserInterface/MessageBox.cpp b/Source/UserInterface/MessageBox.cpp index 20e2053f7..c90ec2605 100644 --- a/Source/UserInterface/MessageBox.cpp +++ b/Source/UserInterface/MessageBox.cpp @@ -1,6 +1,5 @@ #include "StdAfx.h" -#include "MainMenu.h" #include "Config.h" #include "Runtime.h" #include "terra.h" @@ -9,6 +8,7 @@ #include "UniverseInterface.h" #include "GameShell.h" #include "PerimeterShellUI.h" +#include "MainMenu.h" #include "MessageBox.h" DYNCALLBACK submitAction = 0; diff --git a/Source/UserInterface/MissionEdit.cpp b/Source/UserInterface/MissionEdit.cpp index b7885a188..67d465b66 100644 --- a/Source/UserInterface/MissionEdit.cpp +++ b/Source/UserInterface/MissionEdit.cpp @@ -1,7 +1,5 @@ #include "StdAfx.h" -#include "MissionEdit.h" - #include "Config.h" #include "Runtime.h" #include "terra.h" @@ -19,6 +17,8 @@ #include "codepages/codepages.h" #include "../HT/ht.h" +#include "MissionEdit.h" + //------------------------------------------------ MissionEditor::MissionEditor() : info_(1000, 1) diff --git a/Source/Util/CMakeLists.txt b/Source/Util/CMakeLists.txt new file mode 100644 index 000000000..0627719f0 --- /dev/null +++ b/Source/Util/CMakeLists.txt @@ -0,0 +1,35 @@ +add_library(Util STATIC + BinaryArchive.cpp + DebugPrm.cpp + DebugUtil.cpp + EditArchive.cpp + MissionDescription.cpp + SaveSQSH.cpp + SaveConditions.cpp + SaveActions.cpp + SaveOthers.cpp + Save.cpp + AVWrapper.cpp + SynchroTimer.cpp + SystemUtil.cpp + XPrmArchive.cpp + Localization.cpp + ANIFile.cpp +) + +target_include_directories(Util PRIVATE + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Render/inc" + "${PROJECT_SOURCE_DIR}/Source/Terra" + "${PROJECT_SOURCE_DIR}/Source/tx3d" + "${PROJECT_SOURCE_DIR}/Source/Network" + "${PROJECT_SOURCE_DIR}/Source/UserInterface" + "${PROJECT_SOURCE_DIR}/Source/Units" + "${PROJECT_SOURCE_DIR}/Source/Physics" + "${PROJECT_SOURCE_DIR}/Source/AI" + "${PROJECT_SOURCE_DIR}/Source/Sound" + "${PROJECT_SOURCE_DIR}/Source/Game" + . +) + +target_compile_options(Util PRIVATE ${PERIMETER_COMPILE_OPTIONS}) diff --git a/Source/Util/DebugUtil.cpp b/Source/Util/DebugUtil.cpp index ede5d9ca0..ddfb04e28 100644 --- a/Source/Util/DebugUtil.cpp +++ b/Source/Util/DebugUtil.cpp @@ -4,8 +4,8 @@ #include "Runtime.h" #include "CameraManager.h" #include "terra.h" -#include "../HT/ht.h" #include "GameShell.h" +#include "../HT/ht.h" LogStream fout("lst",XS_OUT); diff --git a/Source/Util/MissionDescription.cpp b/Source/Util/MissionDescription.cpp index d13d5dbb1..4c64e9319 100644 --- a/Source/Util/MissionDescription.cpp +++ b/Source/Util/MissionDescription.cpp @@ -1,11 +1,13 @@ #include #include "StdAfx.h" +#include "NetConnection.h" #include "NetPlayer.h" #include "EditFunctions.h" #include "Scripts/Config.hi" #include "GameContent.h" #include "Runtime.h" #include "files/files.h" +#include "CommonEvents.h" PlayerData::PlayerData() { diff --git a/Source/Util/SaveSQSH.cpp b/Source/Util/SaveSQSH.cpp index c81ff9a77..bd8392167 100644 --- a/Source/Util/SaveSQSH.cpp +++ b/Source/Util/SaveSQSH.cpp @@ -1,5 +1,7 @@ #include "StdAfx.h" +#include "UnitAttribute.h" + BEGIN_ENUM_DESCRIPTOR(ShellControlID, "ShellControlID") REGISTER_ENUM(SQSH_STATIC_ID, "SQSH_STATIC_ID") REGISTER_ENUM(SQSH_GAME_SCREEN_ID, "SQSH_GAME_SCREEN_ID") diff --git a/Source/Util/SystemUtil.cpp b/Source/Util/SystemUtil.cpp index 2ba3a2284..368fb3d80 100644 --- a/Source/Util/SystemUtil.cpp +++ b/Source/Util/SystemUtil.cpp @@ -1,6 +1,7 @@ #include "StdAfx.h" #include #include "Config.h" +#include "UnitAttribute.h" #include "GameContent.h" #include "files/files.h" diff --git a/Source/XPrm/CMakeLists.txt b/Source/XPrm/CMakeLists.txt index b4c54f468..21af33a11 100644 --- a/Source/XPrm/CMakeLists.txt +++ b/Source/XPrm/CMakeLists.txt @@ -1,29 +1,37 @@ -INCLUDE_DIRECTORIES( - BEFORE . - "${PROJECT_SOURCE_DIR}/Source/XTool" - "${PROJECT_SOURCE_DIR}/Source/Util" +# XPrmLib executable + +add_library(XPrmLib STATIC + StdAfx.cpp + Token.cpp + RunTimeCompiler.cpp ) -SET(XPrm_SRCS - StdAfx.cpp - Token.cpp +target_include_directories(XPrmLib PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Util" ) -SET(XPrm_LINK_LIBS ${EXE_LINK_LIBS_PRE} XTool ${SDL2_LIBRARY} ${EXE_LINK_LIBS_POST}) +target_compile_options(XPrmLib PRIVATE ${PERIMETER_COMPILE_OPTIONS}) + +set(XPrm_LINK_LIBS ${EXE_LINK_LIBS_PRE} XTool ${SDL2_LIBRARY} ${EXE_LINK_LIBS_POST}) -IF(PERIMETER_DEBUG) - SET(XPrm_SRCS ${XPrm_SRCS} RunTimeCompiler.cpp) -ENDIF() IF(PERIMETER_EXODUS) SET(XPrm_LINK_LIBS ${XPrm_LINK_LIBS} Exodus) ENDIF() +target_link_libraries(XPrmLib PRIVATE ${XPrm_LINK_LIBS}) + +# XPrm executable + +add_executable(XPrm ${XPrm_SRCS} XPrm.cpp) + +target_include_directories(XPrm PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/XTool" + "${PROJECT_SOURCE_DIR}/Source/Util" +) + -ADD_EXECUTABLE(XPrm ${XPrm_SRCS} XPrm.cpp) target_compile_options(XPrm PRIVATE ${PERIMETER_COMPILE_OPTIONS}) -TARGET_LINK_LIBRARIES(XPrm PRIVATE ${XPrm_LINK_LIBS}) +target_link_libraries(XPrm PRIVATE XPrmLib) -IF(PERIMETER_DEBUG) - ADD_LIBRARY(XPrmLib STATIC ${XPrm_SRCS}) - target_compile_options(XPrmLib PRIVATE ${PERIMETER_COMPILE_OPTIONS}) - TARGET_LINK_LIBRARIES(XPrmLib PRIVATE ${XPrm_LINK_LIBS}) -ENDIF() diff --git a/Source/XPrm/MemStat.cpp b/Source/XPrm/MemStat.cpp index 31bd47c4a..72c0cbc92 100644 --- a/Source/XPrm/MemStat.cpp +++ b/Source/XPrm/MemStat.cpp @@ -1,4 +1,4 @@ -#include "StdAfx.h" +#include "StdAfxXPrm.h" #include #include diff --git a/Source/XPrm/Params.cpp b/Source/XPrm/Params.cpp index 7c5ca2445..2e8227168 100644 --- a/Source/XPrm/Params.cpp +++ b/Source/XPrm/Params.cpp @@ -4,7 +4,7 @@ -#include "StdAfx.h" +#include "StdAfxXPrm.h" #include "PrmEdit.h" ////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Source/XPrm/RunTimeCompiler.cpp b/Source/XPrm/RunTimeCompiler.cpp index a0d07b633..24240f3af 100644 --- a/Source/XPrm/RunTimeCompiler.cpp +++ b/Source/XPrm/RunTimeCompiler.cpp @@ -1,6 +1,7 @@ +#ifdef PERIMETER_DEBUG #include #include -#include "stdafx.h" +#include "StdAfxXPrm.h" #include "RunTimeCompiler.h" class BaseParameterList : public std::vector {}; @@ -283,3 +284,4 @@ void show_profile(const char* text) { p(text); #endif } +#endif diff --git a/Source/XPrm/Statistics.cpp b/Source/XPrm/Statistics.cpp index ae988765f..4a3844b4a 100644 --- a/Source/XPrm/Statistics.cpp +++ b/Source/XPrm/Statistics.cpp @@ -1,5 +1,5 @@ -#include "StdAfx.h" +#include "StdAfxXPrm.h" #include "Statistics.h" class TimerDataList: public list {}; diff --git a/Source/XPrm/StdAfx.cpp b/Source/XPrm/StdAfx.cpp index a06ada229..2dfb9ad1d 100644 --- a/Source/XPrm/StdAfx.cpp +++ b/Source/XPrm/StdAfx.cpp @@ -2,7 +2,7 @@ // PrmEdit.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information -#include "stdafx.h" +#include "StdAfxXPrm.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file diff --git a/Source/XPrm/stdafx.h b/Source/XPrm/StdAfxXPrm.h similarity index 100% rename from Source/XPrm/stdafx.h rename to Source/XPrm/StdAfxXPrm.h diff --git a/Source/XPrm/Token.cpp b/Source/XPrm/Token.cpp index 4587f8d77..330b30f64 100644 --- a/Source/XPrm/Token.cpp +++ b/Source/XPrm/Token.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "StdAfxXPrm.h" #include "Token.h" #include "ParseUtil.h" diff --git a/Source/XPrm/XPrm.cpp b/Source/XPrm/XPrm.cpp index e38dc74d4..99677fe53 100644 --- a/Source/XPrm/XPrm.cpp +++ b/Source/XPrm/XPrm.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "StdAfxXPrm.h" #include "ParseUtil.h" #include "Token.h" diff --git a/Source/XPrm/XPrmTest.cpp b/Source/XPrm/XPrmTest.cpp index b5488a3ee..2093133c4 100644 --- a/Source/XPrm/XPrmTest.cpp +++ b/Source/XPrm/XPrmTest.cpp @@ -1,5 +1,5 @@ -#include "StdAfx.h" +#include "StdAfxXPrm.h" #include "PrmEdit.h" int main() diff --git a/Source/XPrm/multipad.cpp b/Source/XPrm/multipad.cpp index 4e8684e3a..8f829c474 100644 --- a/Source/XPrm/multipad.cpp +++ b/Source/XPrm/multipad.cpp @@ -10,7 +10,7 @@ // See these sources for detailed information regarding the // Microsoft Foundation Classes product. -#include "stdafx.h" +#include "StdAfxXPrm.h" #include "multipad.h" CMultiPadApp NEAR theApp; diff --git a/Source/XTool/CMakeLists.txt b/Source/XTool/CMakeLists.txt index 51ab293f1..f66a702ee 100644 --- a/Source/XTool/CMakeLists.txt +++ b/Source/XTool/CMakeLists.txt @@ -9,35 +9,6 @@ FetchContent_Declare(gamemath ) FetchContent_MakeAvailable(gamemath) -#Workaround for some compilers that not recognize __always_inline -#target_compile_definitions(gamemath PUBLIC -D__always_inline=) - -INCLUDE_DIRECTORIES( - BEFORE . - "${gamemath_SOURCE_DIR}/include" -) - -SET(XTool_SRCS - xmath/xmath.cpp - xmath/gamemath.cpp - xmath/std.cpp - XBUFFER/XBCNVIN.cpp - XBUFFER/XBCNVOUT.cpp - XBUFFER/XBCORE.cpp - XBUFFER/XBSEARCH.cpp - XSTREAM/XSCNVOUT.cpp - XSTREAM/XSSERV.cpp - XSTREAM/XSRDWR.cpp - XSTREAM/XSCNVIN.cpp - XSTREAM/XSENLV.cpp - XSTREAM/XSCORE.cpp - xerrhand.cpp - XUTIL/XUTIL.cpp - XUTIL/XClock.cpp - files/files.cpp - codepages/codepages.cpp -) - SET(XTool_LINK_LIBS gamemath ZLIB::ZLIB) IF(NOT OPTION_DISABLE_STACKTRACE) @@ -78,6 +49,32 @@ IF(NOT OPTION_DISABLE_STACKTRACE) ENDIF() ENDIF() -ADD_LIBRARY(XTool STATIC ${XTool_SRCS}) +add_library(XTool STATIC + xmath/xmath.cpp + xmath/gamemath.cpp + xmath/std.cpp + XBUFFER/XBCNVIN.cpp + XBUFFER/XBCNVOUT.cpp + XBUFFER/XBCORE.cpp + XBUFFER/XBSEARCH.cpp + XSTREAM/XSCNVOUT.cpp + XSTREAM/XSSERV.cpp + XSTREAM/XSRDWR.cpp + XSTREAM/XSCNVIN.cpp + XSTREAM/XSENLV.cpp + XSTREAM/XSCORE.cpp + xerrhand.cpp + XUTIL/XUTIL.cpp + XUTIL/XClock.cpp + files/files.cpp + codepages/codepages.cpp +) + target_compile_options(XTool PRIVATE ${PERIMETER_COMPILE_OPTIONS}) -TARGET_LINK_LIBRARIES(XTool PRIVATE ${XTool_LINK_LIBS}) + +target_link_libraries(XTool PRIVATE ${XTool_LINK_LIBS}) + +target_include_directories(XTool PRIVATE + BEFORE . + "${gamemath_SOURCE_DIR}/include" +) diff --git a/Source/tx3d/CMakeLists.txt b/Source/tx3d/CMakeLists.txt index b63f145bf..cb30e8465 100644 --- a/Source/tx3d/CMakeLists.txt +++ b/Source/tx3d/CMakeLists.txt @@ -1,9 +1,4 @@ -INCLUDE_DIRECTORIES( - BEFORE . - "${PROJECT_SOURCE_DIR}/Source/XTool" -) - -SET(tx3d_SRCS +add_library(tx3d STATIC Clouds.cpp Colorizer3DFactory.cpp Empty.cpp @@ -47,5 +42,9 @@ SET(tx3d_SRCS WorldLocation3D.cpp ) -ADD_LIBRARY(tx3d STATIC ${tx3d_SRCS}) +target_include_directories(tx3d PRIVATE + BEFORE . + "${PROJECT_SOURCE_DIR}/Source/XTool" +) + target_compile_options(tx3d PRIVATE ${PERIMETER_COMPILE_OPTIONS})