Don't use external zlib -- the buildsystem is stupid. #11
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: Assimp | |
on: [push, pull_request] | |
# Cancel in-progress builds on push to same branch / PR | |
# https://stackoverflow.com/a/72408109 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# zlib is built bundled but then deleted (and the externally built one is | |
# used instead), because attempting to provide an externally-built one causes | |
# its full path to be HARDCODED into the CMake config files, making the | |
# resulting binary useless everywhere except on GH Actions of the magnum-ci | |
# repo again | |
ASSIMP_VERSION: 5.2.5 | |
jobs: | |
windows: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019] | |
steps: | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v3 | |
- name: Set up Visual Studio environment | |
uses: seanmiddleditch/gha-setup-vsdevenv@v3 | |
- name: Clone Assimp | |
uses: actions/checkout@v3 | |
with: | |
repository: assimp/assimp | |
ref: v${{ env.ASSIMP_VERSION }} | |
path: assimp | |
# zlib is built bundled but then deleted (and the externally built one is | |
# used instead), because attempting to provide an externally-built one | |
# causes its full path to be HARDCODED into the CMake config files, making | |
# the resulting binary useless everywhere except on GH Actions of the | |
# magnum-ci repo again | |
- name: Build & install Debug | |
shell: cmd | |
run: | | |
mkdir build-debug && cd build-debug | |
cmake ../assimp ^ | |
-DCMAKE_C_COMPILER=cl.exe ^ | |
-DCMAKE_CXX_COMPILER=cl.exe ^ | |
-DCMAKE_BUILD_TYPE=Debug ^ | |
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF ^ | |
-DASSIMP_BUILD_TESTS=OFF ^ | |
-DASSIMP_BUILD_ZLIB=ON ^ | |
-DASSIMP_NO_EXPORT=ON ^ | |
-DBUILD_SHARED_LIBS=OFF ^ | |
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/../install-debug ^ | |
-G Ninja | |
ninja install | |
- name: Build & install Release | |
shell: cmd | |
run: | | |
mkdir build && cd build | |
cmake ../assimp ^ | |
-DCMAKE_C_COMPILER=cl.exe ^ | |
-DCMAKE_CXX_COMPILER=cl.exe ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF ^ | |
-DASSIMP_BUILD_TESTS=OFF ^ | |
-DASSIMP_BUILD_ZLIB=ON ^ | |
-DASSIMP_NO_EXPORT=ON ^ | |
-DBUILD_SHARED_LIBS=OFF ^ | |
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/../install ^ | |
-G Ninja | |
ninja install | |
- name: Remove bundled zlib | |
run: | | |
del install\lib\zlibstatic.lib | |
del install-debug\lib\zlibstatic.lib | |
- name: Upload Debug artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: assimp-${{ env.ASSIMP_VERSION }}-${{ matrix.os }}-debug | |
path: install-debug | |
- name: Upload Release artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: assimp-${{ env.ASSIMP_VERSION }}-${{ matrix.os }} | |
path: install | |
windows-mingw: | |
name: windows-mingw | |
runs-on: windows-2019 | |
steps: | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v3 | |
- name: Set up MinGW environment | |
uses: msys2/setup-msys2@v2 | |
- name: Clone Assimp | |
uses: actions/checkout@v2 | |
with: | |
repository: assimp/assimp | |
ref: v${{ env.ASSIMP_VERSION }} | |
path: assimp | |
# zlib is built bundled but then deleted (and the externally built one is | |
# used instead), because attempting to provide an externally-built one | |
# causes its full path to be HARDCODED into the CMake config files, making | |
# the resulting binary useless everywhere except on GH Actions of the | |
# magnum-ci repo again | |
- name: Build & install | |
shell: cmd | |
run: | | |
mkdir build && cd build | |
cmake ../assimp ^ | |
-DCMAKE_C_COMPILER=gcc.exe ^ | |
-DCMAKE_CXX_COMPILER=g++.exe ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF ^ | |
-DASSIMP_BUILD_TESTS=OFF ^ | |
-DASSIMP_BUILD_ZLIB=ON ^ | |
-DASSIMP_NO_EXPORT=ON ^ | |
-DBUILD_SHARED_LIBS=OFF ^ | |
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/../install ^ | |
-G Ninja | |
ninja install | |
- name: Remove bundled zlib | |
run: | | |
del install\lib\libzlibstatic.a | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: assimp-${{ env.ASSIMP_VERSION }}-windows-mingw | |
path: install | |
ubuntu: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.runs-on }} | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-18.04 | |
runs-on: ubuntu-latest | |
container: ubuntu:bionic-20220427 | |
steps: | |
- name: Install base build tools | |
run: | | |
apt update | |
apt install -y ninja-build cmake g++ | |
mkdir -p deps | |
- name: Clone Assimp | |
uses: actions/checkout@v3 | |
with: | |
repository: assimp/assimp | |
ref: v${{ env.ASSIMP_VERSION }} | |
path: assimp | |
# zlib is built bundled but then deleted (and the externally built one is | |
# used instead), because attempting to provide an externally-built one | |
# causes its full path to be HARDCODED into the CMake config files, making | |
# the resulting binary useless everywhere except on GH Actions of the | |
# magnum-ci repo again | |
- name: Build & install | |
run: | | |
mkdir assimp-build && cd assimp-build | |
cmake ../assimp \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF \ | |
-DASSIMP_BUILD_TESTS=OFF \ | |
-DASSIMP_BUILD_ZLIB=ON \ | |
-DASSIMP_NO_EXPORT=ON \ | |
-DBUILD_SHARED_LIBS=OFF \ | |
-DCMAKE_INSTALL_PREFIX=$(pwd)/../install \ | |
-G Ninja | |
ninja install/strip | |
- name: Remove bundled zlib, patch the config files to reference different name | |
run: | | |
sed -i 's/libzlibstatic.a/libz.a/g' install/lib/cmake/assimp-5.2/assimpTargets-release.cmake | |
rm install/lib/libzlibstatic.a | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: assimp-${{ env.ASSIMP_VERSION }}-${{ matrix.os }} | |
path: install |