Update #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
linux: | |
name: Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
BUILD: [x64, ARM32, ARM64] | |
include: | |
- BUILD: x64 | |
ARCH: x64 | |
PACKAGES: gcc | |
CC: CC=gcc | |
STRIP: strip | |
- BUILD: ARM32 | |
ARCH: arm32 | |
CROSS_ARCH: armhf | |
PACKAGES: gcc-arm-linux-gnueabihf libc6-dev-armhf-cross | |
CC: PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig CC=arm-linux-gnueabihf-gcc | |
STRIP: arm-linux-gnueabihf-strip | |
- BUILD: ARM64 | |
ARCH: arm64 | |
CROSS_ARCH: arm64 | |
PACKAGES: gcc-aarch64-linux-gnu libc6-dev-arm64-cross | |
CC: PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/lib/aarch64-linux-gnu/pkgconfig CC=aarch64-linux-gnu-gcc | |
STRIP: aarch64-linux-gnu-strip | |
env: | |
OVERRUNGL_ARCH: ${{matrix.ARCH}} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
sudo sed -i 's/deb http/deb [arch=amd64,i386] http/' /etc/apt/sources.list | |
sudo grep "ubuntu.com/ubuntu" /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list | |
sudo sed -i 's/amd64,i386/armhf,arm64/' /etc/apt/sources.list.d/ports.list | |
sudo sed -i 's#http://.*/ubuntu#http://ports.ubuntu.com/ubuntu-ports#' /etc/apt/sources.list.d/ports.list | |
sudo dpkg --add-architecture ${{matrix.CROSS_ARCH}} | |
sudo apt-get update || true | |
if: contains(matrix.ARCH, 'x64') != true | |
name: Prepare cross-compilation | |
- run: sudo apt-get -yq --allow-unauthenticated --no-install-suggests --no-install-recommends install ${{matrix.PACKAGES}} -o Dpkg::Options::="--force-overwrite" | |
name: Install dependencies | |
- run: ${{matrix.CC}} cmake -B ${{github.workspace}}/build -DCMAKE_C_FLAGS="-std=c99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" | |
name: Configure CMake | |
- run: | | |
cmake --build ${{github.workspace}}/build --parallel | |
${{matrix.STRIP}} ${{github.workspace}}/build/libstb.so | |
name: Build | |
- uses: actions/upload-artifact@v3 | |
name: Upload Artifacts | |
with: | |
name: Artifacts Linux ${{ matrix.ARCH }} | |
path: ${{github.workspace}}/build/libstb.so | |
macos: | |
name: macOS | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
ARCH: [x64, ARM64] | |
include: | |
- ARCH: x64 | |
CMAKE_PARAMS: -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 | |
- ARCH: ARM64 | |
CMAKE_PARAMS: -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES=arm64 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{matrix.CMAKE_PARAMS}} | |
name: Configure CMake | |
- run: | | |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel | |
strip -u -r ${{github.workspace}}/build/libstb.dylib | |
name: Build | |
- uses: actions/upload-artifact@v3 | |
name: Upload Artifacts | |
with: | |
name: Artifacts macOS ${{ matrix.ARCH }} | |
path: ${{github.workspace}}/build/libstb.dylib | |
windows: | |
name: Windows | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
ARCH: [x64, ARM64] | |
include: | |
- ARCH: x64 | |
PLATFORM: x64 | |
- ARCH: ARM64 | |
PLATFORM: ARM64 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -A ${{ matrix.PLATFORM }} -DUSE_MSVC_RUNTIME_LIBRARY_DLL=OFF | |
name: Configure CMake | |
- run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel | |
name: Build | |
- uses: actions/upload-artifact@v3 | |
name: Upload Artifacts | |
with: | |
name: Artifacts Windows ${{ matrix.ARCH }} | |
path: ${{github.workspace}}/build/Release/stb.dll |