1
0

chore: write github action

This commit is contained in:
2026-01-30 16:12:39 +08:00
parent 2f59e16590
commit 6b0d73177b
19 changed files with 342 additions and 30 deletions

3
.github/scripts/README.md vendored Normal file
View File

@@ -0,0 +1,3 @@
# GitHub Scripts
These scripts should be executed at the root directory of each project respectively.

View File

@@ -0,0 +1,23 @@
#!/bin/bash
set -euo pipefail
YYCCommonplace_ROOT="${YYCCommonplace_ROOT:?YYCCommonplace_ROOT must be set}"
STB_ROOT="${STB_ROOT:?STB_ROOT must be set}"
ZLIB_ROOT="${ZLIB_ROOT:?ZLIB_ROOT must be set}"
# Create build directory and enter it
mkdir bin
cd bin
# Create internal build and install directory
mkdir build
mkdir install
# Build in Release mode
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DNEMO_BUILD_UNVIRT=ON -DNEMO_BUILD_BALLANCE=ON -DNEMO_BUILD_BMAP=ON -DNEMO_BUILD_BMAPINSPECTOR=ON -DYYCCommonplace_ROOT=$YYCCommonplace_ROOT -DSTB_ROOT=$STB_ROOT -DZLIB_ROOT=$ZLIB_ROOT ../..
cmake --build .
cmake --install . --prefix=../install
cd ..
# Back to root directory
cd ..

View File

@@ -0,0 +1,23 @@
#!/bin/bash
set -euo pipefail
YYCCommonplace_ROOT="${YYCCommonplace_ROOT:?YYCCommonplace_ROOT must be set}"
STB_ROOT="${STB_ROOT:?STB_ROOT must be set}"
ZLIB_ROOT="${ZLIB_ROOT:?ZLIB_ROOT must be set}"
# Create build directory and enter it
mkdir bin
cd bin
# Create internal build and install directory
mkdir build
mkdir install
# Build in Release mode
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DNEMO_BUILD_UNVIRT=ON -DNEMO_BUILD_BALLANCE=ON -DNEMO_BUILD_BMAP=ON -DNEMO_BUILD_BMAPINSPECTOR=ON -DYYCCommonplace_ROOT=$YYCCommonplace_ROOT -DSTB_ROOT=$STB_ROOT -DZLIB_ROOT=$ZLIB_ROOT ../..
cmake --build .
cmake --install . --prefix=../install
cd ..
# Back to root directory
cd ..

2
.github/scripts/stb-linux.sh vendored Normal file
View File

@@ -0,0 +1,2 @@
# Just directly record self as root directory
set STB_ROOT=$(pwd)

2
.github/scripts/stb-macos.sh vendored Normal file
View File

@@ -0,0 +1,2 @@
# Just directly record self as root directory
set STB_ROOT=$(pwd)

4
.github/scripts/stb-windows.bat vendored Normal file
View File

@@ -0,0 +1,4 @@
@ECHO OFF
:: Just directly record self as root directory
SET STB_ROOT=%CD%

View File

@@ -3,16 +3,16 @@
:: Create build directory and enter it :: Create build directory and enter it
MKDIR bin MKDIR bin
CD bin CD bin
:: Create internal build and install directory, then enter it :: Create internal build and install directory
MKDIR build MKDIR build
MKDIR install MKDIR install
CD build
:: Build with x64 architecture in Release mode :: Build with x64 architecture in Release mode
cmake -A x64 -DYYCC_BUILD_TEST=ON -DGTest_ROOT=%GTest_ROOT% -DYYCC_BUILD_BENCHMARK=ON -Dbenchmark_ROOT=%benchmark_ROOT% ../.. CD build
cmake -A x64 -DCMAKE_CXX_STANDARD=23 -DNEMO_BUILD_UNVIRT=ON -DNEMO_BUILD_BALLANCE=ON -DNEMO_BUILD_BMAP=ON -DNEMO_BUILD_BMAPINSPECTOR=ON -DYYCCommonplace_ROOT=%YYCCommonplace_ROOT% -DSTB_ROOT=%STB_ROOT% -DZLIB_ROOT=%ZLIB_ROOT% ../..
cmake --build . --config Release cmake --build . --config Release
cmake --install . --prefix=../install --config Release cmake --install . --prefix=../install --config Release
CD ..
:: Back to root directory :: Back to root directory
CD .. CD ..
CD ..

