Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 47 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@
pull_request:
branches: [ "master" ]

# https://devblogs.microsoft.com/cppblog/vcpkg-integration-with-the-github-dependency-graph/
permissions:
contents: write

env:
# https://devblogs.microsoft.com/cppblog/vcpkg-integration-with-the-github-dependency-graph/
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
VCPKG_ROOT: "C:/my-vcpkg"
VCPKG_DEFAULT_BINARY_CACHE: "C:/vcpkg-binary-cache"
VCPKG_FEATURE_FLAGS: dependencygraph
BUILD_TYPE: RelWithDebInfo

jobs:
build:
runs-on: windows-2022
strategy:
matrix:
arch: [ x64, x86 ]
steps:
- uses: actions/checkout@v4

- name: Setup Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}

- name: Get project vcpkg baseline
shell: pwsh
run: |
Expand All @@ -33,40 +32,64 @@
- name: Cache vcpkg
uses: actions/cache@v4
with:
key: vcpkg-${{ hashFiles('vcpkg.json') }}
key: vcpkg-${{ matrix.arch }}-${{ hashFiles('vcpkg.json') }}
path: |
${{env.VCPKG_DEFAULT_BINARY_CACHE}}

- name: Setup vcpkg
run: |
New-Item -ItemType Directory -Path ${{env.VCPKG_ROOT}}
Set-Location -Path ${{env.VCPKG_ROOT}}
New-Item -ItemType Directory -Path C:/my-vcpkg
Set-Location -Path C:/my-vcpkg
git init
git remote add --no-tags origin https://github.com/microsoft/vcpkg.git
git fetch --depth 1 --no-write-fetch-head origin ${{env.VCPKG_BASELINE}}
git branch master ${{env.VCPKG_BASELINE}}
git checkout
./bootstrap-vcpkg.bat
New-Item -ItemType Directory -Path ${{env.VCPKG_DEFAULT_BINARY_CACHE}} -Force
echo "VCPKG_ROOT=C:/my-vcpkg" >> $env:GITHUB_ENV

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} --toolchain ${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
run: cmake --preset ${{ matrix.arch }}-release

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build ${{github.workspace}}/build/${{ matrix.arch }}-release

- name: Pack
run: |
cd ${{github.workspace}}/build
cpack --config CPackConfig.cmake -C ${{env.BUILD_TYPE}}
cd ${{github.workspace}}/build/${{ matrix.arch }}-release
cpack --config CPackConfig.cmake -C RelWithDebInfo

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: observer-modules-${{ matrix.arch }}
path: ${{github.workspace}}/build/${{ matrix.arch }}-release/*.zip

- name: Release nightly build
uses: andelf/nightly-release@main
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
name: 'Nightly Release $$'
body: 'This is an automated nightly build. Download the *-dll.zip files if you need Observer modules. Download the *-pdb.zip files if you need debug symbols.'
tag_name: nightly
merge-multiple: true
path: ./artifacts

- name: Generate release tag
id: tag
run: echo "tag=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: release-${{ steps.tag.outputs.tag }}
name: 'Release ${{ steps.tag.outputs.tag }}'
body: |
Automated release from master branch.

Download the *-dll.zip files if you need Observer modules.
Download the *-pdb.zip files if you need debug symbols.
files: ./artifacts/*.zip
prerelease: false

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
files: |
./build/*.zip
9 changes: 0 additions & 9 deletions .idea/cmake.xml

This file was deleted.

10 changes: 10 additions & 0 deletions .idea/dictionaries/project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Far_Manager__Debug_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Far_Manager__Release_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Run_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 18 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
cmake_minimum_required(VERSION 3.31)

if (DEFINED ENV{VCPKG_ROOT})
set(VCPKG_ROOT "$ENV{VCPKG_ROOT}")
elseif (DEFINED ENV{USERPROFILE})
set(VCPKG_ROOT "$ENV{USERPROFILE}/.vcpkg-clion/vcpkg")
endif ()
if (NOT EXISTS ${VCPKG_ROOT})
message(FATAL_ERROR "VCPKG_ROOT is not defined. Please set it to the path of your vcpkg installation.")
endif ()
file(TO_CMAKE_PATH ${VCPKG_ROOT} VCPKG_ROOT)
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")

set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
set(VCPKG_TARGET_TRIPLET ${OBSERVER_ARCHITECTURE}-windows-static)

project(observer_modules LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_compile_options("/W3" "/analyze")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_VERBOSE_MAKEFILE ON)

set(ZLIB_USE_STATIC_LIBS ON)
find_package(ZLIB REQUIRED)
find_path(ZSTR_INCLUDE_DIRS "zstr.hpp")
find_package(Python3 COMPONENTS Development REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(xxHash CONFIG REQUIRED)

Expand All @@ -27,13 +35,10 @@ add_library(renpy SHARED
src/dll.cpp
src/archive.cpp
${RENPY_DIR}/renpy.cpp
${RENPY_DIR}/python/context.cpp
${RENPY_DIR}/python/dict.cpp
${RENPY_DIR}/python/list.cpp
${RENPY_DIR}/python/tuple.cpp)
${RENPY_DIR}/pickle.cpp
)
target_link_libraries(renpy PRIVATE ZLIB::ZLIB)
target_include_directories(renpy PRIVATE ${ZSTR_INCLUDE_DIRS})
target_link_libraries(renpy PRIVATE Python3::Python)

add_library(rpgmaker SHARED src/dll.cpp src/archive.cpp src/modules/rpgmaker/rpgmaker.cpp)

Expand All @@ -50,7 +55,8 @@ add_executable(tests
src/tests/framework/observer.cpp
src/tests/framework/testcase.cpp
src/tests/renpy.cpp
src/tests/zanzarah.cpp)
src/tests/zanzarah.cpp
)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)
target_link_libraries(tests PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(tests PRIVATE xxHash::xxhash)
Expand All @@ -75,8 +81,8 @@ foreach (MODULE IN LISTS RELEASED_MODULES)
install(FILES "$<TARGET_PDB_FILE:${MODULE}>" DESTINATION . COMPONENT ${MODULE}_pdb)

string(TOUPPER ${MODULE} MODULE_UPPER)
set(CPACK_ARCHIVE_${MODULE_UPPER}_FILE_NAME "${MODULE}-${TODAY}-amd64-dll")
set(CPACK_ARCHIVE_${MODULE_UPPER}_PDB_FILE_NAME "${MODULE}-${TODAY}-amd64-pdb")
set(CPACK_ARCHIVE_${MODULE_UPPER}_FILE_NAME "${MODULE}-${TODAY}-${OBSERVER_ARCHITECTURE}-dll")
set(CPACK_ARCHIVE_${MODULE_UPPER}_PDB_FILE_NAME "${MODULE}-${TODAY}-${OBSERVER_ARCHITECTURE}-pdb")
endforeach ()

list(TRANSFORM RELEASED_MODULES APPEND "_pdb" OUTPUT_VARIABLE ALL_COMPONENTS)
Expand Down
67 changes: 67 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"version": 3,
"configurePresets": [
{
"hidden": true,
"name": "default",
"generator": "Ninja",
"vendor": {
"jetbrains.com/clion": {
"toolchain": "Visual Studio"
}
}
},
{
"name": "x64-debug",
"inherits": "default",
"binaryDir": "${sourceDir}/build/x64-debug",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"OBSERVER_ARCHITECTURE": "x64"
}
},
{
"name": "x64-release",
"inherits": "default",
"binaryDir": "${sourceDir}/build/x64-release",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"OBSERVER_ARCHITECTURE": "x64"
}
},
{
"name": "x86-debug",
"inherits": "default",
"binaryDir": "${sourceDir}/build/x86-debug",
"architecture": {
"value": "Win32",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"OBSERVER_ARCHITECTURE": "x86"
}
},
{
"name": "x86-release",
"inherits": "default",
"binaryDir": "${sourceDir}/build/x86-release",
"architecture": {
"value": "Win32",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"OBSERVER_ARCHITECTURE": "x86"
}
}
]
}
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,23 @@ specific files as needed without having to unpack the entire archive.

## Third-party components

| Project | License |
|-----------------------------------------------------|-------------------------------------|
| [json](https://github.com/nlohmann/json) | [MIT](licenses/json.txt) |
| [Catch2](https://github.com/catchorg/Catch2) | [BSL-1.0](licenses/Boost.txt) |
| [Observer](https://github.com/lazyhamster/Observer) | [LGPL-3.0](licenses/Observer.txt) |
| [Python](https://www.python.org) | [PSF-2.0](licenses/Python.txt) |
| [xxHash](https://github.com/Cyan4973/xxHash) | [BSD-2-Clause](licenses/xxHash.txt) |
| [zlib](https://zlib.net) | [zlib](licenses/zlib.txt) |
| [zstr](https://github.com/mateidavid/zstr) | [MIT](licenses/zstr.txt) |
| Project | License |
|-----------------------------------------------------------------|-------------------------------------|
| [nlohmann/json](https://github.com/nlohmann/json) | [MIT](licenses/json.txt) |
| [catchorg/Catch2](https://github.com/catchorg/Catch2) | [BSL-1.0](licenses/Catch2.txt) |
| [lazyhamster/Observer](https://github.com/lazyhamster/Observer) | [LGPL-3.0](licenses/Observer.txt) |
| [Cyan4973/xxHash](https://github.com/Cyan4973/xxHash) | [BSD-2-Clause](licenses/xxHash.txt) |
| [zlib](https://zlib.net) | [zlib](licenses/zlib.txt) |
| [mateidavid/zstr](https://github.com/mateidavid/zstr) | [MIT](licenses/zstr.txt) |

## Sources of inspiration

| Project | License |
|------------------------------------------------------------------|----------------------------------|
| [rgssad](https://github.com/luxrck/rgssad) | [MIT](licenses/rgssad.txt) |
| [rpatool](https://github.com/Shizmob/rpatool) | [WTFPL](licenses/rpatool.txt) |
| [zanzapak](https://aluigi.altervista.org/papers.htm#others-file) | [GPL-3.0](licenses/zanzapak.txt) |
| Project | License |
|-----------------------------------------------------------------------|----------------------------------|
| [luxrck/rgssad](https://github.com/luxrck/rgssad) | [MIT](licenses/rgssad.txt) |
| [birkenfeld/serde-pickle](https://github.com/birkenfeld/serde-pickle) | [MIT](licenses/serde-pickle.txt) |
| [Shizmob/rpatool](https://github.com/Shizmob/rpatool) | [WTFPL](licenses/rpatool.txt) |
| [zanzapak](https://aluigi.altervista.org/papers.htm#others-file) | [GPL-3.0](licenses/zanzapak.txt) |

## Building from Source

Expand Down
40 changes: 0 additions & 40 deletions licenses/Python.txt

This file was deleted.

Loading