Skip to content

Commit

Permalink
Don't use external zlib -- the buildsystem is stupid.
Browse files Browse the repository at this point in the history
Use a bundled one and then just delete the thing and download own
version instead.
  • Loading branch information
mosra committed Jan 31, 2024
1 parent e8a6620 commit b3d3fa0
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions .github/workflows/assimp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ concurrency:
cancel-in-progress: true

env:
ZLIB_VERSION: 1.3.1
ASSIMP_VERSION: 5.3.1
# 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:
Expand All @@ -30,12 +34,11 @@ jobs:
repository: assimp/assimp
ref: v${{ env.ASSIMP_VERSION }}
path: assimp
- name: Download prebuilt zlib
# Built on the `zlib` branch but hosted manually to avoid having to mess
# with access permissions
run: |
Invoke-WebRequest https://ci.magnum.graphics/zlib-${{ env.ZLIB_VERSION }}-${{ matrix.os }}.zip -OutFile zlib.zip
7z x zlib.zip -o${{ github.workspace }}/deps
# 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: |
Expand All @@ -46,14 +49,10 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug ^
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF ^
-DASSIMP_BUILD_TESTS=OFF ^
-DASSIMP_BUILD_ZLIB=OFF ^
-DASSIMP_BUILD_ZLIB=ON ^
-DASSIMP_NO_EXPORT=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DZLIB_INCLUDE_DIR=${{ github.workspace }}/deps/include ^
-DZLIB_LIBRARY_REL=${{ github.workspace }}/deps/lib/zlibstatic.lib ^
-DZLIB_LIBRARY_DBG=${{ github.workspace }}/deps/lib/zlibstatic.lib ^
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/../install-debug ^
-DCMAKE_PREFIX_PATH=%CD:\=/%/deps ^
-G Ninja
ninja install
- name: Build & install Release
Expand All @@ -66,16 +65,16 @@ jobs:
-DCMAKE_BUILD_TYPE=Release ^
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF ^
-DASSIMP_BUILD_TESTS=OFF ^
-DASSIMP_BUILD_ZLIB=OFF ^
-DASSIMP_BUILD_ZLIB=ON ^
-DASSIMP_NO_EXPORT=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DZLIB_INCLUDE_DIR=${{ github.workspace }}/deps/include ^
-DZLIB_LIBRARY_REL=${{ github.workspace }}/deps/lib/zlibstatic.lib ^
-DZLIB_LIBRARY_DBG=${{ github.workspace }}/deps/lib/zlibstatic.lib ^
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/../install ^
-DCMAKE_PREFIX_PATH=%CD:\=/%/deps ^
-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:
Expand All @@ -101,12 +100,11 @@ jobs:
repository: assimp/assimp
ref: v${{ env.ASSIMP_VERSION }}
path: assimp
- name: Download prebuilt zlib
# Built on the `zlib` branch but hosted manually to avoid having to mess
# with access permissions
run: |
Invoke-WebRequest https://ci.magnum.graphics/zlib-${{ env.ZLIB_VERSION }}-windows-mingw.zip -OutFile zlib.zip
7z x zlib.zip -o${{ github.workspace }}/deps
# 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: |
Expand All @@ -117,16 +115,15 @@ jobs:
-DCMAKE_BUILD_TYPE=Release ^
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF ^
-DASSIMP_BUILD_TESTS=OFF ^
-DASSIMP_BUILD_ZLIB=OFF ^
-DASSIMP_BUILD_ZLIB=ON ^
-DASSIMP_NO_EXPORT=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DZLIB_INCLUDE_DIR=${{ github.workspace }}/deps/include ^
-DZLIB_LIBRARY_REL=${{ github.workspace }}/deps/lib/libzlibstatic.a ^
-DZLIB_LIBRARY_DBG=${{ github.workspace }}/deps/lib/libzlibstatic.a ^
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/../install ^
-DCMAKE_PREFIX_PATH=%CD:\=/%/deps ^
-G Ninja
ninja install
- name: Remove bundled zlib
run: |
del install\lib\libzlibstatic.a
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
Expand All @@ -147,33 +144,36 @@ jobs:
- name: Install base build tools
run: |
apt update
apt install -y ninja-build cmake g++ wget unzip
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
- name: Fetch prebuilt zlib
run: |
mkdir -p deps && cd deps
wget https://ci.magnum.graphics/zlib-${{ env.ZLIB_VERSION }}-${{ matrix.os }}.zip
unzip zlib-${{ env.ZLIB_VERSION }}-${{ matrix.os }}.zip
# 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=OFF \
-DASSIMP_BUILD_ZLIB=ON \
-DASSIMP_NO_EXPORT=ON \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=$(pwd)/../install \
-DCMAKE_PREFIX_PATH=$(pwd)/../deps \
-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:
Expand Down

0 comments on commit b3d3fa0

Please sign in to comment.