Initial Project Structure

This commit is contained in:
2024-09-19 12:22:57 -04:00
commit da09508110
15 changed files with 169 additions and 0 deletions

38
CMakeLists.txt Normal file
View File

@@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.18..3.29)
project(ReCaveGame
VERSION 1.0
LANGUAGES CXX)
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not allowed")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(cmake/CPM.cmake)
CPMAddPackage(
NAME J3ML
URL https://git.redacted.cc/josh/j3ml/archive/Release-3.1.zip
)
CPMAddPackage(
NAME JGL
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-33.zip
)
CPMAddPackage(
NAME JUI
URL https://git.redacted.cc/josh/ReJUI/archive/Prerelease-2.zip
)
add_subdirectory(Core)
add_subdirectory(Server)
add_subdirectory(Client)
add_subdirectory(ClientApp)
add_subdirectory(ServerApp)

23
Client/CMakeLists.txt Normal file
View File

@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.18..3.29)
file(GLOB_RECURSE CaveClient_HEADERS "include/*.hpp")
file(GLOB_RECURSE CaveClient_SRC "src/*.cpp")
if (UNIX)
add_library(CaveClient SHARED ${CaveClient_SRC})
endif()
if (WIN32)
add_library(CaveClient SHARED ${CaveClient_SRC})
endif()
target_include_directories(CaveClient PUBLIC ${CaveCore_SOURCE_DIR}/include)
target_include_directories(CaveClient PUBLIC "include")
set_target_properties(CaveClient PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(CaveClient PUBLIC CaveCore)

View File

@@ -0,0 +1,3 @@
#pragma once
#include <Core/Chunk.hpp>

View File

@@ -0,0 +1 @@
#include "Client/temp.hpp"

4
ClientApp/CMakeLists.txt Normal file
View File

@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.18..3.29)
add_executable(CaveClientApp main.cpp)

7
ClientApp/main.cpp Normal file
View File

@@ -0,0 +1,7 @@
#include <iostream>
int main(int argc, char** argv)
{
std::cout << "ReCaveGame Coming Soon" << std::endl;
}

19
Core/CMakeLists.txt Normal file
View File

@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.18..3.29)
file(GLOB_RECURSE CaveCore_HEADERS "include/*.hpp")
file(GLOB_RECURSE CaveCore_SRC "src/*.cpp")
if (UNIX)
add_library(CaveCore SHARED ${CaveCore_SRC})
endif()
if (WIN32)
add_library(CaveCore STATIC ${CaveCore_SRC})
endif()
target_include_directories(CaveCore PUBLIC "include")
set_target_properties(CaveCore PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(CaveCore PUBLIC ${J3ML_SOURCE_DIR}/include)
target_link_libraries(CaveCore PUBLIC J3ML)

View File

@@ -0,0 +1,17 @@
#pragma once
#include <J3ML/Geometry/QuadTree.hpp>
namespace CaveGame::Core
{
class Chunk
{
public:
private:
protected:
};
}

View File

@@ -0,0 +1,22 @@
#pragma once
namespace CaveGame::Core
{
class Tile;
class Wall;
class World
{
public:
protected:
private:
Tile& GetTile(int x, int y);
void SetTile(int x, int y, Tile t);
Wall& GetWall(int x, int y);
void SetWall(int x, int y, Wall w);
};
}

1
Core/src/Core/Chunk.cpp Normal file
View File

@@ -0,0 +1 @@
#include <Core/Chunk.hpp>

2
Core/src/Core/World.cpp Normal file
View File

@@ -0,0 +1,2 @@
#include <Core/World.hpp>

1
Server/CMakeLists.txt Normal file
View File

@@ -0,0 +1 @@
cmake_minimum_required(VERSION 3.18..3.29)

4
ServerApp/CMakeLists.txt Normal file
View File

@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.18..3.29)
add_executable(CaveServerApp main.cpp)

3
ServerApp/main.cpp Normal file
View File

@@ -0,0 +1,3 @@
//
// Created by dawsh on 9/19/24.
//

24
cmake/CPM.cmake Normal file
View File

@@ -0,0 +1,24 @@
# SPDX-License-Identifier: MIT
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors
set(CPM_DOWNLOAD_VERSION 0.38.7)
set(CPM_HASH_SUM "83e5eb71b2bbb8b1f2ad38f1950287a057624e385c238f6087f94cdfc44af9c5")
if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()
# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
)
include(${CPM_DOWNLOAD_LOCATION})