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

CMake: Generate scmrev.h at build time instead of configure time. #12007

Merged

Conversation

AdmiralCurtiss
Copy link
Contributor

This avoids the reconfigure every time your git HEAD changes. It should also detect the -dirty suffix more reliably.

@TellowKrinkle
Copy link
Contributor

I feel like the proper way to do this would be with an add_custom_command(OUTPUT scmrev.h DEPENDS git files), which you then target_sources into common, so it would have proper dependency tracking and you wouldn't need the copy_if_different to avoid recompiling files for every build.

@AdmiralCurtiss
Copy link
Contributor Author

I understand what you mean conceptually but I have no idea how that would actually look in practice. You can't exactly put a dependency on the entire .git directory.

@AdmiralCurtiss
Copy link
Contributor Author

(Note that that wouldn't detect the -dirty flag correctly either even if you did somehow manage a dependency on everything in .git.)

@iwubcode
Copy link
Contributor

iwubcode commented Jun 28, 2023

I don't understand why this build would taint other PRs but my PR build fails with:

../Source/Core/Common/Version.cpp:8:10: fatal error: Common/scmrev.h: No such file or directory
8 | #include "Common/scmrev.h"

Just coincidence?

@TellowKrinkle
Copy link
Contributor

You can't exactly put a dependency on the entire .git directory.

Same two files the current script uses to decide whether to rerun cmake

(Note that that wouldn't detect the -dirty flag correctly either even if you did somehow manage a dependency on everything in .git.)

True, I guess this is fine then.

Could you find git with QUIET or pass it in as an argument to the script so it doesn't print this on every build?

-- Found Git: /usr/bin/git (found version "2.39.2 (Apple Git-143)") 

@AdmiralCurtiss
Copy link
Contributor Author

I don't understand why this build would taint other PRs but my PR build fails with:

I mean... I agree that this feels related, but I'm not really sure why this would cause this, either. Odd.

Could you find git with QUIET or pass it in as an argument to the script so it doesn't print this on every build?

Yup, I've added the git executable path to the passed parameters.

@AdmiralCurtiss AdmiralCurtiss merged commit e4d7ba5 into dolphin-emu:master Jun 30, 2023
14 checks passed
@AdmiralCurtiss AdmiralCurtiss deleted the cmake-scmrev-at-build-time branch June 30, 2023 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants