Skip to content

Commit

Permalink
ci: macOS: Update testing/release pipeline, enable ANGLE support (#387)
Browse files Browse the repository at this point in the history
This PR upgrades the macOS testing and release pipelines. 

Mostly this involves:

* ~~Bumping from `macos-12` to `macos-14`~~ (on hold due to koishi build complications)
* Changing the meson native/crossfiles to match the new syntax XCode
`clang` expects. (i.e: using `arch` instead of `march`
* Importing the compiled ANGLE `dylibs` and `lipo`ing them together in
the release pipeline so they're "universal" (x64 and ARM64)
* Other stuff to make this all work
  • Loading branch information
StarWitch authored and Akaricchi committed Oct 8, 2024
1 parent 16786dc commit 2878e73
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 20 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
env:
MESON_VERSION: '0.63.3'
EM_VERSION: '3.1.68'
PYTHON_VERSION: '3.11.8'
EM_CACHE_FOLDER: 'emsdk'
TAISEI_NOPRELOAD: 0
TAISEI_PRELOAD_REQUIRED: 1
Expand All @@ -47,7 +48,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Tools
run: >
Expand Down Expand Up @@ -113,16 +114,13 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Tools
run: >
brew install
gcc
pkg-config
docutils
pygments
freetype2
libzip
opusfile
libvorbis
Expand All @@ -135,6 +133,7 @@ jobs:
ninja
setuptools
zstandard
--break-system-packages
- name: Configure
run: >
Expand Down Expand Up @@ -214,7 +213,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Tools
run: >
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ jobs:
python-gnupg
setuptools
zstandard
--break-system-packages
shell: bash

- name: Import GPG Key
Expand All @@ -229,6 +231,12 @@ jobs:
fetch-depth: 0
ref: ${{ env.REF }}

- name: Checkout Compiled ANGLE Libraries
uses: actions/checkout@v4
with:
repository: taisei-project/angle-compiled
path: angle-compiled

- name: Configure
run: |
git config --global --add safe.directory $(pwd)
Expand Down Expand Up @@ -300,7 +308,7 @@ jobs:
fetch-depth: 0
ref: ${{ env.REF }}

- name: Checkout ANGLE DLLs
- name: Checkout Compiled ANGLE Libraries
uses: actions/checkout@v4
with:
repository: taisei-project/angle-compiled
Expand Down Expand Up @@ -391,7 +399,7 @@ jobs:
fetch-depth: 0
ref: ${{ env.REF }}

- name: Checkout ANGLE DLLs
- name: Checkout Compiled ANGLE Libraries
uses: actions/checkout@v4
with:
repository: taisei-project/angle-compiled
Expand Down
7 changes: 5 additions & 2 deletions misc/ci/macos-aarch64-build-release.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[constants]
# apple silicon only supports macOS >=11.x, so just use that
macos_min = '11.1'
cflags = ['-mmacosx-version-min='+macos_min, '-arch', 'arm64', '-mcpu=apple-a14']
cflags = ['-mmacosx-version-min='+macos_min, '-arch', 'arm64', '-mcpu=apple-m1']
ldflags = cflags

[host_machine]
cpu_family = 'aarch64'
cpu = 'apple-a14'
cpu = 'apple-m1'
system = 'darwin'
endian = 'little'

Expand All @@ -21,6 +21,9 @@ pkgconfig = 'pkg-config'
needs_exe_wrapper = true

[project options]
install_angle = true
r_gles30 = 'enabled'
shader_transpiler = 'enabled'
install_macos_bundle = 'enabled'

[built-in options]
Expand Down
23 changes: 19 additions & 4 deletions misc/ci/macos-x86_64-build-release.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
[constants]
march = 'core2'
mtune = 'skylake'
macos_min = '10.15'
cflags = ['-mmacosx-version-min='+macos_min, '-march='+march, '-mtune='+mtune]
ldflags = ['-mmacosx-version-min='+macos_min]
cflags = ['-mmacosx-version-min='+macos_min, '-arch', 'x86_64']
ldflags = cflags

[host_machine]
cpu_family = 'x86_64'
system = 'darwin'

[binaries]
c = 'clang'
cpp = 'clang++'
objc = 'clang'
strip = 'strip'
pkgconfig = 'pkg-config'

[project options]
install_angle = true
r_gles30 = 'enabled'
shader_transpiler = 'enabled'
install_macos_bundle = 'enabled'

[built-in options]
c_args = cflags
Expand Down
18 changes: 13 additions & 5 deletions misc/ci/macos-x86_64-build-test-ci.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
[constants]
march = 'core2'
mtune = 'skylake'
macos_min = '10.15'

cflags = ['-mmacosx-version-min='+macos_min, '-march='+march, '-mtune='+mtune]
cflags = ['-mmacosx-version-min='+macos_min, '-arch', 'x86_64']
# NOTE: might need to pass -sdk_version to the linker as well, not sure how that works...
ldflags = ['-mmacosx-version-min='+macos_min]
ldflags = cflags

[host_machine]
cpu_family = 'x86_64'
system = 'darwin'

[binaries]
c = 'clang'
cpp = 'clang++'
objc = 'clang'
strip = 'strip'
pkgconfig = 'pkg-config'

[built-in options]
c_args = cflags
Expand Down
12 changes: 11 additions & 1 deletion scripts/macos_setup_universal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ set -e

source "$(pwd)/.mac_env"

mkdir -p "$MAC_BUILD_DIR/compiled" "$MESON_BUILD_ROOT_MACOS_COMBINED"
mkdir -p "$MAC_BUILD_DIR/compiled" "$TAISEI_ROOT/angle-compiled/lib/macOS-universal-dylib" "$MESON_BUILD_ROOT_MACOS_COMBINED"

# combine dylibs
lipo "$TAISEI_ROOT/angle-compiled/lib/macOS-arm64-dylib/libEGL.dylib" "$TAISEI_ROOT/angle-compiled/lib/macOS-x64-dylib/libEGL.dylib" -output "$TAISEI_ROOT/angle-compiled/lib/macOS-universal-dylib/libEGL.dylib" -create
lipo "$TAISEI_ROOT/angle-compiled/lib/macOS-arm64-dylib/libGLESv2.dylib" "$TAISEI_ROOT/angle-compiled/lib/macOS-x64-dylib/libGLESv2.dylib" -output "$TAISEI_ROOT/angle-compiled/lib/macOS-universal-dylib/libGLESv2.dylib" -create

meson setup \
-Dangle_libegl=$TAISEI_ROOT/angle-compiled/lib/macOS-universal-dylib/libEGL.dylib \
-Dangle_libgles=$TAISEI_ROOT/angle-compiled/lib/macOS-universal-dylib/libGLESv2.dylib \
--native-file "$TAISEI_ROOT/misc/ci/common-options.ini" \
--native-file "$TAISEI_ROOT/misc/ci/forcefallback.ini" \
--native-file "$TAISEI_ROOT/misc/ci/macos-x86_64-build-release.ini" \
--prefix "$MESON_BUILD_ROOT_MACOS_X64_COMPILED" \
"$MESON_BUILD_ROOT_MACOS_X64" \
"$TAISEI_ROOT" "$@"

meson setup \
-Dangle_libegl=$TAISEI_ROOT/angle-compiled/lib/macOS-universal-dylib/libEGL.dylib \
-Dangle_libgles=$TAISEI_ROOT/angle-compiled/lib/macOS-universal-dylib/libGLESv2.dylib \
--cross-file "$TAISEI_ROOT/misc/ci/common-options.ini" \
--cross-file "$TAISEI_ROOT/misc/ci/forcefallback.ini" \
--cross-file "$TAISEI_ROOT/misc/ci/macos-aarch64-build-release.ini" \
Expand Down

0 comments on commit 2878e73

Please sign in to comment.