Skip to content

Commit

Permalink
build: disable example for now
Browse files Browse the repository at this point in the history
  • Loading branch information
alichraghi authored and slimsag committed Aug 13, 2023
1 parent 0f04169 commit 6b49322
Show file tree
Hide file tree
Showing 4 changed files with 1,667 additions and 22 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (debug)
run: zig build install -Dcpu=x86_64_v3 -Dtarget=x86_64-linux-gnu
- name: upload (debug)
Expand All @@ -36,6 +38,8 @@ jobs:
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (release-fast)
run: zig build install -Dcpu=x86_64_v3 -Doptimize=ReleaseFast -Dtarget=x86_64-linux-gnu
- name: upload (release-fast)
Expand All @@ -55,6 +59,8 @@ jobs:
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (debug)
run: zig build install -Dtarget=x86_64-linux-musl -Dcpu=x86_64_v3
- name: upload (debug)
Expand All @@ -74,6 +80,8 @@ jobs:
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (release-fast)
run: zig build install -Doptimize=ReleaseFast -Dtarget=x86_64-linux-musl -Dcpu=x86_64_v3
- name: upload (release-fast)
Expand All @@ -93,6 +101,8 @@ jobs:
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (debug)
run: zig build install -Dtarget=aarch64-linux-gnu
- name: upload (debug)
Expand All @@ -112,6 +122,8 @@ jobs:
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (release-fast)
run: zig build install -Doptimize=ReleaseFast -Dtarget=aarch64-linux-gnu
- name: upload (release-fast)
Expand All @@ -131,6 +143,8 @@ jobs:
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (debug)
run: zig build install -Dtarget=aarch64-linux-musl
- name: upload (debug)
Expand All @@ -150,6 +164,8 @@ jobs:
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (release-fast)
run: zig build install -Doptimize=ReleaseFast -Dtarget=aarch64-linux-musl
- name: upload (release-fast)
Expand All @@ -172,6 +188,8 @@ jobs:
cd C:\
7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.12.0-dev.21+ac95cfe44\"
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (debug)
run: zig build install -Dtarget=x86_64-windows-gnu -Dcpu=x86_64_v3
- name: upload (debug)
Expand All @@ -196,6 +214,8 @@ jobs:
cd C:\
7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.12.0-dev.21+ac95cfe44\"
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (release-fast)
run: zig build install -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast -Dcpu=x86_64_v3
- name: upload (release-fast)
Expand All @@ -218,6 +238,8 @@ jobs:
brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066
brew install xz
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-macos-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (debug)
run: zig build install -Dtarget=x86_64-macos
- name: upload (debug)
Expand All @@ -238,6 +260,8 @@ jobs:
brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066
brew install xz
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-macos-x86_64-0.12.0-dev.21+ac95cfe44.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (release-fast)
run: zig build install -Doptimize=ReleaseFast -Dtarget=x86_64-macos
- name: upload (release-fast)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/m1_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: update build.zig
run: mv build.zig.local build.zig
- name: install (debug)
run: zig build install -Dtarget=aarch64-macos
- name: upload (debug)
Expand Down
49 changes: 27 additions & 22 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@ const Build = std.Build;
pub fn build(b: *Build) !void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});

const options = Options{
.install_libs = true,
.from_source = true,
};
// Just to demonstrate/test linking. This is not a functional example, see the mach/gpu examples
// or Dawn C++ examples for functional example code.
const example = b.addExecutable(.{
.name = "dawn-example",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
try link(b, example, options);
const glfw_dep = b.dependency("mach_glfw", .{
.target = example.target,
.optimize = example.optimize,
});
example.linkLibrary(glfw_dep.artifact("mach-glfw"));
example.addModule("mach-glfw", glfw_dep.module("mach-glfw"));
b.installArtifact(example);
_ = optimize;
_ = target;

// TODO(build-system): Zig package manager currently can't handle transitive deps like this, so we need to use
// these explicitly here:
//
// const options = Options{
// .install_libs = true,
// .from_source = true,
// };
// // Just to demonstrate/test linking. This is not a functional example, see the mach/gpu examples
// // or Dawn C++ examples for functional example code.
// const example = b.addExecutable(.{
// .name = "dawn-example",
// .root_source_file = .{ .path = "src/main.zig" },
// .target = target,
// .optimize = optimize,
// });
// try link(b, example, options);
// const glfw_dep = b.dependency("mach_glfw", .{
// .target = example.target,
// .optimize = example.optimize,
// });
// example.linkLibrary(glfw_dep.artifact("mach-glfw"));
// example.addModule("mach-glfw", glfw_dep.module("mach-glfw"));
// b.installArtifact(example);
}

pub const Options = struct {
Expand Down Expand Up @@ -64,7 +69,7 @@ pub const Options = struct {
install_libs: bool = false,

/// The binary release version to use from https://github.com/hexops/mach-gpu-dawn/releases
binary_version: []const u8 = "release-704793b",
binary_version: []const u8 = "release-704793b",

/// Detects the default options to use for the given target.
pub fn detectDefaults(self: Options, target: std.Target) Options {
Expand Down
Loading

0 comments on commit 6b49322

Please sign in to comment.