-
Notifications
You must be signed in to change notification settings - Fork 578
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
Ninja: use header dependencies for better rebuild support #3769
Conversation
Opened as a draft as I'm not sure that adding the logic to |
07b8806
to
c0fdeb6
Compare
This works well for me and actually helps with one of the bigger pains I have with Botan's build system. 😍
I would indeed suggest to add the compiler flags to Edit: Could we create another "abstract" ninja rule, like:
that handles the depfile and deps and let |
Strong 👍 on this aspect - ideally we should not be anywhere asking "is this compiler MSVC" or "is this compiler GCC" but instead "does the compiler have the capability X, and if so how do I invoke it". Then later someone can update the compiler info for say Intel C++, and then everything Just Works without any additional changes. |
The problem I see here is that for gcc/clang the file argument
Don't know much about ninja, but from what I read in the specification I don't see any way for rules to kind of inherit properties from each other. We could try to use top level variables to get rid of some repetition.
But a few thinks are unclear:
|
55ee6bc
to
564edde
Compare
This concatenates the static value behind the colon with the value of the template variable. If this value is not set (aka ''), also the static concatenated value is omitted. Co-Authored-By: Philippe Lieser <[email protected]>
Co-Authored-By: Philippe Lieser <[email protected]>
Co-Authored-By: Philippe Lieser <[email protected]>
564edde
to
f29366a
Compare
@lieser and I did have another look at this and came up with a reasonable solution. To keep the templates readable, and not clutter them with The configuration for the various compilers is now steered fully from the |
When locally developing, currently the build system does not properly track changes to headers.
This can result in broken rebuilds, that are currently often workaround by re-invoking
./configure.py
before a rebuild.Ninja supports for gcc, clang and msvc to track the header dependencies (see https://ninja-build.org/manual.html#ref_headers for more details).
This PR enables usage of the header dependencies feature then using ninja.
When changing headers this can greatly improve the rebuild because only
ninja
needs to be invoked, and a new call to./configure.py
is not needed.A note about Windows:
This only works with hard links, as ninja will fail to detect a new modification time of the target file.
For hard links there seems to be also some caching involved, and when modifying the file under
src/
and notbuild/
, it sometimes can take a while for ninja to detect the change.