@SonnyBonds@mastodon.gamedev.place
Post #600697
2026-03-07 09:17 UTC
Replies (4)
-
@SonnyBonds@mastodon.gamedev.place 2026-03-07 09:18
I've tried using lib.installHeader(...) which maybe works, but I can't figure out how to find/use it in the consuming project.
-
@absurdistcode@mastodon.gamedev.place 2026-03-07 10:19
@SonnyBonds the user can just do `b.dependency("whatever").path("include/webgpu/wgpu.h")` where whatever is the name then imported your package as in build.zig.zon.
-
@kristoff@hachyderm.io 2026-03-07 11:18
@SonnyBonds You have two main kinds of consumers: Zig and C (either directly or FFI). For the former you want to create zig modules, like you are doing in the screenshot, while for the latter you want to create libraries (b.addLibrary), which will also install headers that you specify via installHeader. Zig users don't need header files if you give them a translate-c module. I've recently made this package that you can use as a reference https://github.com/allyourcodebase/rnnoise notice how I'm creating: - a module that contains the full implementation (+ the translate-c output as the root file) - a module that only contains translate-c definitions in case that the user just wants those and plans to use a system-provided dynamic library - static and dynamic library artifacts for non-Zig consumers, which also install public header files. The only thing that I'm missing in that package is system integration options, which I have yet to really learn how to use.
-
@liujiacai@mastodon.social 2026-03-07 11:22
@SonnyBonds See https://github.com/jiacai2050/zig-curl/blob/b22007729c714936a2f85106a2fd27e0851ad567/libs/curl.zig#L26 The pattern is `deps.path('include')`.