Comments (13)
Sent a PR to fix the Obj-C++ compilation issue in Zig, so we can compile Dawn using a build.zig
file: ziglang/zig#10096
from mach.
For what its worth, I've brought up an easily reproducible dawn build here: https://github.com/meshula/LabSlang (it assumes you have jinja2 installed). I've been looking for a way to zigify the sample program: https://github.com/meshula/LabSlang/blob/main/example/ManualSwapChainTest.cpp and stumbled across your glfw binding which could be a nice first step, from my perspective.
from mach.
@meshula Oh, a few thoughts:
- I don't want to rely on CMake, jinja2, or any other build tools. Just
zig build
. I actually already have this working on MacOS, and other platforms should be pretty trivial/straightforward from here. I haven't published any of this yet on GitHub, though, sorry. I need to do some more work to finalize things but I'll see if I can push a branch up soon. - I have ported the Dawn triangle example to Zig, which includes writing C shims for most of the Dawn C++ utilities, swap chain logic, etc.
You can read a bit about it here: https://devlog.hexops.com/2021/mach-engine-the-future-of-graphics-with-zig#whats-next-webgpu
I'll try to get a branch up that you can look at / play with / help out with, if you're interested, sometime this week
from mach.
Sorry I missed your reply, if you post a branch, I'm definitely interested.
... which I see is here https://github.com/hexops/mach/tree/dawn
from mach.
@meshula Cool! You indeed found the branch I'm working from, #62 is the pull request which has more details on how to use it, issues, etc. I probably need about a day more before it'll be relatively easy for you to try running it
from mach.
I got all the way to the compiling .mm issue, as you might expect. I haven't been building zig myself, so does it make sense to wait for that to land? or is there an artifact I can download from CI somewhere?
I have a fairly large contraption right now where I am writing zig bindings over my LabSlang project, which I need for a current zig project that currently is CLI only. I'd be happy to shift my attention to mach in the short term to see if we are both pushing in the same direction. Due to the mm compilation issue, I can do other things in the meanwhile and wait a little for "relatively easy", and therefore put off learning to build zig :)
As you probably already know:
❯ zig build
error: unrecognized file extension of parameter '/Users/dp/Projects/mach/webgpu/libs/dawn/src/common/SystemUtils_mac.mm'
dawn...The following command exited with error code 1:
/Users/dp/bin/zig-macos-x86_64-0.9.0-dev.1561+5ebdc8c46/zig build-lib /Users/dp/Projects/mach/webgpu/src/dawn/dummy.zig -cflags -I/Users/dp/Projects/mach/webgpu/libs/dawn/out/Debug/gen.... etc
from mach.
The only part of the build that required a bit of research was the installation of git-subtree. I downloaded the git sources, and did an install from the contrib/subtree folder, with make;sudo make -prefix=/XXX install
where XXX is the path containing bin/git
. Might be worth noting that twist for others who attempt it.
from mach.
@meshula can you clarify why you needed to install Git from source? AFAIK, only I myself should ever need to use git subtree
, nobody else should ever need to.
I'd wait until I can get the .mm
change landed, then Zig's CI will build artifacts for you.
from mach.
Here's what I did.
git clone mach
zig build
(didn't work, glfw not found,grep
build system discover pull-subrepos.sh)cd dev;./pull-subrepos.sh
(complains about subtree because ofLine 6 in 9f906cf
- install git subtree as above, try
pull-suprepos
again (git loses it's mind, zomg) - delete mach; reclone
cd dev;./pull-subrepos.sh
(succeeds)cd ..;zig build
succeeds in building engine and glfwcd webgpu; zig build
gets as far as noted above.
I was making it up as I went along since I wasn't sure what the intended build process actually is, and I haven't used git in a monorepo context in this way before. Maybe I missed an obvious (to one practiced in the monorepo arts ;) ) workflow step.
from mach.
zig build (didn't work, glfw not found,
I'd love more details on this part, what error did you get? GLFW is committed to the repository the same as any other file, so you really shouldn't have ever needed to touch git subtree
at all. There isn't any magic here, git subtree
just helps us with copying files back and forth between two repositories.
from mach.
hmm, I think i have another mac without git subtree installed. standby.
from mach.
ok, all of my macs except that one have subtree installed, so (1) there is likely something wrong with git on that machine, probably I've hacked it too much with aliases and helper things. (2) all my other machines function as you describe; I can clone and zig build in the root directory, and in the dawn branch, in the webgpu directory, with the same .mm issue.
All right, sorry for the noise, but glad to have worked through this.
from mach.
Perfect! Glad to hear it.
from mach.
Related Issues (20)
- {core,engine}: sysgpu disabled in v0.3 due to lack of optional Zig dependencies; spirv-cross/spirv-tools are indirect and take a while to build
- core: autodoc segfaults the build if enabled, after Zig 2024.1.0-mach update HOT 2
- core: custom entrypoint build API design broken after Zig 2024.1.0-mach update
- all: nominate Zig 2024.03 HOT 4
- sysgpu: SPIR-V code gen fails on else ifs
- 100% banish usingnamespace from all of our codebases
- all: Mach 0.3 release checklist
- all: eliminate `sdkPath` HOT 3
- sysaudio: runtime alignment error when converting samples on Windows HOT 4
- core: window size not restored on leaving .fullscreen to .windowed.
- all: change addPaths(step) -> addPaths(mod); fix linux -> macOS cross-compilation
- docs: should be more clear about required Zig version in getting-started guides
- docs: suggest using zig fetch --save
- all: use snake_case for package names and build CLI flags
- sysgpu: provide clear default values instead of WebGPU 'undefined' default values HOT 3
- sysaudio: opus play.zig example crashes after a few seconds of playing HOT 1
- docs: provide guidance/tooling for app distribution (packaging, code signing, notarization, installers, etc.)
- glfw may not build on Arch Linux, why? HOT 1
- all: use Wayland by default once it is stable/reliable/good enough consistently HOT 5
- sysgpu: metal: pbr-basic codegen failure HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mach.