ClassiCube/.github/workflows/build.yml
2021-11-14 00:07:31 -08:00

137 lines
4.9 KiB
YAML

name: Build
on: [push, pull_request]
jobs:
build_on_ubuntu:
name: Build ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) on Ubuntu
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- { plat: "Linux", bits: 64 }
- { plat: "Linux", bits: 32 }
- { plat: "Windows", bits: 64 }
- { plat: "Windows", bits: 32 }
steps:
- uses: actions/checkout@v2
- name: Install Shared Dependencies
run: |
sudo apt-get -y update &&
sudo apt-get -y install build-essential
# Install platform specific dependencies
- name: Install Dependencies for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Linux' && matrix.config.bits == 64
run: |
sudo apt-get -y install libx11-dev libxi-dev libgl1-mesa-dev
- name: Install Dependencies for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Linux' && matrix.config.bits == 32
run: |
sudo dpkg --add-architecture i386 \
&& sudo apt-get -y update \
&& sudo apt-get -y install gcc-multilib libx11-dev:i386 libxi-dev:i386 libgl1-mesa-dev:i386
- name: Install Dependencies for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Windows' && matrix.config.bits == 64
run: |
sudo apt-get -y install gcc-mingw-w64-x86-64
- name: Install Dependencies for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Windows' && matrix.config.bits == 32
run: |
sudo apt-get -y install gcc-mingw-w64-i686
# Build
- name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Linux' && matrix.config.bits == 64
run: |
cd src
make linux
- name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Linux' && matrix.config.bits == 32
run: |
cd src
# Note, this overwrites the previous flags
make linux CFLAGS="-m32" LDFLAGS="-m32"
- name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Windows' && matrix.config.bits == 64
run: |
cd src
make mingw CC="x86_64-w64-mingw32-gcc"
- name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Windows' && matrix.config.bits == 32
run: |
cd src
make mingw CC="i686-w64-mingw32-gcc"
build_on_windows:
name: Build ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) on Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
config:
- { plat: "Windows", bits: 64 }
- { plat: "Windows", bits: 32 }
steps:
- uses: actions/checkout@v2
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1
# Build
- name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Windows' && matrix.config.bits == 64
run: |
msbuild src\ClassiCube.vcxproj `
-property:Configuration=Debug -property:Platform=x64 `
-property:WindowsTargetPlatformVersion=10 -property:PlatformToolset=v142
- name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Windows' && matrix.config.bits == 32
run: |
msbuild src\ClassiCube.vcxproj `
-property:Configuration=Debug -property:Platform=Win32 `
-property:WindowsTargetPlatformVersion=10 -property:PlatformToolset=v142
build_on_mac:
name: Build ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) on Mac
runs-on: macOS-latest
strategy:
fail-fast: false
matrix:
config:
- { plat: "Mac", bits: 64 }
# "ld: warning: ignoring file ..., missing required architecture i386 in file ..."
# "Undefined symbols for architecture i386"
# - { plat: "Mac", bits: 32 }
steps:
- uses: actions/checkout@v2
# Build
- name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Mac' && matrix.config.bits == 64
run: |
cd src
# fix for "error: implicit declaration of function 'CGDisplayBitsPerPixel'"
sed -i '' 's|#include <Cocoa/Cocoa.h>|&\'$'\nextern size_t CGDisplayBitsPerPixel(CGDirectDisplayID display);|' interop_cocoa.m
make mac_x64
- name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit)
if: matrix.config.plat == 'Mac' && matrix.config.bits == 32
run: |
cd src
make mac_x32