Skip to content

Meson Build (Linux, macOS) #11

Meson Build (Linux, macOS)

Meson Build (Linux, macOS) #11

Workflow file for this run

name: Meson Build (Linux, macOS)
on:
# Triggers the workflow when manually dispatched
workflow_dispatch:
inputs:
upload_artefacts:
description: "Upload build artefacts"
type: boolean
required: false
default: false
build_type:
description: "Build Configuration"
type: choice
required: false
default: "release"
options:
- "release"
- "debug"
debug_level:
description: "Debug Level"
type: choice
required: false
default: "release"
options:
- "release"
- "minimal"
- "full"
new_release_version:
type: string
required: false
osx-version:
type: string
required: false
default: "11.1"
macosx-deployment-target:
type: string
required: false
default: "10.15"
# Triggers the workflow when called by a top-level workflow
workflow_call:
inputs:
upload_artefacts:
type: boolean
required: false
default: false
build_type: # "release" | "debug"
type: string
required: false
default: "release"
debug_level: # "full" | "minimal" | "release"
type: string
required: false
default: "release"
new_release_version:
type: string
required: false
osx-version:
type: string
required: false
default: "11.1"
macosx-deployment-target:
type: string
required: false
default: "10.15"
jobs:
build-linux:
runs-on: ubuntu-latest
name: Linux Build
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Dependencies
run: |
sudo apt-get update -yq
sudo apt-get install --no-install-recommends wget liballegro4-dev libloadpng4-dev libflac++-dev luajit-5.1-dev liblua5.2-dev libminizip-dev liblz4-dev libpng++-dev libx11-dev libboost-dev libtbb-dev libsdl2-dev libsdl2-image-dev libopengl-dev libfuse2 ninja-build ccache
sudo pip install meson
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}-${{ matrix.os }}
- name: Set Version
if: ${{inputs.new_release_version}}
uses: ./.github/actions/set_version
with:
new_release_version: ${{inputs.new_release_version}}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Meson
env:
CC: "ccache gcc"
CXX: "ccache g++"
run: |
meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} -Db_lto=false build
- name: Configure for AppImage
if: ${{inputs.upload_artefacts}}
env:
CC: "ccache gcc"
CXX: "ccache g++"
run: meson configure -Db_lto=true -Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=/usr/lib/ --prefix=/usr/ build
- name: Build
env:
CC: "ccache gcc"
CXX: "ccache g++"
run: |
meson compile -C build
- name: Create AppDir
if: ${{inputs.upload_artefacts}}
run: |
echo "Setting output prefix"
DESTDIR=${GITHUB_WORKSPACE}/build/AppDir meson install -C $GITHUB_WORKSPACE"/build"
- name: Download linuxdeploy
if: ${{inputs.upload_artefacts}}
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O lindeploy
chmod +x lindeploy
- name: Create AppImage
if: ${{inputs.upload_artefacts}}
working-directory: ${{env.GITHUB_WORKSPACE}}
env:
LD_LIBRARY_PATH: ./external/lib/linux/x86_64/
OUTPUT: CortexCommand.AppImage
run: |
echo ${LD_LIBRARY_PATH}
./lindeploy --appdir=build/AppDir --output appimage
- name: Upload Appimage
if: ${{inputs.upload_artefacts}}
uses: actions/upload-artifact@v4
with:
name: CortexCommand (Linux)
path: CortexCommand.AppImage
if-no-files-found: error
build-macos-arm:
runs-on: macos-latest
name: MacOS Build
env:
MACOSX_DEPLOYMENT_TARGET: ${{inputs.macosx-deployment-target}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: "Install Dependencies"
run: |
brew install ccache pkg-config sdl2 sdl2_image minizip lz4 flac luajit lua libpng tbb ninja meson dylibbundler
- name: Set Version
if: ${{inputs.new_release_version}}
uses: ./.github/actions/set_version
with:
new_release_version: ${{inputs.new_release_version}}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}-${{ matrix.os }}
- name: Setup Meson
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
CC: "gcc-14"
CXX: "g++-14"
run: |
meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} -Db_lto=false build
- name: Configure for App Bundle
if: ${{inputs.upload_artefacts}}
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
run: |
meson configure \
-Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=Contents/Frameworks \
--bindir=Contents/MacOS \
--prefix="/" \
-Ddylibbundler_args="-ns" \
build
- name: Build
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
run: |
meson compile -C build
- name: Create App Bundle
if: ${{inputs.upload_artefacts}}
run: |
meson install --destdir="/tmp/Cortex Command.app" -C build
- name: Tar files
if: ${{inputs.upload_artefacts}}
run: |
cd /tmp/
tar -cvf CortexCommand.tar "Cortex Command.app"
- name: Move artefact
if: ${{inputs.upload_artefacts}}
run: cp /tmp/CortexCommand.tar .
- name: Artifact Deploy
if: ${{inputs.upload_artefacts}}
uses: actions/upload-artifact@v4
with:
name: CortexCommand (macOS)
path: |
CortexCommand.tar
if-no-files-found: error
build-macos-x86:
runs-on: ubuntu-latest
name: MacOS Build
env:
MACOSX_DEPLOYMENT_TARGET: ${{inputs.macosx-deployment-target}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: "Install Osxcross"
id: osxcross
uses: ./.github/actions/osxcross
with:
osx-version: ${{ inputs.osx-version }}
- name: "Cache Dependencies"
uses: actions/cache@v4
with:
key: ${{runner.os}}-${{inputs.osx-version}}-macports
path: ${{env.OSXCROSS_FOLDER}}/target/macports
- name: "Install Dependencies"
env:
OSXCROSS_MACPORTS_MIRROR: "https://packages.macports.org"
run: |
echo "::group::Installing pkg-config"
sudo apt install pkg-config
echo "::group::Installing mac deps"
omp install libsdl2 libsdl2_image onetbb lz4 libpng minizip luajit flac
echo "OSXCROSS_PKG_CONFIG_PATH=${{env.OSXCROSS_TARGET}}/macports/pkgs/opt/local/libexec/onetbb/lib/pkgconfig" >> $GITHUB_ENV
echo "::endgroup::"
echo "::group::Installing meson"
pip install meson ninja
echo "::endgroup::"
- name: Set Version
if: ${{inputs.new_release_version}}
uses: ./.github/actions/set_version
with:
new_release_version: ${{inputs.new_release_version}}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}-${{ matrix.os }}
- name: Setup Meson
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
run: |
meson setup --cross-file=${{steps.osxcross.outputs.meson-osxcross}} --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} -Db_lto=false build
- name: Configure for App Bundle
if: ${{inputs.upload_artefacts}}
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
run: |
meson configure \
-Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=Contents/Frameworks \
--bindir=Contents/MacOS \
--prefix="/" \
-Ddylibbundler_args="-ns -s ${{env.OSXCROSS_TARGET}}/macports/pkgs/opt/local/lib/ \
-s ${{env.OSXCROSS_TARGET}}/macports/pkgs/opt/local/libexec/onetbb/lib/" \
build
- name: Build
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
run: |
meson compile -C build
- name: Create App Bundle
if: ${{inputs.upload_artefacts}}
run: |
meson install --destdir="/tmp/Cortex Command.app" -C build
- name: Tar files
if: ${{inputs.upload_artefacts}}
run: |
cd /tmp/
tar -cvf CortexCommand.tar "Cortex Command.app"
- name: Move artefact
if: ${{inputs.upload_artefacts}}
run: cp /tmp/CortexCommand.tar .
- name: Artifact Deploy
if: ${{inputs.upload_artefacts}}
uses: actions/upload-artifact@v4
with:
name: CortexCommand (macOS)
path: |
CortexCommand.tar
if-no-files-found: error
build-windows:
runs-on: windows-latest
name: Windows Build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Dependencies
run: |
pip install meson
- name: Setup
run: |
meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} --vsenv build
- name: Build
run: |
meson compile -Cbuild