Switch macOS static build to CMake (#1938)

This moves the tortuous flags out of our CI scripts,
and allows us to benefit from the libpng download caching.
This commit is contained in:
Eldred Habert
2026-04-13 04:26:15 +02:00
committed by GitHub
parent bc3572ec37
commit 65ec1af1e8
5 changed files with 47 additions and 33 deletions
-23
View File
@@ -1,23 +0,0 @@
#!/bin/bash
set -euo pipefail
pngver=1.6.56
## Grab sources and check them
curl -LOJ "http://prdownloads.sourceforge.net/libpng/libpng-$pngver.tar.xz?download"
echo f7d8bf1601b7804f583a254ab343a6549ca6cf27d255c302c47af2d9d36a6f18 \*libpng-$pngver.tar.xz | \
shasum -a 256 -c -
## Extract sources and patch them
tar -xvf libpng-$pngver.tar.xz
## Start building!
mkdir -p build
cd build
../libpng-$pngver/configure --disable-shared --enable-static \
CFLAGS="-O3 -flto -DNDEBUG -mmacosx-version-min=10.9 -arch x86_64 -arch arm64 -fno-exceptions"
make -kj
make install prefix="$PWD/../libpng-staging"
@@ -54,13 +54,10 @@ jobs:
- name: Install deps
run: |
./.github/scripts/install_deps.sh macos
- name: Build libpng
run: |
./.github/scripts/build_libpng.sh
# We force linking libpng statically; the other libs are provided by macOS itself
- name: Build binaries
run: |
make -kj CXXFLAGS="-O3 -flto -DNDEBUG -mmacosx-version-min=10.9 -arch x86_64 -arch arm64" PNGCFLAGS="-I libpng-staging/include" PNGLDLIBS="libpng-staging/lib/libpng.a -lz" Q=
cmake -S . -B build --preset macos-static -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}"
cmake --build build
strip rgb{asm,link,fix,gfx}
- name: Package binaries
run: |
+9 -5
View File
@@ -109,12 +109,16 @@ jobs:
- name: Install deps
run: |
./.github/scripts/install_deps.sh macos
- name: Build libpng
run: |
./.github/scripts/build_libpng.sh
- name: Cache library deps
uses: actions/cache@v5
with:
path: ${{ env.DEPS_ROOT_DIR }}/*-tmp/
key: dep-srcs-${{ hashFiles('cmake/deps.cmake') }}
enableCrossOsArchive: true
- name: Build & install
run: |
make -kj CXXFLAGS="-O3 -flto -DNDEBUG -mmacosx-version-min=10.9 -arch x86_64 -arch arm64" PNGCFLAGS="-I libpng-staging/include" PNGLDLIBS="libpng-staging/lib/libpng.a -lz" Q=
cmake -S . -B build --preset macos-static -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}"
cmake --build build
- name: Package binaries
run: |
mkdir bins
@@ -168,7 +172,7 @@ jobs:
with:
path: ${{ env.DEPS_ROOT_DIR }}/*-tmp/
key: dep-srcs-${{ hashFiles('cmake/deps.cmake') }}
enableCrossOsArchive: true # Currently only used on Windows, but the contents are OS-agnostic.
enableCrossOsArchive: true
- name: Build Windows binaries
run: | # ASan seems to be broken on Windows, so we disable it.
cmake -S . -B build --preset develop-msvc${{ matrix.bits }} -DSANITIZERS=OFF \