trilinos / ForTrilinos

ForTrilinos provides portable object-oriented Fortran interfaces to Trilinos C++ packages.
https://trilinos.github.io/ForTrilinos
BSD 3-Clause "New" or "Revised" License
24 stars 12 forks source link

Add git-derived versioning and runtime-accessible version #279

Closed sethrj closed 4 years ago

sethrj commented 4 years ago
aprokop commented 4 years ago

I feel like you chose a complicated approach. Why not do something like this?

Also, I don't think it catches the issue where you configured, but then switched branches. The code I linked does that. We were burned by that a lot.

sethrj commented 4 years ago

I'm using the same approach that I used in flibcpp; I didn't know about the ArborX one. The one I'm using is loosely derived from the python "versioneer" module, which has a few important features that ArborX lacks:

ArborX's version detection is designed to update the version header at every compile, which (for larger projects) I've found to be more of a headache than a feature, because everything has to be recompiled or relinked. (In contrast, the cmake code I'm using caches the git-derived information to reduce reconfigure time.) I based the design of this cmake code on the idea that version numbering is more important for distribution than develop/build/test.

aprokop commented 4 years ago

ArborX's version detection is designed to update the version header at every compile, which (for larger projects) I've found to be more of a headache than a feature, because everything has to be recompiled or relinked. (In contrast, the cmake code I'm using caches the git-derived information to reduce reconfigure time.) I based the design of this cmake code on the idea that version numbering is more important for distribution than develop/build/test.

I agree with most of your point, and think it is a find approach. It depends on what you plan to do with a git version/hash, though. In ArborX, we run performance studies spitting out a log file with the hash. It is crucial that it is actually correct, especially when switching branches and comparing. In ForTrilinos context, it should be OK to do a configure only check. In short, you are right here, and I withdraw my comment.

sethrj commented 4 years ago

Excellent. There are definitely times where you do indeed want to be more aggressive about keeping the embedded git hash up to date -- if you're trying to do a git bisect to find a performance regression then the arborx way is definitely a good approach.