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: make GetGitRevisionDescription work #315

Merged

Conversation

EchterAgo
Copy link

The current build does only update zfs_gitrev.h on the first configuration run but then not change it when the commit changes.

To fix this we need to call get_git_head_revision.

This also updates GetGitRevisionDescription to the latest version from https://github.com/rpavlik/cmake-modules/tree/d66fc5dec3eaea3a4f9778ceeeb65cbec490b5b9

@EchterAgo
Copy link
Author

Note that we don't need to update GetGitRevisionDescription to the latest version, I just included it because I did it already.

@lundman
Copy link

lundman commented Nov 4, 2023

I'll try it first, I wouldn't want it to slow down my compiles, since I only need it to update when I want to (saving CMakelists) :)

@EchterAgo
Copy link
Author

Yea, I do think it slows down things because it recompiles a lot everytime the git revision changes. Also it does not update when the describe output changes, for example when going from dirty to not dirty.

Maybe I'm spoiled because it compiles really fast on my machine, but I do like having it, maybe we could make it optional?

@EchterAgo
Copy link
Author

It is unfortunate that ZFS_META_ALIAS is defined in zfs_config.h. Not many places use ZFS_META_ALIAS but zfs_config.h is included everywhere :\

@EchterAgo EchterAgo force-pushed the cmake_fix_gitrev branch 2 times, most recently from c697ced to 0f2826a Compare November 4, 2023 23:23
The current build does only update `zfs_gitrev.h` on the first
configuration run but then not change it when the commit changes.

To fix this we need to call `get_git_head_revision`.

This also updates `GetGitRevisionDescription` to the latest version from
https://github.com/rpavlik/cmake-modules/tree/d66fc5dec3eaea3a4f9778ceeeb65cbec490b5b9

Signed-off-by: Axel Gembe <[email protected]>
@lundman
Copy link

lundman commented Nov 16, 2023

OK this doesnt slow down my build at all.
zfs_config.h is "ours" (they generate theirs from autotools) so if you want to move the macro that is fine.

@lundman lundman merged commit 8dee582 into openzfsonwindows:zfs-Windows-2.2.0-release Nov 16, 2023
29 of 30 checks passed
@EchterAgo EchterAgo deleted the cmake_fix_gitrev branch November 16, 2023 06:45
lundman pushed a commit that referenced this pull request Dec 11, 2023
The current build does only update `zfs_gitrev.h` on the first
configuration run but then not change it when the commit changes.

To fix this we need to call `get_git_head_revision`.

This also updates `GetGitRevisionDescription` to the latest version from
https://github.com/rpavlik/cmake-modules/tree/d66fc5dec3eaea3a4f9778ceeeb65cbec490b5b9

Signed-off-by: Axel Gembe <[email protected]>
@lundman
Copy link

lundman commented Jan 11, 2024

I do have to comment this out now and then, whenever I do a git cherry-pick it will redo cmake and recompile everything - which is rather frustrating, when I have 100-200 commits to go through :)

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.

2 participants