Update to latest Zig master (0.10.0-dev.2017+a0a2ce92c) (#261)

* use `@ceil` instead of `std.math.ceil`
* `ChildProcess.init` does not allocate anymore
* update CI zig version
* examples: temporarily switch to fork of zigimg compatible with zig-master

Commands executed:

```
git submodule set-url -- examples/libs/zigimg https://github.com/slimsag/zigimg
git submodule set-branch --branch zig-master -- examples/libs/zigimg
git submodule update --init --remote examples/libs/zigimg
```

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Lee Cannon 2022-05-01 19:44:27 +01:00 committed by GitHub
parent 0e64b9608c
commit 4570838304
Failed to generate hash of commit
9 changed files with 26 additions and 25 deletions

View file

@ -19,7 +19,7 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
sudo apt install xz-utils sudo apt install xz-utils
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: x86_64-linux -> x86_64-macos - name: x86_64-linux -> x86_64-macos
run: cd ${{ matrix.project }} && zig build test -Dtarget=x86_64-macos.12...12-gnu run: cd ${{ matrix.project }} && zig build test -Dtarget=x86_64-macos.12...12-gnu
env: env:
@ -54,10 +54,10 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.10.0-dev.1600+af844931b.zip" -OutFile "C:\zig.zip" Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.10.0-dev.2017+a0a2ce92c.zip" -OutFile "C:\zig.zip"
cd C:\ cd C:\
7z x zig.zip 7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.10.0-dev.1600+af844931b\" Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.10.0-dev.2017+a0a2ce92c\"
- name: x86_64-windows -> x86_64-macos - name: x86_64-windows -> x86_64-macos
run: cd ${{ matrix.project }} && zig build test -Dtarget='x86_64-macos.12...12-gnu' run: cd ${{ matrix.project }} && zig build test -Dtarget='x86_64-macos.12...12-gnu'
env: env:
@ -85,7 +85,7 @@ jobs:
run: | run: |
brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066 brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066
brew install xz brew install xz
sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
# TODO: re-enable once we can use macos-12 reliably on GitHub actions (currently works, but # TODO: re-enable once we can use macos-12 reliably on GitHub actions (currently works, but
# takes a very long time to acquire macos-12 runners.) # takes a very long time to acquire macos-12 runners.)
# - name: test # - name: test

3
.gitmodules vendored
View file

@ -14,7 +14,8 @@
url = https://github.com/PiergiorgioZagaria/zmath url = https://github.com/PiergiorgioZagaria/zmath
[submodule "examples/libs/zigimg"] [submodule "examples/libs/zigimg"]
path = examples/libs/zigimg path = examples/libs/zigimg
url = https://github.com/zigimg/zigimg url = https://github.com/slimsag/zigimg
branch = zig-master
[submodule "examples/assets"] [submodule "examples/assets"]
path = examples/assets path = examples/assets
url = https://github.com/hexops/mach-example-assets url = https://github.com/hexops/mach-example-assets

View file

@ -153,7 +153,7 @@ fn ensureDependencySubmodule(allocator: std.mem.Allocator, path: []const u8) !vo
if (std.process.getEnvVarOwned(allocator, "NO_ENSURE_SUBMODULES")) |no_ensure_submodules| { if (std.process.getEnvVarOwned(allocator, "NO_ENSURE_SUBMODULES")) |no_ensure_submodules| {
if (std.mem.eql(u8, no_ensure_submodules, "true")) return; if (std.mem.eql(u8, no_ensure_submodules, "true")) return;
} else |_| {} } else |_| {}
const child = try std.ChildProcess.init(&.{ "git", "submodule", "update", "--init", path }, allocator); var child = std.ChildProcess.init(&.{ "git", "submodule", "update", "--init", path }, allocator);
child.cwd = thisDir(); child.cwd = thisDir();
child.stderr = std.io.getStdErr(); child.stderr = std.io.getStdErr();
child.stdout = std.io.getStdOut(); child.stdout = std.io.getStdOut();

View file

@ -179,7 +179,7 @@ pub fn update(app: *App, engine: *mach.Engine) !bool {
const pass_encoder = command_encoder.beginComputePass(null); const pass_encoder = command_encoder.beginComputePass(null);
pass_encoder.setPipeline(app.compute_pipeline); pass_encoder.setPipeline(app.compute_pipeline);
pass_encoder.setBindGroup(0, app.particle_bind_groups[app.frame_counter % 2], null); pass_encoder.setBindGroup(0, app.particle_bind_groups[app.frame_counter % 2], null);
pass_encoder.dispatch(@floatToInt(u32, std.math.ceil(@as(f32, num_particle) / 64)), 1, 1); pass_encoder.dispatch(@floatToInt(u32, @ceil(@as(f32, num_particle) / 64)), 1, 1);
pass_encoder.end(); pass_encoder.end();
pass_encoder.release(); pass_encoder.release();
} }

@ -1 +1 @@
Subproject commit d480d7685d89f75c105fab7fd43af109ab072b14 Subproject commit 1f4ff13c7425f085d44ae2130114ae9f0fc42f9e

View file

