As a newbie to programming, I made a toy project with this guide: Build system tricks
It’s going well, but still can’t find a solution so that when importing, errors don’t appear regarding the missing examples.
All the code is here: ztester
- ztester - is the library with examples (minus zimport)
- zimport - is the project which import ztester
Tested only with zig version 0.12.0 on Linux Fedora 39.
Build and run the project result in:
zig build run
ztester: error.FileNotFound
Hello zimport
The error ztester: error.FileNotFound
means that the examples
directory from ztester
library is missing in zimport
.
This fact seems somewhat strange to me because no step from the build library is propagated to the top-level install step. From documentation, addInstallArtifact
merely creates the step; it does not add it to the dependencies of the top-level install step.
The only solution have found so far is to make a separate build, without examples, for the ztester.tar.gz
package.
Is there a better solution?
And one last question, creating a module only makes sense from the perspective of an already compiled library that is linked by user, such as a shared or static library, correct?
If the library is a dependency, @import(“ztester”) works as expected. No need for a module (or a build.zig), at least that’s what I noticed.
Sorry for my childish problems, but couldn’t find a solution on my own. Like I said, I have no programming experience.
Thanks in advance for your help.
All the best!!!