-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
zig build system #204
Comments
Would it be possible to create a "tools" label. |
Done. |
What's your opinion on the rust way? My shopping list would go as follow:
I do not want that C/C++ build system limitations impede/leak on this tool. Finally, since this is zig lang, the build tool has to be named |
On board. Zig has no preprocessor, no macros, instead has a declarative approach to solving these problems.
Same except no central repository. Instead there will be a variety of ways to obtain source as well as specifying a hash to ensure that correct dependencies were obtained. At any point you can update a dependency or all dependencies which will update the hashes.
Zig compiler will have an error for mis-indented code (see #35). Hard tabs are already a syntax error. Beyond that, I think we will have
We do have a way to specify documentation comments in the source code, but no docs are automatically generated yet (see #21). I doubt that we will make it mandatory as this leads to pointless documentation (
At the very least I think that Zig will recommend a directory structure. I haven't thought about how, if at all, this would be enforced. I'm starting to think that maybe we could have a
Do you have any specific limitations in mind? The way that I see it happening is that we have a declarative way to specify C/C++ targets. Not a DSL; just zig library code that integrates into the build system. We could also add to this library knowledge of how to build other language targets. And then finally a custom target interface. Ideally this build system would be useful no matter what language or platform you were building on.
Cute. But it will probably just be a subcommand of zig: |
* `zig build --export [obj|lib|exe]` changed to `zig build_obj`, `zig build_lib` and `zig build_exe` respectively. * `--name` parameter is optional when it can be inferred from the root source filename. closes #207 * `zig build` now looks for `build.zig` which interacts with `std.build.Builder` to describe the targets, and then the zig build system prints TODO: build these targets. See #204 * add `@bitcast` which is mainly used for pointer reinterpret casting and make explicit casting not do pointer reinterpretation. Closes #290 * fix debug info for byval parameters * sort command line help options * `std.debug.panic` supports format string printing * add `std.mem.IncrementingAllocator` * fix const ptr to a variable with data changing at runtime. closes #289
* add std.buf_map.BufMap * add std.buf_set.BufSet * add std.mem.split * zig build system improvements (See #204) - automatically parses NIX_CFLAGS_COMPILE and NIX_LDFLAGS - add builder.addCIncludePath - add builder.addRPath - add builder.addLibPath - add exe.linkLibrary
The outlined ideas sound good and I can actually see three directions of development:
My strongest preference would be for the third option (Ekam) as the second option is shit loads of work and testing (will take years due to platform differences as it took daomake) without basically any benefits compared to the other two options. And the first option (Premake) is though a very good one, but still can't catch up with the modern view and simplicity of the third option. |
While I admire the bravado of this approach, it's pretty antithetical to Zig's principles, which is an explicit, straightforward, low complexity approach to solve problems. Most of what Ekam does is not necessary when compiling Zig software because in Zig there is a single entry point source file which imports explicitly all the other files it will use. However, Zig is intended to integrate into a legacy C/C++/native project, and as such it is possible that Zig will plug into the build process in the middle of it. Whether the Zig Build System gets to own the whole build process or not, this should work in a way that is well-understood and not up to heuristics. I'm actually going for something closer to (1) as outlined above. I see it as a bargaining chip to break into legacy projects. "You're not adding a dependency on Zig, you're trading your cmake dependency for it." Then once people have Zig as a dependency, it becomes easier to want to use it more - at first as a package manager, then maybe to write a simple dev tool, and then possibly implementing some of the project in it. |
If you read further (and the source code), this is just an icing on the cake. The core is, that you can specify everything (including dependencies and any other stuff unrelated to building, but project management, automation, etc.) and do not need to rely on heuristics. Heuristics was though the initial idea and thus it's mentioned at the beginning. But yeah, Kenton is not a good marketing person, so his description might be misleading. Ekam shall play nicely with other build systems, but is not polished enough yet, so it might undergo pretty significant changes. I mentioned Ekam as it's a very modular and KISS approach offering both leisureness and rigidness if needed. Anyway, if you lean towards (1), I would advocate for Premake 😉. |
* Fix assertion failure when switching on type. Closes #310 * Update zig build system to support user defined options. See #204 * fmt.format supports {sNNN} to set padding for a buffer arg. * add std.fmt.bufPrint and std.fmt.allocPrint * std.hash_map.HashMap.put returns the previous value * add std.mem.startsWith
This feature now exists and is a big enough topic that it has its own set of multiple issues. |
This feature is not documented. Where should general discussion go? |
This competes with cmake, autotools, ninja, make, etc. The user creates
build.zig
, a script which imports a library and adds things to build. The idea is for this to actually be an even better way to build even C and C++ projects than cmake, autotools, or make itself. And of course it will support building zig projects.It should also do package management and resource file management which would provide C and C++ projects a way to have painless dependencies like other languages have.
build.zig can of course have arbitrary logic in it, but at the heart is a library that zig will provide such that targets can be defined in a declarative way, and repeated executions of the build script will do no more work than necessary.
--zig-verbose
do the firehose and--verbose
just print the commands before executing themThe text was updated successfully, but these errors were encountered: