Skip to content

Commit

Permalink
Merge pull request #40 from IonAgorria/cmake
Browse files Browse the repository at this point in the history
WIP CMake - fixes #13
  • Loading branch information
DileSoft authored Jun 9, 2021
2 parents b797c27 + eef8e11 commit 3047563
Show file tree
Hide file tree
Showing 284 changed files with 1,718 additions and 842 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.svn
.svn
cmake-build-debug
build
78 changes: 78 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version")
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0)

# root
PROJECT(perimeter)

# modules
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

#SET(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
IF(MINGW)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
ENDIF()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# options
OPTION(FINAL_VERSION "Generate Final version" On)
OPTION(GEN_SCRIPTS "Re-Generates game scripts" OFF)

# depends
FIND_PACKAGE(Boost)

# globals
INCLUDE_DIRECTORIES(SYSTEM
${Boost_INCLUDE_DIRS}
)

IF(MSVC)
#MSVC compiler specifics
ELSE()
#Others
INCLUDE(CheckCXXCompilerFlag)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2 -ftree-vectorize -ffast-math")
CHECK_CXX_COMPILER_FLAG("-msse2" HAVE_SIMDSSE)
IF(HAVE_SIMDSSE)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2")
ENDIF()

# For modern gcc
#add_definitions(-D_USE_MATH_DEFINES)

#TODO remove these once code is more tidy
add_compile_options(-Wno-misleading-indentation)
add_compile_options(-Wno-unused-parameter)
add_compile_options(-Wno-unused-function)
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-unused-but-set-variable)
add_compile_options(-Wno-unused-value)
add_compile_options(-Wno-sign-compare)

add_compile_options(-fms-extensions)

add_compile_options(-Wno-unknown-pragmas) #TODO we should remove these pragmas?
add_compile_options(-Werror=shift-negative-value)
add_compile_options(-Werror=dangling-else)
add_compile_options(-Werror=parentheses)
add_compile_options(-Werror=delete-non-virtual-dtor)
#add_compile_options(-Werror=write-strings) #TODO enable this again

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Werror=mismatched-new-delete )
endif()
ENDIF()

ADD_DEFINITIONS(-D_PERIMETER_)
#ADD_DEFINITIONS(-D_PERIMETER_ADDON_)
IF(FINAL_VERSION)
ADD_DEFINITIONS(-DNDEBUG)
ADD_DEFINITIONS(-D_FINAL_VERSION_)
ELSE()
MESSAGE("Not compiling Final version")
ENDIF()

ADD_SUBDIRECTORY("Source")
6 changes: 3 additions & 3 deletions Source/AI/AIMain.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "StdAfx.h"

#include "umath.h"
#include "Umath.h"
#include "IVisGeneric.h"
#include "VisGenericDefine.h"
#include "IRenderDevice.h"
Expand All @@ -16,13 +16,13 @@
#include "RigidBody.h"
#include "ForceField.h"

#include "AiMain.h"
#include "AIMain.h"

#include "GenericUnit.h"
#include "RealUnit.h"
#include "IronFrame.h"
#include "Squad.h"
#include "AiPrm.h"
#include "AIPrm.h"
#include "Installer.h"
#include "PlaceOperators.h"
#include "GameShell.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/AI/AIPrm.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#include "Scripts\AI.hi"
#include "Scripts/AI.hi"
2 changes: 1 addition & 1 deletion Source/AI/AITileMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "ClusterFind.h"
#include "ForceField.h"
#include "AIPrm.h"
#include "runtime.h"
#include "Runtime.h"

bool AITile::update(int x,int y)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/AI/AITileMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define __AITILEMAP_H__

#include "terra.h"
#include "map2d.h"
#include "Map2D.h"

class ClusterFind;

Expand Down
6 changes: 3 additions & 3 deletions Source/AI/AiBuilding.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "StdAfx.h"

#include "umath.h"
#include "Umath.h"
#include "IVisGeneric.h"
#include "VisGenericDefine.h"
#include "IRenderDevice.h"
Expand All @@ -14,10 +14,10 @@
#include "GenericControls.h"
#include "Universe.h"

#include "AiMain.h"
#include "AIMain.h"
#include "Installer.h"
#include "RigidBody.h"
#include "AiPrm.h"
#include "AIPrm.h"
#include "PlaceOperators.h"
#include "Triggers.h"

Expand Down
2 changes: 1 addition & 1 deletion Source/AI/ClusterFind.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//Balmer,K-D Lab
#include "StdAfx.h"
#include "Terra.h"
#include "terra.h"
#include "ClusterFind.h"

////////////////////////////////////////////////////////////
Expand Down
182 changes: 182 additions & 0 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
IF(GEN_SCRIPTS)
MESSAGE("Generating Scripts")
#TODO call XPrm and other stuff
ENDIF()

