refactor: Refactorized whole project structure

This commit is contained in:
AURUMVORXX
2025-01-24 22:36:25 +03:00
parent d50f55086b
commit a479b5f85d
321 changed files with 288 additions and 219 deletions

View File

@@ -19,4 +19,5 @@ jobs:
pip install mkdocs-material
pip install mkdocs-callouts
pip install mkdocs-glightbox
cd python/
mkdocs gh-deploy --force

View File

@@ -10,6 +10,8 @@ jobs:
outputs:
assets_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create release
id: create-release
uses: actions/create-release@v1
@@ -17,7 +19,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.run_number }}
release_name: Release 1
release_name: Release Title
body_path: CHANGELOG.md
draft: true
release-win64:
runs-on: windows-latest
@@ -44,7 +47,7 @@ jobs:
- name: CMake - Build
run: cmake --build --preset Windows-x64-Release
- name: Archive output files
run: Compress-Archive -Path "g2o", "out/build/Windows-x64-Release/PyG2O.x64.dll" -Destination Windows-x64-Release.zip
run: Compress-Archive -Path "python/g2o", "build/Windows-x64-Release/source/PyG2O.x64.dll" -Destination Windows-x64-Release.zip
- name: Upload release
uses: actions/upload-release-asset@v1
env:
@@ -77,7 +80,7 @@ jobs:
- name: Archive files
uses: montudor/action-zip@v1
with:
args: zip -r Linux-x64-Release.zip g2o out/build/Linux-x64-Release/PyG2O.x64.so
args: zip -r Linux-x64-Release.zip python/g2o build/Linux-x64-Release/source/PyG2O.x64.so
- name: Upload release
uses: actions/upload-release-asset@v1
env:

1
.gitignore vendored
View File

@@ -14,3 +14,4 @@ desktop.ini
# VS Code
/.vscode/
/source/.vscode/

6
.gitmodules vendored
View File

@@ -1,8 +1,6 @@
[submodule "sqapi"]
[submodule "source/dependencies/sqapi"]
path = source/dependencies/sqapi
url = https://gitlab.com/GothicMultiplayerTeam/dependencies/sqapi.git
branch = main
[submodule "pybind11"]
[submodule "source/dependencies/pybind11"]
path = source/dependencies/pybind11
url = https://github.com/pybind/pybind11.git
branch = master

View File

@@ -1,3 +1,13 @@
## Changelog
- Release configuration will now be used for windows & linux builds
- Updated project structure and CMake settings (read more at build specific changes)
- Revised unpredicted behavior ``All player getters on both sides will now return null if player isn't created/spawned``: these getters should return an empty string if player isn't created/spawned
### Build specific changes
- Project has been split into separate logical directories (docs, python, build, source)
- Added LICENSE (usual free software license)
- CMake config was split to logical files for better readabilty
- Added README.md and LICENSE for NoNut directory
- Removed unused toolchain files and build presets
- Added short ``How to build`` section to README.md

View File

