Skip to content
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

std.Build: Allow ConfigHeader values to be added outside of comptime #22795

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cbilz
Copy link
Contributor

@cbilz cbilz commented Feb 6, 2025

The current public interface of std.Build.Step.ConfigHeader only allows configuration values to be added at comptime using addValues(). This pull request adds a new public functon addValue that enables configuration values to be added during build graph construction, i.e. while the build() function runs.

This change allows values to be determined by checks that cannot be performed at comptime, such as inspection of system features or build dependencies.

cbilz added a commit to cbilz/gnu-m4-zig that referenced this pull request Feb 9, 2025
There were a few configuration value conflicts between `config.h` and
the Gnulib headers, so it made sense to draw their values from different
pools.

The Gnulib headers use `@FOO@`-style substitution hooks. So far, we used
`ConfigHeader.Style.cmake` to configure these, but this fails for
`unistd.h`, see ziglang/zig#22794.

Further, we add a function that allows build-time configuration of
`ConfigHeader` values, see ziglang/zig#22795.
This is more convenient and should improve overall build times as
comptime is still relatively slow.

We use a modified version of `ConfigHeader` until these pull requests
are merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant