Skip to content

Commit

Permalink
Move main executable source to its own directory (1dot13#248)
Browse files Browse the repository at this point in the history
* Move main executable files to their own directory

* Adapt the build to the new file structure

... and fix some weird #include's that were relying on the project root
being an include directory.
  • Loading branch information
majcosta committed Oct 23, 2023
1 parent 5d3118e commit ae55496
Show file tree
Hide file tree
Showing 90 changed files with 68 additions and 68 deletions.
56 changes: 2 additions & 54 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE)
include_directories(${CMAKE_SOURCE_DIR} "ext/VFS/include" Utils TileEngine TacticalAI ModularizedTacticalAI Tactical Strategic sgp Res Lua Laptop Multiplayer Editor Console)
include_directories(Ja2 "ext/VFS/include" Utils TileEngine TacticalAI "ModularizedTacticalAI/include" Tactical Strategic sgp "Ja2/Res" Lua Laptop Multiplayer Editor Console)

# external libraries
add_subdirectory("ext/libpng")
Expand Down Expand Up @@ -59,59 +59,7 @@ foreach(lib IN LISTS Ja2_Libs)
add_subdirectory(${lib})
endforeach()

# TODO: Move these units into their own directory to declutter the root dir and CMakeLists.txt file
set(Ja2Src
"aniviewscreen.cpp"
"Credits.cpp"
"Fade Screen.cpp"
"FeaturesScreen.cpp"
"GameInitOptionsScreen.cpp"
"gameloop.cpp"
"gamescreen.cpp"
"GameSettings.cpp"
"GameVersion.cpp"
"HelpScreen.cpp"
"Init.cpp"
"Intro.cpp"
"JA2 Splash.cpp"
"Ja25Update.cpp"
"jascreens.cpp"
"Language Defines.cpp"
"Loading Screen.cpp"
"MainMenuScreen.cpp"
"MessageBoxScreen.cpp"
"MPChatScreen.cpp"
"MPConnectScreen.cpp"
"MPHostScreen.cpp"
"MPJoinScreen.cpp"
"MPScoreScreen.cpp"
"MPXmlTeams.cpp"
"Options Screen.cpp"
"profiler.cpp"
"SaveLoadGame.cpp"
"SaveLoadScreen.cpp"
"SCREENS.cpp"
"Sys Globals.cpp"
"ub_config.cpp"
"XML_DifficultySettings.cpp"
"XML_IntroFiles.cpp"
"XML_Layout_MainMenu.cpp"
Res/ja2.rc
)

set(Ja2_Libraries
"${PROJECT_SOURCE_DIR}/libexpatMT.lib"
"Dbghelp.lib"
Lua
"${PROJECT_SOURCE_DIR}/lua51.lib"
"${PROJECT_SOURCE_DIR}/lua51.vc9.lib"
"Winmm.lib"
"${PROJECT_SOURCE_DIR}/SMACKW32.LIB"
"${PROJECT_SOURCE_DIR}/binkw32.lib"
bfVFS
"ws2_32.lib"
Multiplayer
)
add_subdirectory(Ja2)

# simple function to validate Languages and Application choices
include(cmake/ValidateOptions.cmake)
Expand Down
52 changes: 52 additions & 0 deletions Ja2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
set(Ja2Src
"${CMAKE_CURRENT_SOURCE_DIR}/aniviewscreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Credits.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Fade Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FeaturesScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameInitOptionsScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/gameloop.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/gamescreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameSettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameVersion.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/HelpScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Init.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Intro.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Language Defines.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPChatScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPConnectScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPHostScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPJoinScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPScoreScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPXmlTeams.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Options Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SCREENS.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp"
${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc
PARENT_SCOPE)

set(Ja2_Libraries
"${CMAKE_SOURCE_DIR}/libexpatMT.lib"
"Dbghelp.lib"
Lua
"${CMAKE_SOURCE_DIR}/lua51.lib"
"${CMAKE_SOURCE_DIR}/lua51.vc9.lib"
"Winmm.lib"
"${CMAKE_SOURCE_DIR}/SMACKW32.LIB"
"${CMAKE_SOURCE_DIR}/binkw32.lib"
bfVFS
"ws2_32.lib"
Multiplayer
PARENT_SCOPE)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Laptop/Encyclopedia_Data_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "QuestText.h" //quest: name
#include "laptop.h" //ui positions
#include "Utilities.h"
#include "Utils/Cursors.h"
#include "Cursors.h"
#include "sysutil.h" //extra Buffer for scaling image
#include "vsurface.h" //fill extra buffer with black color
#include "Text.h"
Expand Down
2 changes: 1 addition & 1 deletion Laptop/Encyclopedia_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "laptop.h"//UI dimensions, mouse regions
#include "Utilities.h"//file names
#include "vobject.h"//video objects
#include "Utils/Cursors.h"
#include "Cursors.h"
#include "Text.h"//button text
#include "Button System.h"
#include "Encyclopedia_new.h"
Expand Down
6 changes: 3 additions & 3 deletions TacticalAI/AIMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@

#include "connect.h"
// needed to use the modularized tactical AI:
#include "ModularizedTacticalAI/include/Plan.h"
#include "ModularizedTacticalAI/include/PlanFactoryLibrary.h"
#include "ModularizedTacticalAI/include/AbstractPlanFactory.h"
#include "Plan.h"
#include "PlanFactoryLibrary.h"
#include "AbstractPlanFactory.h"

#ifdef JA2UB
#include "Ja25_Tactical.h"
Expand Down
6 changes: 3 additions & 3 deletions TacticalAI/Realtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include "Quests.h"
#include "GameSettings.h"
// needed to use the modularized tactical AI:
#include "ModularizedTacticalAI/include/Plan.h"
#include "ModularizedTacticalAI/include/PlanFactoryLibrary.h"
#include "ModularizedTacticalAI/include/AbstractPlanFactory.h"
#include "Plan.h"
#include "PlanFactoryLibrary.h"
#include "AbstractPlanFactory.h"


UINT16 RealtimeDelay( SOLDIERTYPE * pSoldier )
Expand Down
4 changes: 2 additions & 2 deletions Utils/WordWrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define __WORDWRAP_H_

#include "types.h"
#include "LAPTOP\files.h"
#include "LAPTOP\email.h"
#include "files.h"
#include "email.h"

//Flags for DrawTextToScreen()

Expand Down
2 changes: 1 addition & 1 deletion lua/lua_function.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "DEBUG.H"
#include "lua/lua_function.h"
#include "lua_function.h"

template<>
LuaFunction& LuaFunction::Param<std::string>(std::string const& par)
Expand Down
2 changes: 1 addition & 1 deletion lua/lua_state.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "lua/lua_state.h"
#include "lua_state.h"
#include <Debug.h>
#include "sgp_logger.h"

Expand Down
2 changes: 1 addition & 1 deletion lua/lua_table.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "lua/lua_table.h"
#include "lua_table.h"

/*
* Table constructors
Expand Down
2 changes: 1 addition & 1 deletion lua/lua_table.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _LUA_TABLE_H_
#define _LUA_TABLE_H_

#include "lua/lua_state.h"
#include "lua_state.h"

class LuaTable
{
Expand Down

0 comments on commit ae55496

Please sign in to comment.