View File

@@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail
# Create build directory and enter it
mkdir bin
cd bin
# Create internal build and install directory
mkdir build
mkdir install
# Build in Release mode
cd build
cmake -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release ../..
cmake --build .
cmake --install . --prefix=../install
cd ..
# Record install directory
cd install
set YYCCommonplace_ROOT=$(pwd)
cd ..
# Back to root directory
cd ..

View File

@@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail
# Create build directory and enter it
mkdir bin
cd bin
# Create internal build and install directory
mkdir build
mkdir install
# Build in Release mode
cd build
cmake -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release ../..
cmake --build .
cmake --install . --prefix=../install
cd ..
# Record install directory
cd install
set YYCCommonplace_ROOT=$(pwd)
cd ..
# Back to root directory
cd ..

View File

@@ -0,0 +1,23 @@
@ECHO OFF
:: Create build directory and enter it
MKDIR bin
CD bin
:: Create internal build and install directory
MKDIR build
MKDIR install
:: Build with x64 architecture in Release mode
CD build
cmake -A x64 -DCMAKE_CXX_STANDARD=23 ../..
cmake --build . --config Release
cmake --install . --prefix=../install --config Release
CD ..
:: Record install directory
CD install
SET YYCCommonplace_ROOT=%CD%
CD ..
:: Back to root directory
CD ..

View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail
# Create build and install directory
mkdir build
mkdir install
# Record install directory first because build step require it
cd install
set ZLIB_ROOT=$(pwd)
cd ..
# Build in Release mode
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$ZLIB_ROOT ../..
cmake --build .
cmake --install .
cd ..
# Back to root directory
cd ..

View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail
# Create build and install directory
mkdir build
mkdir install
# Record install directory first because build step require it
cd install
set ZLIB_ROOT=$(pwd)
cd ..
# Build in Release mode
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$ZLIB_ROOT ../..
cmake --build .
cmake --install .
cd ..
# Back to root directory
cd ..

View File

@@ -0,0 +1,20 @@
@ECHO OFF
:: Create build and install directory
MKDIR build
MKDIR install
:: Record install directory first because build step require it
CD install
SET ZLIB_ROOT=%CD%
CD ..
:: Build with x64 architecture in Release mode
CD build
cmake -A x64 -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=%ZLIB_ROOT% ../..
cmake --build . --config Release
cmake --install . --config Release
CD ..
:: Back to root directory
CD ..

View File