@ -16,7 +16,7 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
sudo apt install xz-utils sudo apt install xz-utils
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: x86_64-linux -> x86_64-macos - name: x86_64-linux -> x86_64-macos
run: zig build test -Dtarget=x86_64-macos run: zig build test -Dtarget=x86_64-macos
env: env:
@ -48,10 +48,10 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.10.0-dev.1600+af844931b.zip" -OutFile "C:\zig.zip" Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.10.0-dev.2017+a0a2ce92c.zip" -OutFile "C:\zig.zip"
cd C:\ cd C:\
7z x zig.zip 7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.10.0-dev.1600+af844931b\" Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.10.0-dev.2017+a0a2ce92c\"
- name: x86_64-windows -> x86_64-macos - name: x86_64-windows -> x86_64-macos
run: zig build test -Dtarget=x86_64-macos run: zig build test -Dtarget=x86_64-macos
env: env:
@ -76,7 +76,7 @@ jobs:
run: | run: |
brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066 brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066
brew install xz brew install xz
sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: test - name: test
run: zig build test run: zig build test
env: env:

View file

@ -234,7 +234,7 @@ fn determineSdkRoot(allocator: std.mem.Allocator, org: []const u8, name: []const
} }
fn exec(allocator: std.mem.Allocator, argv: []const []const u8, cwd: []const u8) !void { fn exec(allocator: std.mem.Allocator, argv: []const []const u8, cwd: []const u8) !void {
const child = try std.ChildProcess.init(argv, allocator); var child = std.ChildProcess.init(argv, allocator);
child.cwd = cwd; child.cwd = cwd;
_ = try child.spawnAndWait(); _ = try child.spawnAndWait();
} }

View file

@ -16,7 +16,7 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
sudo apt install xz-utils sudo apt install xz-utils
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: Clone mach-glfw - name: Clone mach-glfw
run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw
- name: install (debug) - name: install (debug)
@ -37,7 +37,7 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
sudo apt install xz-utils sudo apt install xz-utils
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: Clone mach-glfw - name: Clone mach-glfw
run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw
- name: install (release-fast) - name: install (release-fast)
@ -58,7 +58,7 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
sudo apt install xz-utils sudo apt install xz-utils
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: Clone mach-glfw - name: Clone mach-glfw
run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw
- name: install (debug) - name: install (debug)
@ -79,7 +79,7 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
sudo apt install xz-utils sudo apt install xz-utils
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: Clone mach-glfw - name: Clone mach-glfw
run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw
- name: install (release-fast) - name: install (release-fast)
@ -102,10 +102,10 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.10.0-dev.1600+af844931b.zip" -OutFile "C:\zig.zip" Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.10.0-dev.2017+a0a2ce92c.zip" -OutFile "C:\zig.zip"
cd C:\ cd C:\
7z x zig.zip 7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.10.0-dev.1600+af844931b\" Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.10.0-dev.2017+a0a2ce92c\"
- name: Clone mach-glfw - name: Clone mach-glfw
run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw
- name: install (debug) - name: install (debug)
@ -130,10 +130,10 @@ jobs:
- name: Setup Zig - name: Setup Zig
run: | run: |
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.10.0-dev.1600+af844931b.zip" -OutFile "C:\zig.zip" Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.10.0-dev.2017+a0a2ce92c.zip" -OutFile "C:\zig.zip"
cd C:\ cd C:\
7z x zig.zip 7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.10.0-dev.1600+af844931b\" Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.10.0-dev.2017+a0a2ce92c\"
- name: Clone mach-glfw - name: Clone mach-glfw
run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw
- name: install (release-fast) - name: install (release-fast)
@ -157,7 +157,7 @@ jobs:
run: | run: |
brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066 brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066
brew install xz brew install xz
sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: Clone mach-glfw - name: Clone mach-glfw
run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw
- name: install (debug) - name: install (debug)
@ -181,7 +181,7 @@ jobs:
run: | run: |
brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066 brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066
brew install xz brew install xz
sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.1600+af844931b.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.2017+a0a2ce92c.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: Clone mach-glfw - name: Clone mach-glfw
run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw run: rm libs/mach-glfw && git clone https://github.com/hexops/mach-glfw libs/mach-glfw
- name: install (release-fast) - name: install (release-fast)

View file

@ -180,7 +180,7 @@ fn ensureSubmodules(allocator: std.mem.Allocator) !void {
if (std.process.getEnvVarOwned(allocator, "NO_ENSURE_SUBMODULES")) |no_ensure_submodules| { if (std.process.getEnvVarOwned(allocator, "NO_ENSURE_SUBMODULES")) |no_ensure_submodules| {
if (std.mem.eql(u8, no_ensure_submodules, "true")) return; if (std.mem.eql(u8, no_ensure_submodules, "true")) return;
} else |_| {} } else |_| {}
const child = try std.ChildProcess.init(&.{ "git", "submodule", "update", "--init", "--recursive" }, allocator); var child = std.ChildProcess.init(&.{ "git", "submodule", "update", "--init", "--recursive" }, allocator);
child.cwd = thisDir(); child.cwd = thisDir();
child.stderr = std.io.getStdErr(); child.stderr = std.io.getStdErr();
child.stdout = std.io.getStdOut(); child.stdout = std.io.getStdOut();
@ -442,7 +442,7 @@ fn gitClone(allocator: std.mem.Allocator, repository: []const u8, dir: []const u
fn downloadFile(allocator: std.mem.Allocator, target_file: []const u8, url: []const u8) !void { fn downloadFile(allocator: std.mem.Allocator, target_file: []const u8, url: []const u8) !void {
std.debug.print("downloading {s}..\n", .{url}); std.debug.print("downloading {s}..\n", .{url});
const child = try std.ChildProcess.init(&.{ "curl", "-L", "-o", target_file, url }, allocator); var child = std.ChildProcess.init(&.{ "curl", "-L", "-o", target_file, url }, allocator);
child.cwd = thisDir(); child.cwd = thisDir();
child.stderr = std.io.getStdErr(); child.stderr = std.io.getStdErr();
child.stdout = std.io.getStdOut(); child.stdout = std.io.getStdOut();