#zig build introspection
1 messages · Page 1 of 1 (latest)
if you're running zig build you have control over the path, I think this may be helpful https://ziglang.org/learn/build-system/#installing-build-artifacts
getEmittedBin is probably what you're looking for? if you're working with a build.zig https://ziglang.org/documentation/master/std/#A;std:Build.Step.Compile.getEmittedBin
you'll have something like const exe = b.addExecutable(...) and then you can get the output path with exe.getEmittedBin()
in general executables are emitted by default into the zig-out/bin directory
It's not super clear what you're asking about.
A well-behaved build.zig script will always install files in the path specified by the --prefix option (defaults to zig-out/), never outside of this directory. Different kinds of artifacts have different default subdirectories of the install prefix they will be placed in (bin/, lib/, include/, etc.) but the build script is free to override them.
There's currently no way to dry run a build script or inspect where it will place stuff, but there is a recent proposal suggesting adding some kind of --inspect option
https://github.com/ziglang/zig/issues/18688
Yeah and I have a POC implementation. https://github.com/ExpidusOS/zig/tree/poc/build-inspector
Assume I don't have access to build.zig. I'm configuring a generic dap configuration in neovim that should work for any (typical) project
But I think I have an idea of how to do that
I'm just going to scan the output directory and make the user select an executable
since build.zig allows you to change the emitted location, and you can only find the executable name from the build.zig this is the only exact way. for like 99% of zig projects just looking in zig-out should work, though!