-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[build] Support config header in build.zig
#3516
Comments
@BeauSLM I'm afraid I don't maintain the Zig build system, feel free to send a PR with the required improvements or maybe point to some Zig developer that could work on this. |
build.zig
@BeauSLM is this to replace config.h and allow those variables to be set from zig? |
My idea is to be able to set the variables from zig if building with zig, or using zig bindings. |
@BeauSLM okay, exactly what I was thinking then |
I'm afraid I'm not maintaining the Zig build system, if anyone needs this feature, feel free to send a PR. |
The new Options field "config" holds a string the user can set in the format "-Dflag_a=1 -Dflag_b=0 ..." to override the values set in `config.h`. The file is parsed and the default values are appended to the compilation flags, if the user doesn't override them. The user string is appended to the compilation flags. The "-DEXTERNAL_CONFIG_FLAGS" is added to prevent "config.h" inclusion. Note: a certain format is assumed for the formatting of config.h Note: this commit references the closed issue raysan5#3516
* [build.zig] Overridable definitions from config.h The new Options field "config" holds a string the user can set in the format "-Dflag_a=1 -Dflag_b=0 ..." to override the values set in `config.h`. The file is parsed and the default values are appended to the compilation flags, if the user doesn't override them. The user string is appended to the compilation flags. The "-DEXTERNAL_CONFIG_FLAGS" is added to prevent "config.h" inclusion. Note: a certain format is assumed for the formatting of config.h Note: this commit references the closed issue #3516 * [build.zig] Only SUPPORT_* definitions are overridable Lines from `config.h` which contains "SUPPORT" are added to compilation after being parsed: - remove whitespace - format to preprocessor option https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html The user supplied flags have priority over the ones read from the file. NOTE: extension to commit 4da7f82, the logic is simplified because the SUPPORT flags only have binary values, which makes them easier to parse.
Use
zig build
's support for config headers.https://github.com/ziglang/zig/blob/67709b638224ac03820226c6744d8b6ead59184c/lib/std/Build.zig#L738-L755
The text was updated successfully, but these errors were encountered: