Skip to content

Reimplemented a few methods (from moh 2.0 and above) #161

Reimplemented a few methods (from moh 2.0 and above)

Reimplemented a few methods (from moh 2.0 and above) #161

Workflow file for this run

name: Build
on:
push:
pull_request:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
jobs:
build-platform-linux:
strategy:
matrix:
architecture: [
{name: 'amd64', triple: 'x86_64-linux-gnu'},
{name: 'i686', triple: 'i686-linux-gnu'},
{name: 'aarch64', triple: 'aarch64-linux-gnu'},
{name: 'armhf', triple: 'arm-linux-gnueabihf'}
]
name: "Building for platform linux-${{matrix.architecture.name}}"
runs-on: ubuntu-22.04
steps:
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_BUILD_PARALLEL_LEVEL=$(($(nproc) * 16))" >> $GITHUB_ENV
# echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
- name: Install required packages
run: |
sudo apt update && sudo apt install -y flex bison
- name: Install required cross-platform packages (${{ matrix.architecture.triple }})
if: matrix.architecture.name != 'amd64'
run: sudo apt install -y gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: sdl2-latest
build-type: Release
cmake-arguments: "-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }}
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }}"
- uses: actions/checkout@v3
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
cp '${{steps.sdl.outputs.prefix}}/lib/libSDL2.so' '${{github.workspace}}/install'
- uses: actions/upload-artifact@v3
with:
name: out-linux-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/install
build-platform-windows:
strategy:
matrix:
architecture: [
{name: 'x64', config: 'x64' },
{name: 'x86', config: 'Win32' },
{name: 'arm64', config: 'ARM64' }
]
name: "Building for platform windows-${{matrix.architecture.name}}"
runs-on: windows-2022
steps:
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_BUILD_PARALLEL_LEVEL=$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors * 16)" >> $GITHUB_ENV
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: sdl2-latest
build-type: Release
cmake-arguments: "-A ${{ matrix.architecture.config }}"
- name: Install Flex/Bison
working-directory: ${{github.workspace}}
run: |
mkdir thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch v2.5.25 https://github.com/lexxmark/winflexbison.git
cmake -B winflexbison-build -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/winflexbison-install' ./winflexbison
cmake --build winflexbison-build --config Release --parallel
cmake --install winflexbison-build
- uses: actions/checkout@v3
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=-A ${{ matrix.architecture.config }} `
--log-level=VERBOSE `
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/install'
- uses: actions/upload-artifact@v3
with:
name: out-windows-${{matrix.architecture.name}}
if-no-files-found: error
path: |
${{github.workspace}}/install
!${{github.workspace}}/install/**/*.pdb
- uses: actions/upload-artifact@v3
with:
name: out-windows-${{matrix.architecture.name}}-pdb
if-no-files-found: error
path: |
${{github.workspace}}/install