Compare commits
4
Commits
lifecycle
...
web-server
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68dd00ed4a | ||
|
|
459aa18387 | ||
|
|
72dd8d214d | ||
|
|
f01faf7351 |
@@ -5,8 +5,10 @@
|
||||
!/include
|
||||
!/src
|
||||
!/tests
|
||||
!/utils
|
||||
|
||||
# Include files
|
||||
!/.gitignore
|
||||
!/CMakeLists.txt
|
||||
!/Makefile
|
||||
!/README.md
|
||||
|
||||
+7
-1
@@ -4,6 +4,8 @@ project(magic_scrolls)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(oatpp 1.4.0 REQUIRED)
|
||||
find_package(oatpp-swagger 1.4.0 REQUIRED)
|
||||
|
||||
file(GLOB_RECURSE sources
|
||||
"${CMAKE_SOURCE_DIR}/src/*.cpp")
|
||||
@@ -11,7 +13,11 @@ file(GLOB_RECURSE sources
|
||||
add_executable(magic_scrolls ${sources})
|
||||
|
||||
target_include_directories(magic_scrolls PUBLIC "${CMAKE_SOURCE_DIR}/include")
|
||||
target_link_libraries(magic_scrolls PRIVATE SQLite::SQLite3)
|
||||
target_link_libraries(magic_scrolls PRIVATE
|
||||
SQLite::SQLite3
|
||||
oatpp::oatpp
|
||||
oatpp::oatpp-swagger
|
||||
)
|
||||
|
||||
# -------
|
||||
enable_testing()
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Magic Scrolls
|
||||
|
||||
Server-side game engine for the game "Magic Scrolls".
|
||||
|
||||
This engine is building as:
|
||||
|
||||
- **Core**: provides event bus, database providers factory, module registration, lifecycle events
|
||||
- **Modules**: separate parts that can use core features using engine public API
|
||||
|
||||
## Requirements
|
||||
|
||||
- **Make**: 4.4.1
|
||||
- **CMake**: 4.2.3
|
||||
- **GCC**: 15.2.0
|
||||
- **sqlite3-dev** (lib): 3.46.1
|
||||
|
||||
## How to run
|
||||
|
||||
1. Clone repository
|
||||
2. Run `sudo ./utils/install-oatpp.sh`
|
||||
3. Build: `cmake -B build` and then `cmake --build build`
|
||||
4. Run: `./build/magic_scrolls
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef __MSC_TEST_1_MODULE_HPP__
|
||||
#define __MSC_TEST_1_MODULE_HPP__
|
||||
|
||||
#include "engine/core/engine_module.hpp"
|
||||
#include "engine/core/engine_module_api.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
class Test1Module : public MscEngineModule
|
||||
{
|
||||
public:
|
||||
~Test1Module() = default;
|
||||
|
||||
std::string getName() const override;
|
||||
uint16_t getRev() const override;
|
||||
const std::unordered_map<std::string, MscRevisionRange> &
|
||||
getDependencies() const override;
|
||||
|
||||
void onInitialize(IMscEngineModuleAPI &engine) override;
|
||||
};
|
||||
|
||||
#endif // __MSC_TEST_1_MODULE_HPP__
|
||||
@@ -1,22 +0,0 @@
|
||||
#include "engine/modules/test1/test1.hpp"
|
||||
#include "engine/core/engine_module_api.hpp"
|
||||
#include "engine/utils/rev_range.hpp"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
std::string Test1Module::getName() const { return "test1"; }
|
||||
|
||||
uint16_t Test1Module::getRev() const { return 1; }
|
||||
|
||||
const std::unordered_map<std::string, MscRevisionRange> &
|
||||
Test1Module::getDependencies() const
|
||||
{
|
||||
static const std::unordered_map<std::string, MscRevisionRange> deps{};
|
||||
return deps;
|
||||
}
|
||||
|
||||
void Test1Module::onInitialize(IMscEngineModuleAPI &engine)
|
||||
{
|
||||
(void)(engine);
|
||||
}
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
BUILD_TYPE=$1
|
||||
|
||||
if [ -z "$BUILD_TYPE" ]; then
|
||||
BUILD_TYPE="Debug"
|
||||
fi
|
||||
|
||||
rm -rf tmp
|
||||
mkdir tmp
|
||||
cd tmp
|
||||
|
||||
function install_module () {
|
||||
|
||||
BUILD_TYPE=$1
|
||||
MODULE_NAME=$2
|
||||
NPROC=$(nproc)
|
||||
|
||||
if [ -z "$NPROC" ]; then
|
||||
NPROC=1
|
||||
fi
|
||||
|
||||
echo "-> [ ] Installing '$MODULE_NAME' ($BUILD_TYPE)..."
|
||||
|
||||
git clone --depth=1 https://github.com/oatpp/$MODULE_NAME
|
||||
|
||||
cd $MODULE_NAME
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOATPP_BUILD_TESTS=OFF -DOATPP_SQLITE_AMALGAMATION=ON ..
|
||||
make install -j $NPROC
|
||||
|
||||
cd ../..
|
||||
|
||||
echo "-> [x] Module '$MODULE_NAME' installed!"
|
||||
|
||||
}
|
||||
|
||||
install_module $BUILD_TYPE oatpp
|
||||
install_module $BUILD_TYPE oatpp-swagger
|
||||
|
||||
cd ..
|
||||
rm -rf tmp
|
||||
Reference in New Issue
Block a user