Skip to content

Commit

Permalink
Added i686/arm/aarch64 linux architectures, and windows arm64 archite…
Browse files Browse the repository at this point in the history
…cture
  • Loading branch information
OM committed Jun 18, 2023
1 parent 35e1813 commit afababd
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 29 deletions.
125 changes: 100 additions & 25 deletions .github/workflows/build-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,78 @@ on:
branches: [ "main" ]
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

container:
image: ubuntu:22.04
volumes:
- ${{github.workspace}}:${{github.workspace}}

steps:
- uses: actions/checkout@v3
with:
path: 'source'

- name: Install required packages
run: apt update && apt install -y clang-15 cmake ninja-build flex bison git

- name: Required packages
run: sudo apt update && sudo apt install -y flex bison ninja-build libsdl2-dev
- name: Install required cross-platform packages (${{ matrix.architecture.triple }})
if: matrix.architecture.name != 'amd64'
run: apt install -y gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}

- name: Install dependencies
working-directory: ${{github.workspace}}
run: |
echo Using triple: ${{ matrix.architecture.triple }}
mkdir -p thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch SDL2 https://github.com/libsdl-org/SDL.git
cmake -B SDL-build \
-DCMAKE_C_COMPILER=clang-15 \
-DCMAKE_CXX_COMPILER=clang++-15 \
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/SDL-install' \
./SDL
cmake --build SDL-build --config Release
cmake --install SDL-build
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DWITH_CLIENT=1 -G Ninja
working-directory: ${{github.workspace}}
run: |
cmake -B ./build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DCMAKE_C_COMPILER=clang-15 \
-DCMAKE_CXX_COMPILER=clang++-15 \
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
-DSDL2_DIR='${{github.workspace}}/thirdparties/SDL-install/lib/cmake/SDL2' \
-DWITH_CLIENT=1 \
-G Ninja \
./source
- name: Build
working-directory: ${{github.workspace}}
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j4

Expand All @@ -35,45 +89,63 @@ jobs:
run: 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}}
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
cp '${{github.workspace}}/thirdparties/SDL-install/lib/libSDL2.so' '${{github.workspace}}/install'
- uses: actions/upload-artifact@v3
with:
name: out-linux-x64
name: out-linux-${{matrix.architecture.name}}
if-no-files-found: error
path: ${{github.workspace}}/install

path:
${{github.workspace}}/install

build-platform-windows:
strategy:
matrix:
architecture: ['x64', 'x86']
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:
- uses: actions/checkout@v3
with:
path: 'source'

- name: Required packages
- name: Install required packages
working-directory: ${{github.workspace}}
run: |
mkdir ${{github.workspace}}/others && cd ${{github.workspace}}/others
mkdir thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch SDL2 https://github.com/libsdl-org/SDL.git
cmake -B SDL-build -A ${{ matrix.architecture.config }} -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/SDL-install' ./SDL
cmake --build SDL-build --config Release
cmake --install SDL-build
git clone --depth 1 --single-branch --branch v2.5.25 https://github.com/lexxmark/winflexbison.git
mkdir ${{github.workspace}}/others/winflexbison/build
cd ${{github.workspace}}/others/winflexbison/build
cmake -DCMAKE_BUILD_TYPE=Release ..\
cmake --build . --config Release
cmake --install . --config Release
- name: Configure CMake (Win32 config)
if: matrix.architecture == 'x86'
run: cmake -B ${{github.workspace}}/build -A Win32 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DWITH_CLIENT=1
cmake -B winflexbison-build -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/winflexbison-install' ./winflexbison
cmake --build winflexbison-build --config Release
cmake --install winflexbison-build
- name: Configure CMake (x64 config)
if: matrix.architecture == 'x64'
run: cmake -B ${{github.workspace}}/build -A x64 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DWITH_CLIENT=1
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ${{github.workspace}}/build -A ${{ matrix.architecture.config }} `
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
-DSDL2_DIR='${{github.workspace}}/thirdparties/SDL-install/cmake' `
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe' `
-DWITH_CLIENT=1 `
./source
- name: Build
working-directory: ${{github.workspace}}
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j4

Expand All @@ -84,20 +156,23 @@ jobs:
run: 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}}
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Copy-Item "${{github.workspace}}/thirdparties/SDL-install/bin/*.dll" -Destination "${{github.workspace}}/install"
- uses: actions/upload-artifact@v3
with:
name: out-windows-${{matrix.architecture}}
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}}-pdb
name: out-windows-${{matrix.architecture.name}}-pdb
if-no-files-found: error
path: |
${{github.workspace}}/install
17 changes: 13 additions & 4 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,28 @@ jobs:

deploy_all:
strategy:
max-parallel: 1
matrix:
target_os: [
'linux-x64',
'linux-amd64',
'linux-i686',
'linux-aarch64',
'linux-armhf',
'windows-x64',
'windows-x86',
'windows-x64-pdb',
'windows-x86-pdb'
'windows-x86-pdb',
'windows-arm64',
'windows-arm64-pdb'
]

runs-on: ubuntu-22.04
environment: release
needs: [build-all]

env:
RELEASE_NAME: ${{ github.event.repository.name }}-${{github.ref_name}}-${{matrix.target_os}}

steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -39,11 +48,11 @@ jobs:

- name: Zip
working-directory: ${{github.workspace}}/${{matrix.target_os}}
run: zip -r ../${{matrix.target_os}}.zip .
run: zip -r ../${{ env.RELEASE_NAME }}.zip ./

- name: Release
uses: softprops/action-gh-release@v1
with:
name: '${{github.ref_name}}-${{env.RELEASE_TYPE}}'
prerelease: ${{env.RELEASE_IS_PRERELEASE}}
files: ${{github.workspace}}/${{matrix.target_os}}.zip
files: ${{github.workspace}}/${{ env.RELEASE_NAME }}.zip

0 comments on commit afababd

Please sign in to comment.