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

Sirf version to be available at C++ level #874

Closed
paskino opened this issue Feb 14, 2021 · 4 comments · Fixed by #1029
Closed

Sirf version to be available at C++ level #874

paskino opened this issue Feb 14, 2021 · 4 comments · Fixed by #1029

Comments

@paskino
Copy link
Contributor

paskino commented Feb 14, 2021

With #872 version strings have been added at Python and MATLAB level, however this should be available in C++.

@paskino
Copy link
Contributor Author

paskino commented Jun 23, 2021

I suggest this to be made available from the output of git describe as we do in CIL.

@KrisThielemans
Copy link
Member

I'm not a fan of git describe. For instance, on STIR master this gives me

$ git describe
rel_4.1.0-705-g256e56bdc

That implies we are at version 4.1, but actually STIR master is well on the way for 5.0. In particular, it is no longer backwards compatible with 4.1. Hence our CMakeLists.txt sets the version to 5.0.0-prealpha. While git describe allows nice not to have to update versions in CMake files, I think it is impossible to do this automatically such that the logic is preserved.

PS: CIL really shouldn't use git but find_package(git), and use GIT_EXECUTABLE.

@paskino
Copy link
Contributor Author

paskino commented Jan 12, 2022

git describe finds the most recent tag that is reachable from a commit. If the tag points to the commit, then only the tag is shown. Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object and the abbreviated object name of the most recent commit.

rel_4.1.0-705-g256e56bdc means you are 705 commits from rel_4.1.0 which IMHO means a lot has changed.

I find it rather clean, nice, and mainly it gives a single origin to the version, i.e. the tag in the repository.

@KrisThielemans
Copy link
Member

it is informative, but it doesn't allow us to do

#if STIR_VERSION  500000
  bla
#else
  bloe
#endif

Having the complete git info as well could be useful of course. What I would then certainly want to avoid is whenever a commit happens, everything gets rebuilt because version.h changes. I'd recommend doing that via a git_version.h, which is only included in git_version.cxx, which would then be rebuilt, but that's presumably quick enough (if it doesn't depend on anything else).

paskino added a commit to paskino/SIRF that referenced this issue Jan 12, 2022
paskino added a commit that referenced this issue Jan 18, 2022
* add version.h generated from the numbers in CMakeLists.txt
closes #874
Co-authored-by: Kris Thielemans <KrisThielemans@users.noreply.github.com>
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 a pull request may close this issue.

2 participants