Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: update to latest Zig version #15

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup Zig
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.12.0-dev.3180+83e578a18.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.13.0-dev.351+64ef45eb0.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: build
run: zig build
x86_64-windows:
Expand All @@ -26,10 +26,10 @@ jobs:
- name: Setup Zig
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://pkg.machengine.org/zig/zig-windows-x86_64-0.12.0-dev.3180+83e578a18.zip" -OutFile "C:\zig.zip"
Invoke-WebRequest -Uri "https://pkg.machengine.org/zig/zig-windows-x86_64-0.13.0-dev.351+64ef45eb0.zip" -OutFile "C:\zig.zip"
cd C:\
7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.12.0-dev.3180+83e578a18\"
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.13.0-dev.351+64ef45eb0\"
- name: build
run: zig build
x86_64-macos:
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Setup Zig
run: |
brew install xz
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-macos-x86_64-0.12.0-dev.3180+83e578a18.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-macos-x86_64-0.13.0-dev.351+64ef45eb0.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: build
run: zig build
env:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Cheers!
# -andrewrk

zig-cache/
.zig-cache/
zig-out/
/release/
/debug/
Expand All @@ -20,3 +20,4 @@ zig-out/
**/*.png
!assets/*.png
vulkan-zig/
Vulkan-Docs/
4 changes: 3 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
_ = b.addModule("vulkan-zig-generated", .{ .root_source_file = .{ .path = "vk.zig" } });
_ = b.addModule("vulkan-zig-generated", .{
.root_source_file = b.path("vk.zig"),
});
}
34 changes: 22 additions & 12 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,35 @@
set -euo pipefail

rm -rf vulkan-zig/
rm -rf Vulkan-Docs/

# `git clone --depth 1` but at a specific revision
mkdir Vulkan-Docs/
pushd Vulkan-Docs
git init
git remote add origin https://github.com/KhronosGroup/Vulkan-Docs
git fetch --depth 1 origin ed4ba0242beb89a1795d6084709fa9e713559c94
git checkout FETCH_HEAD
popd

# Update vk.xml
mv Vulkan-Docs/xml/vk.xml .

# `git clone --depth 1` but at a specific revision
mkdir vulkan-zig/
pushd vulkan-zig
git init
git remote add origin https://github.com/Snektron/vulkan-zig
git fetch --depth 1 origin ac4103a733c479b599aae8d42c08cabd7d5cf48a
git remote add origin https://github.com/slimsag/vulkan-zig
git fetch --depth 1 origin cfaf58a4de0d876d37d6dd9a05a5060e4f9b7cd9
git checkout FETCH_HEAD
popd

# Generate vulkan bindings
zig run vulkan-zig/generator/main.zig -- vk.xml vk.zig

echo "
// -------------------------------------------
# Generate Vulkan Zig bindings
pushd vulkan-zig/
zig build
popd

pub const ANativeWindow = opaque{};
pub const CAMetalLayer = opaque{};
pub const AHardwareBuffer = opaque{};
" >> vk.zig
./vulkan-zig/zig-out/bin/vulkan-zig-generator vk.xml vk.zig

zig fmt vk.zig
rm -rf vulkan-zig/
rm -rf Vulkan-Docs/
Loading
Loading