ADD_SUBDIRECTORY("PluginMAX")
ADD_SUBDIRECTORY("Terra")
ADD_SUBDIRECTORY("tx3d")
if(NOT FINAL_VERSION)
ADD_SUBDIRECTORY("TriggerEditor")
ENDIF()
ADD_SUBDIRECTORY("Network/Peer2")
ADD_SUBDIRECTORY("Render")
ADD_SUBDIRECTORY("Sound")

INCLUDE_DIRECTORIES(
"${PROJECT_SOURCE_DIR}/Source/Util"
"${PROJECT_SOURCE_DIR}/Source/Render/inc"
"${PROJECT_SOURCE_DIR}/Source/Terra"
"${PROJECT_SOURCE_DIR}/Source/Game"
"${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"
"${PROJECT_SOURCE_DIR}/XLibs.Net"
"${PROJECT_SOURCE_DIR}/MSDXSDK_02_06/Include"
)

SET(perimeter_SRCS
Game/CameraManager.cpp
Game/MonkManager.cpp
Game/MusicManager.cpp
Game/PlayBink.cpp
Game/qd_textdb.cpp
Units/Economic.cpp
Game/Player.cpp
Game/Universe.cpp
Game/PerimeterDataChannel.cpp
Game/ResourceDispatcher.cpp
Game/Runtime.cpp
Game/CopyToGraph.cpp
Game/Region.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/Save.cpp
Game/StdAfx.cpp
Util/SynchroTimer.cpp
Util/SystemUtil.cpp
Util/XPrmArchive.cpp
UserInterface/BGScene.cpp
UserInterface/chaos.cpp
UserInterface/controls.cpp
UserInterface/ExternalShow.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/BattleMenu.cpp
UserInterface/GraphicsOptions.cpp
UserInterface/LanMenu.cpp
UserInterface/MainMenu.cpp
UserInterface/MessageBox.cpp
UserInterface/MonoSelect.cpp
UserInterface/OnlineMenu.cpp
UserInterface/OptionsMenu.cpp
Network/CommonCommands.cpp
Network/CommonEvents.cpp
Network/ConnectionDP.cpp
Network/EventBufferDP.cpp
Network/GS_interface.cpp
Network/HyperSpace.cpp
Network/P2P_interface1Th.cpp
Network/P2P_interface2Th.cpp
Network/P2P_interface2ThDPF.cpp
Network/P2P_interface3Th.cpp
Network/P2P_interfaceAnyTh.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
)

ADD_EXECUTABLE(perimeter ${perimeter_SRCS})

TARGET_LINK_LIBRARIES(perimeter
${BOOST_LIBRARY}
${SDL2_LIBRARY}
PluginMAX
Terra
tx3d
TriggerEditor
Peer
Render
Sound
)
38 changes: 38 additions & 0 deletions Source/Configurator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#TODO create executable

SET(configurator_SRCS
"Configurator/Config Sheets/aboutpage.cpp"
"Configurator/Config Sheets/BasePage.cpp"
"Configurator/Config Sheets/GamePropertyPage.cpp"
"Configurator/Config Sheets/graphsettingspage.cpp"
"Configurator/Config Sheets/MiscSettingsPage.cpp"
"Configurator/Config Sheets/SettingsSheet.cpp"
"Configurator/Config Sheets/soundsettingspage.cpp"
Configurator/Localisation/LocaleMngr.cpp
Configurator/SettingFactory/SettingFactory.cpp
Configurator/Settings/CheckSetting.cpp
Configurator/Settings/ColorDepthSetting.cpp
Configurator/Settings/ComboSetting.cpp
Configurator/Settings/GraphSettingsSet.cpp
Configurator/Settings/HTSetting.cpp
Configurator/Settings/LanguageSetting.cpp
Configurator/Settings/MapLevelLOD.cpp
Configurator/Settings/MouseLookRateSetting.cpp
Configurator/Settings/RadioSetting.cpp
Configurator/Settings/ReflectionSetting.cpp
Configurator/Settings/ResolutionSetting.cpp
Configurator/Settings/ScrollRateSetting.cpp
Configurator/Settings/SettingBase.cpp
Configurator/Settings/ShadowQualitySetting.cpp
Configurator/Settings/ShadowSamples.cpp
Configurator/Settings/ShadowTypeSetting.cpp
Configurator/Settings/SliderSetting.cpp
Configurator/CollectLangDirs.cpp
Configurator/Configurator.cpp
Configurator/ConfiguratorDlg.cpp
Configurator/CurDirSafer.cpp
Configurator/GrCustomSettingsDlg.cpp
Configurator/IniReader.cpp
Configurator/qd_textdb.cpp
Configurator/StdAfx.cpp
)
2 changes: 1 addition & 1 deletion Source/Configurator/CollectLangDirs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "StdAfx.h"
#include "Configurator.h"
#include "CollectLangDirs.h"

Expand Down
Loading

0 comments on commit 3047563

Please sign in to comment.