From 2878e73474b27c081556681163cffb1dbf98847f Mon Sep 17 00:00:00 2001 From: "Alice D." Date: Mon, 7 Oct 2024 02:59:54 -0400 Subject: [PATCH] ci: macOS: Update testing/release pipeline, enable ANGLE support (#387) 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 --- .github/workflows/main.yml | 11 +++++------ .github/workflows/release.yml | 12 ++++++++++-- misc/ci/macos-aarch64-build-release.ini | 7 +++++-- misc/ci/macos-x86_64-build-release.ini | 23 +++++++++++++++++++---- misc/ci/macos-x86_64-build-test-ci.ini | 18 +++++++++++++----- scripts/macos_setup_universal.sh | 12 +++++++++++- 6 files changed, 63 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 416b64e4cd..f7833e1351 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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: > @@ -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 @@ -135,6 +133,7 @@ jobs: ninja setuptools zstandard + --break-system-packages - name: Configure run: > @@ -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: > diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c755e231fa..7da8d5b502 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -214,6 +214,8 @@ jobs: python-gnupg setuptools zstandard + --break-system-packages + shell: bash - name: Import GPG Key @@ -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) @@ -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 @@ -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 diff --git a/misc/ci/macos-aarch64-build-release.ini b/misc/ci/macos-aarch64-build-release.ini index f461fc2660..2f89cede8c 100644 --- a/misc/ci/macos-aarch64-build-release.ini +++ b/misc/ci/macos-aarch64-build-release.ini @@ -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' @@ -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] diff --git a/misc/ci/macos-x86_64-build-release.ini b/misc/ci/macos-x86_64-build-release.ini index a44dc0e563..f76860d2b9 100644 --- a/misc/ci/macos-x86_64-build-release.ini +++ b/misc/ci/macos-x86_64-build-release.ini @@ -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 diff --git a/misc/ci/macos-x86_64-build-test-ci.ini b/misc/ci/macos-x86_64-build-test-ci.ini index 3a7206bc6e..55c116e5ad 100644 --- a/misc/ci/macos-x86_64-build-test-ci.ini +++ b/misc/ci/macos-x86_64-build-test-ci.ini @@ -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 diff --git a/scripts/macos_setup_universal.sh b/scripts/macos_setup_universal.sh index 2db8f06d74..46c856f8dc 100755 --- a/scripts/macos_setup_universal.sh +++ b/scripts/macos_setup_universal.sh @@ -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" \