@@ -1,52 +1,8 @@
cmake_minimum_required(VERSION 3.21)
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
project(PyG2O)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
file(GLOB_RECURSE SOURCE
"include/*.h"
project(PyG2O VERSION 1.3.1.0)
set(PYG2O_MODULE_NAME PyG2O)
"src/NoNut/core/*.h"
"src/NoNut/core/*.cpp"
"src/classes/*.h"
"src/classes/*.cpp"
"src/classes/sq/*.h"
"src/classes/sq/*.cpp"
"src/classes/py/*.h"
"src/classes/py/*.cpp"
"src/constants/*.h"
"src/constants/*.cpp"
"src/functions/*.h"
"src/functions/*.cpp"
"src/*.h"
"src/*.cpp"
"src/events/*.h"
"src/events/*.cpp"
)
add_library(${PROJECT_NAME} SHARED ${SOURCE})
target_compile_definitions(${PROJECT_NAME}
PRIVATE
SCRAT_EXPORT
)
target_include_directories(${PROJECT_NAME}
INTERFACE
"include/"
PRIVATE
"src/"
)
if(DEFINED OUT_FILE_SUFFIX)
set_target_properties(${PROJECT_NAME}
PROPERTIES
PREFIX ""
SUFFIX ".${OUT_FILE_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
endif()
add_subdirectory(dependencies)
target_link_libraries(${PROJECT_NAME} PRIVATE pybind11::embed)
add_subdirectory(source)

View File

@@ -5,7 +5,7 @@
"name": "windows",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"binaryDir": "${sourceDir}/build/${presetName}",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
@@ -20,7 +20,7 @@
"name": "linux",
"hidden": true,
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"binaryDir": "${sourceDir}/build/${presetName}",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
@@ -30,17 +30,6 @@
"CMAKE_CXX_FLAGS": "-static-libgcc -static-libstdc++"
}
},
{
"name": "x86",
"hidden": true,
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"OUT_FILE_SUFFIX": "x86"
}
},
{
"name": "x64",
"hidden": true,
@@ -52,17 +41,6 @@
"OUT_FILE_SUFFIX": "x64"
}
},
{
"name": "arm",
"hidden": true,
"architecture": {
"value": "arm",
"strategy": "external"
},
"cacheVariables": {
"OUT_FILE_SUFFIX": "arm"
}
},
{
"name": "arm64",
"hidden": true,
@@ -89,26 +67,18 @@
}
},
{ "name": "Windows-x86-Debug", "inherits": ["windows", "x86", "debug"] },
{ "name": "Windows-x86-Release", "inherits": ["windows", "x86", "release"] },
{ "name": "Windows-x64-Debug", "inherits": ["windows", "x64", "debug"] },
{ "name": "Windows-x64-Release", "inherits": ["windows", "x64", "release"] },
{ "name": "Linux-x64-Debug", "inherits": ["linux", "x64", "debug"] },
{ "name": "Linux-x64-Release", "inherits": ["linux", "x64", "release"] },
{ "name": "Linux-arm-Debug", "inherits": ["linux", "arm", "debug"] },
{ "name": "Linux-arm-Release", "inherits": ["linux", "arm", "release"] },
{ "name": "Linux-arm64-Debug", "inherits": ["linux", "arm64", "debug"] },
{ "name": "Linux-arm64-Release", "inherits": ["linux", "arm64", "release"] }
],
"buildPresets": [
{ "name": "Windows-x86-Debug", "configurePreset": "Windows-x86-Debug" },
{ "name": "Windows-x86-Release", "configurePreset": "Windows-x86-Release" },
{ "name": "Windows-x64-Debug", "configurePreset": "Windows-x64-Debug" },
{ "name": "Windows-x64-Release", "configurePreset": "Windows-x64-Release" },
{ "name": "Linux-x64-Debug", "configurePreset": "Linux-x64-Debug" },
{ "name": "Linux-x64-Release", "configurePreset": "Linux-x64-Release" },
{ "name": "Linux-arm-Debug", "configurePreset": "Linux-arm-Debug" },
{ "name": "Linux-arm-Release", "configurePreset": "Linux-arm-Release" },
{ "name": "Linux-arm64-Debug", "configurePreset": "Linux-arm64-Debug" },
{ "name": "Linux-arm64-Release", "configurePreset": "Linux-arm64-Release" }
]

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) AURUMVORAX
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -4,6 +4,17 @@ Python support for server-side scripts in [Gothic 2 Online](https://gothic-onlin
**Documentation:** https://aurumvorxx.github.io/PyG2O/
## How to build
Requirements:
- Python 3.13
- CMake
Steps:
1. Copy this repo to your local machine
2. Initialize all submodules
3. Build with CMake, selecting your desired preset (Release/Debug) and target PyG2O
4. (Optional) Uncomment and edit block of code at ``source/CMakeLists.txt`` for auto copy testing files
## Credits

View File

@@ -1,7 +0,0 @@
add_subdirectory(sqapi)
add_subdirectory(pybind11)
target_link_libraries(${PROJECT_NAME}
PRIVATE
sqapi
)

View File

@@ -1,29 +0,0 @@
# Simple toolchain file for compiling under linux
# Usage: cmake .. -DCMAKE_TOOLCHAIN_FILE=linux-arm.cmake
# specify the target system properties
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
# specify cross compiler
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
# specify the paths for find_(name), functions (target environment).
set(CMAKE_FIND_ROOT_PATH
/usr/lib
/usr/arm-linux-gnueabihf
${CMAKE_CURRENT_SOURCE_DIR}
)
# search only for programs in the build host directories (find_program)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# use only CMAKE_FIND_ROOT_PATH for searching (find_library)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
# use only CMAKE_FIND_ROOT_PATH for searching (find_file, find_path)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# use only CMAKE_FIND_ROOT_PATH for searching (find_package)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

View File

@@ -1,29 +0,0 @@
# Simple toolchain file for compiling under linux
# Usage: cmake .. -DCMAKE_TOOLCHAIN_FILE=linux-arm64.cmake
# specify the target system properties
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
# specify cross compiler
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
# specify the paths for find_(name), functions (target environment).
set(CMAKE_FIND_ROOT_PATH
/usr/lib
/usr/aarch64-linux-gnu
${CMAKE_CURRENT_SOURCE_DIR}
)
# search only for programs in the build host directories (find_program)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# use only CMAKE_FIND_ROOT_PATH for searching (find_library)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
# use only CMAKE_FIND_ROOT_PATH for searching (find_file, find_path)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# use only CMAKE_FIND_ROOT_PATH for searching (find_package)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

Some files were not shown because too many files have changed in this diff Show More