build for more architectures

This commit is contained in:
William Bell
2025-08-16 03:41:32 +01:00
parent 6ddf9953e7
commit fb8b6a89ae

View File

@@ -12,13 +12,21 @@ on:
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64, arm64]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install build tools
run: sudo apt-get update && sudo apt-get install -y flex bison
run: |
sudo apt-get update
sudo apt-get install -y flex bison make cmake build-essential
if [ "${{ matrix.arch }}" = "arm64" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
fi
- name: Setup Python
uses: actions/setup-python@v4
@@ -33,17 +41,28 @@ jobs:
- name: Build
run: |
conan install . --build=missing
conan build .
BUILD_DIR="build_${{ matrix.arch }}"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
if [ "${{ matrix.arch }}" = "arm64" ]; then
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
fi
conan install .. --build=missing
conan build ..
cd ..
- name: Package
run: |
TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
OS="linux"
ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER"
mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
@@ -51,11 +70,14 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-artifact
name: linux-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }}
build-macos:
runs-on: macos-latest
strategy:
matrix:
arch: [x86_64, arm64] # build both architectures
steps:
- uses: actions/checkout@v3
with:
@@ -77,17 +99,29 @@ jobs:
- name: Build
run: |
conan install . --build=missing
conan build .
# Create a build directory per arch
BUILD_DIR="build_${{ matrix.arch }}"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Use the matrix architecture for the build
export CFLAGS="-arch ${{ matrix.arch }}"
export CXXFLAGS="-arch ${{ matrix.arch }}"
export LDFLAGS="-arch ${{ matrix.arch }}"
conan install .. --build=missing
conan build ..
cd ..
- name: Package
run: |
TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
OS="macos"
ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER"
mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
@@ -95,11 +129,14 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-artifact
name: macos-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }}
build-windows:
runs-on: windows-latest
strategy:
matrix:
arch: [x86_64, arm64]
defaults:
run:
shell: msys2 {0}
@@ -109,7 +146,8 @@ jobs:
with:
submodules: recursive
- uses: msys2/setup-msys2@v2
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
@@ -130,25 +168,37 @@ jobs:
- name: Build Project
run: |
conan install . --profile mingw-profile.txt --build=missing
conan build . --profile mingw-profile.txt
BUILD_DIR="build_${{ matrix.arch }}"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
if [ "${{ matrix.arch }}" = "arm64" ]; then
# Use the ARM64 cross-compiler
export CC=aarch64-w64-mingw32-gcc
export CXX=aarch64-w64-mingw32-g++
fi
conan install .. --profile mingw-profile.txt --build=missing
conan build .. --profile mingw-profile.txt
cd ..
- name: Package
run: |
TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
OS="windows"
ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER"
ZIP="$FOLDER.zip"
mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
powershell Compress-Archive -Path "$FOLDER" -DestinationPath "$ZIP"
echo "TAR_NAME=$ZIP" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-artifact
name: windows-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }}
release: