From 4ba71726264f5415d79d1871ab1339a95035c05a Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 27 Feb 2022 14:43:38 -0700 Subject: [PATCH] gpu-dawn: explicitly target -macos.12 Signed-off-by: Stephen Gutekanst --- gpu-dawn/.github/workflows/ci.yml | 16 ++++++++-------- gpu-dawn/.github/workflows/m1_ci.yml | 16 ++++++++-------- gpu-dawn/build.zig | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/gpu-dawn/.github/workflows/ci.yml b/gpu-dawn/.github/workflows/ci.yml index 2a79ccb6..26ffb771 100644 --- a/gpu-dawn/.github/workflows/ci.yml +++ b/gpu-dawn/.github/workflows/ci.yml @@ -86,14 +86,14 @@ jobs: - name: Clone mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw - name: install (debug) - run: zig build install -Dfrom-source=true -Dtarget=x86_64-macos + run: zig build install -Dfrom-source=true -Dtarget=x86_64-macos.12 env: AGREE: true - name: upload (debug) run: | - mv zig-out/lib/libdawn.a zig-out/lib/libdawn_x86_64-macos.12.1---12.1-gnu_debug.a - gzip -9 zig-out/lib/libdawn_x86_64-macos.12.1---12.1-gnu_debug.a - gh release upload "release-$(git rev-parse --short HEAD)" zig-out/lib/libdawn_x86_64-macos.12.1---12.1-gnu_debug.a.gz + mv zig-out/lib/libdawn.a zig-out/lib/libdawn_x86_64-macos.12---12-gnu_debug.a + gzip -9 zig-out/lib/libdawn_x86_64-macos.12---12-gnu_debug.a + gh release upload "release-$(git rev-parse --short HEAD)" zig-out/lib/libdawn_x86_64-macos.12---12-gnu_debug.a.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} x86_64-macos_release-fast: @@ -111,13 +111,13 @@ jobs: - name: Clone mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw - name: install (release-fast) - run: zig build install -Dfrom-source=true -Drelease-fast=true -Dtarget=x86_64-macos + run: zig build install -Dfrom-source=true -Drelease-fast=true -Dtarget=x86_64-macos.12 env: AGREE: true - name: upload (release-fast) run: | - mv zig-out/lib/libdawn.a zig-out/lib/libdawn_x86_64-macos.12.1---12.1-gnu_release-fast.a - gzip -9 zig-out/lib/libdawn_x86_64-macos.12.1---12.1-gnu_release-fast.a - gh release upload "release-$(git rev-parse --short HEAD)" zig-out/lib/libdawn_x86_64-macos.12.1---12.1-gnu_release-fast.a.gz + mv zig-out/lib/libdawn.a zig-out/lib/libdawn_x86_64-macos.12---12-gnu_release-fast.a + gzip -9 zig-out/lib/libdawn_x86_64-macos.12---12-gnu_release-fast.a + gh release upload "release-$(git rev-parse --short HEAD)" zig-out/lib/libdawn_x86_64-macos.12---12-gnu_release-fast.a.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/gpu-dawn/.github/workflows/m1_ci.yml b/gpu-dawn/.github/workflows/m1_ci.yml index b9f3dc49..9425add5 100644 --- a/gpu-dawn/.github/workflows/m1_ci.yml +++ b/gpu-dawn/.github/workflows/m1_ci.yml @@ -24,24 +24,24 @@ jobs: - name: Clone mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw - name: install (debug) - run: zig build install -Dfrom-source=true -Dtarget=aarch64-macos + run: zig build install -Dfrom-source=true -Dtarget=aarch64-macos.12 env: AGREE: true - name: upload (debug) run: | - mv zig-out/lib/libdawn.a zig-out/lib/libdawn_aarch64-macos.12.1---12.1-gnu_debug.a - gzip -9 zig-out/lib/libdawn_aarch64-macos.12.1---12.1-gnu_debug.a - gh release upload "release-$(git rev-parse --short HEAD)" zig-out/lib/libdawn_aarch64-macos.12.1---12.1-gnu_debug.a.gz + mv zig-out/lib/libdawn.a zig-out/lib/libdawn_aarch64-macos.12---12-gnu_debug.a + gzip -9 zig-out/lib/libdawn_aarch64-macos.12---12-gnu_debug.a + gh release upload "release-$(git rev-parse --short HEAD)" zig-out/lib/libdawn_aarch64-macos.12---12-gnu_debug.a.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: install (release-fast) - run: zig build install -Dfrom-source=true -Drelease-fast=true -Dtarget=aarch64-macos + run: zig build install -Dfrom-source=true -Drelease-fast=true -Dtarget=aarch64-macos.12 env: AGREE: true - name: upload (release-fast) run: | - mv zig-out/lib/libdawn.a zig-out/lib/libdawn_aarch64-macos.12.1---12.1-gnu_release-fast.a - gzip -9 zig-out/lib/libdawn_aarch64-macos.12.1---12.1-gnu_release-fast.a - gh release upload "release-$(git rev-parse --short HEAD)" zig-out/lib/libdawn_aarch64-macos.12.1---12.1-gnu_release-fast.a.gz + mv zig-out/lib/libdawn.a zig-out/lib/libdawn_aarch64-macos.12---12-gnu_release-fast.a + gzip -9 zig-out/lib/libdawn_aarch64-macos.12---12-gnu_release-fast.a + gh release upload "release-$(git rev-parse --short HEAD)" zig-out/lib/libdawn_aarch64-macos.12---12-gnu_release-fast.a.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/gpu-dawn/build.zig b/gpu-dawn/build.zig index 6d9b1b06..1febaecb 100644 --- a/gpu-dawn/build.zig +++ b/gpu-dawn/build.zig @@ -190,7 +190,7 @@ fn ensureSubmodules(allocator: std.mem.Allocator) !void { pub fn linkFromBinary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void { const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target; - const zig_triple = target.zigTriple(b.allocator) catch unreachable; + var zig_triple = target.zigTriple(b.allocator) catch unreachable; const binaries_available = switch (target.os.tag) { .windows => false, // TODO(build-system): add Windows binaries @@ -201,8 +201,18 @@ pub fn linkFromBinary(b: *Builder, step: *std.build.LibExeObjStep, options: Opti // If min. target macOS version is lesser than the min version we have available, then // our binary is incompatible with the target. - const min_available = std.builtin.Version{ .major = 12, .minor = 1 }; + const min_available = std.builtin.Version{ .major = 12, .minor = 0 }; if (target.os.version_range.semver.min.order(min_available) == .lt) break :blk false; + + // update zig_triple to reflect the Zig triple of the binary release we're downloading. + var binary_target = target; + binary_target.os.version_range = .{ + .semver = .{ + .min = min_available, + .max = min_available, + }, + }; + zig_triple = target.zigTriple(b.allocator) catch unreachable; break :blk true; }, else => false,