@@ -0,0 +1,69 @@
name: LibCmo Linux Build
on: [workflow_dispatch]
jobs:
linux-build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Dependencies
shell: bash
run: |
sudo apt update
sudo apt install -y build-essential cmake git
- name: Fetch YYCCommonplace
uses: actions/checkout@v4
with:
repository: 'yyc12345/YYCCommonplace'
ref: 'master'
path: 'extern/YYCCommonplace'
- name: Build YYCCommonplace
shell: bash
run: |
cd extern/YYCCommonplace
chmod +x ../../.github/scripts/yycc-linux.sh
source ../../.github/scripts/yycc-linux.sh
echo "YYCCommonplace_ROOT=$YYCCommonplace_ROOT" >> "$GITHUB_ENV"
cd ../..
- name: Fetch ZLIB
uses: actions/checkout@v4
with:
repository: 'madler/zlib'
ref: 'v1.3.1'
path: 'extern/zlib'
- name: Build ZLIB
shell: bash
run: |
cd extern/zlib
chmod +x ../../.github/scripts/zlib-linux.sh
source ../../.github/scripts/zlib-linux.sh
echo "ZLIB_ROOT=$ZLIB_ROOT" >> "$GITHUB_ENV"
cd ../..
- name: Fetch STB
uses: actions/checkout@v4
with:
repository: 'nothings/stb'
ref: '2e2bef463a5b53ddf8bb788e25da6b8506314c08'
path: 'extern/stb'
- name: Build STB
shell: bash
run: |
cd extern/stb
chmod +x ../../.github/scripts/stb-linux.sh
source ../../.github/scripts/stb-linux.sh
echo "STB_ROOT=$STB_ROOT" >> "$GITHUB_ENV"
cd ../..
- name: Build LibCmo
shell: bash
run: |
chmod +x ./.github/scripts/linux.sh
./.github/scripts/linux.sh
- name: Upload Built Artifact
uses: actions/upload-artifact@v4
with:
name: LibCmo-linux-build
path: bin/install/*
retention-days: 30

View File

@@ -0,0 +1,64 @@
name: LibCmo macOS Build
on: [workflow_dispatch]
jobs:
macos-build:
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Fetch YYCCommonplace
uses: actions/checkout@v4
with:
repository: 'yyc12345/YYCCommonplace'
ref: 'master'
path: 'extern/YYCCommonplace'
- name: Build YYCCommonplace
shell: bash
run: |
cd extern/YYCCommonplace
chmod +x ../../.github/scripts/yycc-macos.sh
source ../../.github/scripts/yycc-macos.sh
echo "YYCCommonplace_ROOT=$YYCCommonplace_ROOT" >> "$GITHUB_ENV"
cd ../..
- name: Fetch ZLIB
uses: actions/checkout@v4
with:
repository: 'madler/zlib'
ref: 'v1.3.1'
path: 'extern/zlib'
- name: Build ZLIB
shell: bash
run: |
cd extern/zlib
chmod +x ../../.github/scripts/zlib-macos.sh
source ../../.github/scripts/zlib-macos.sh
echo "ZLIB_ROOT=$ZLIB_ROOT" >> "$GITHUB_ENV"
cd ../..
- name: Fetch STB
uses: actions/checkout@v4
with:
repository: 'nothings/stb'
ref: '2e2bef463a5b53ddf8bb788e25da6b8506314c08'
path: 'extern/stb'
- name: Build STB
shell: bash
run: |
cd extern/stb
chmod +x ../../.github/scripts/stb-macos.sh
source ../../.github/scripts/stb-macos.sh
echo "STB_ROOT=$STB_ROOT" >> "$GITHUB_ENV"
cd ../..
- name: Build LibCmo
shell: bash
run: |
chmod +x ./.github/scripts/macos.sh
./.github/scripts/macos.sh
- name: Upload Built Artifact
uses: actions/upload-artifact@v4
with:
name: LibCmo-macos-build
path: bin/install/*
retention-days: 30

View File

@@ -1,4 +1,4 @@
name: YYCC Windows Build name: LibCmo Windows Build
on: [workflow_dispatch] on: [workflow_dispatch]
@@ -25,14 +25,9 @@ jobs:
- name: Build YYCCommonplace - name: Build YYCCommonplace
shell: cmd shell: cmd
run: | run: |
:: Enter directory
cd extern/YYCCommonplace cd extern/YYCCommonplace
:: Build library call ..\..\.github\scripts\yycc-windows.bat
..\..\.github\scripts\yycc-windows.bat echo set YYCCommonplace_ROOT=%YYCCommonplace_ROOT% > ../envs.bat
:: Fetch install directory
cd install
echo set YYCCommonplace_ROOT=%CD% > ../../envs.bat
cd ..
cd ../.. cd ../..
- name: Fetch ZLIB - name: Fetch ZLIB
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -43,14 +38,9 @@ jobs:
- name: Build ZLIB - name: Build ZLIB
shell: cmd shell: cmd
run: | run: |
:: Enter directory
cd extern/zlib cd extern/zlib
:: Build library
..\..\.github\scripts\zlib-windows.bat ..\..\.github\scripts\zlib-windows.bat
:: Fetch install directory echo set ZLIB_ROOT=%ZLIB_ROOT% >> ../envs.bat
cd install
echo set ZLIB_ROOT=%CD% >> ../../envs.bat
cd ..
cd ../.. cd ../..
- name: Fetch STB - name: Fetch STB
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -61,10 +51,9 @@ jobs:
- name: Build STB - name: Build STB
shell: cmd shell: cmd
run: | run: |
:: Enter directory
cd extern/stb cd extern/stb
:: Fetch install directory ..\..\.github\scripts\stb-windows.bat
echo set STB_ROOT=%CD% >> ../envs.bat echo set STB_ROOT=%STB_ROOT% >> ../envs.bat
cd ../.. cd ../..
- name: Build LibCmo - name: Build LibCmo
shell: cmd shell: cmd
@@ -77,7 +66,7 @@ jobs:
:: Extract saved environment variables :: Extract saved environment variables
call .\extern\envs.bat call .\extern\envs.bat
:: Build Project :: Build Project
.\.github\script\windows.bat .\.github\scripts\windows.bat
- name: Upload Built Artifact - name: Upload Built Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:

View File

@@ -8,10 +8,10 @@ project(NeMo
# Provide options # Provide options
option(NEMO_BUILD_UNVIRT "Build Unvirt, the console interface operator of LibCmo." ON) option(NEMO_BUILD_UNVIRT "Build Unvirt, the console interface operator of LibCmo." ON)
option(NEMO_BUILD_BALLANCE "Build Ballance stuff, including BMap and BMapInspector." OFF) option(NEMO_BUILD_BALLANCE "Build Ballance artifacts, including BMap and BMapInspector." OFF)
option(NEMO_BUILD_BMAP "Build BMap, the example use of LibCmo which can read and write Ballance game map." OFF) option(NEMO_BUILD_BMAP "Build BMap, the example use of LibCmo which can read and write Ballance game map." OFF)
option(NEMO_BUILD_BMAPINSPECTOR "Build BMapInspector, the example use of LibCmo which can validate Ballance game map." OFF) option(NEMO_BUILD_BMAPINSPECTOR "Build BMapInspector, the example use of LibCmo which can validate Ballance game map." OFF)
option(NEMO_BUILD_DOC "Build document of LibCmo and all related stuff." OFF) option(NEMO_BUILD_DOC "Build document of LibCmo." OFF)
# Set C++ standards # Set C++ standards
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)

View File

@@ -80,9 +80,14 @@ First, there is a list listing all variables you may configure during compiling.
* `NEMO_BUILD_UNVIRT`: Set it to `ON` to build `Unvirt`. `ON` in default. * `NEMO_BUILD_UNVIRT`: Set it to `ON` to build `Unvirt`. `ON` in default.
This is an interactive tool for loading, saving Virtools file. This is an interactive tool for loading, saving Virtools file.
It is extremely useful for debugging this project. It is extremely useful for debugging this project.
* `NEMO_BUILD_BALLANCE`: Set it to `ON` to build Ballance related artifacts. `OFF` in default.
If you disable this, Ballance related artifacts, BMap and BMapInspector, will not be built.
* `NEMO_BUILD_BMAP`: Set it to `ON` to build `BMap`. `OFF` in default. * `NEMO_BUILD_BMAP`: Set it to `ON` to build `BMap`. `OFF` in default.
It is a dynamic library specific used for loading Ballance map file. It is a dynamic library specific used for loading Ballance map file.
If you are coming from my another project [BallanceBlenderPlugin](https://github.com/yyc12345/BallanceBlenderHelper), this is what you need. If you are coming from my another project [BallanceBlenderPlugin](https://github.com/yyc12345/BallanceBlenderHelper), this is what you need.
* `NEMO_BUILD_BMAPINSPECTOR`: Set it to `ON` to build `BMapInspector`. `OFF` in default.
It is a executable specific used for checking whether given Ballance map file is valid for playing.
Usually you do not need this except you are a mapper in Ballance.
* `NEMO_BUILD_DOC`: Set it to `ON` to build documentation. `OFF` in default. * `NEMO_BUILD_DOC`: Set it to `ON` to build documentation. `OFF` in default.
It may be useful for the developer who firstly use this project in their own projects. It may be useful for the developer who firstly use this project in their own projects.
Please note that generated documentation is different in different platforms. Please note that generated documentation is different in different platforms.

View File

@@ -943,12 +943,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = @CMAKE_CURRENT_LIST_DIR@/../LibCmo \ INPUT = @CMAKE_CURRENT_LIST_DIR@/../LibCmo
@CMAKE_CURRENT_LIST_DIR@/../Unvirt \
@CMAKE_CURRENT_LIST_DIR@/../BMap \
@CMAKE_CURRENT_LIST_DIR@/LibCmo \
@CMAKE_CURRENT_LIST_DIR@/Unvirt \
@CMAKE_CURRENT_LIST_DIR@/Bmap
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses