NOAA-OWP / ngen

Next Generation Water Modeling Engine and Framework Prototype
Other
84 stars 63 forks source link

Include git commit ID in configuration summary #875

Closed program-- closed 2 months ago

program-- commented 2 months ago

This PR adds the repo's git commit ID to the CMake configuration summary output. This will also include it when calling ngen --info.

Example:

NGen version: 0.1.0
-- Build configuration summary:
--   Generator: Ninja
--   Build type: Debug
--   System: Linux
--   C Compiler: /usr/bin/clang
--   C Flags: -Wpessimizing-move
--   CXX Compiler: /usr/bin/clang++
--   CXX Flags: -Wpessimizing-move -pedantic-errors
--   Git Commit ID: 2ffedf8ecb3d6311be65d8c7c8f99c2fecf7ee07
--   Flags:
...

Additions

Checklist

PhilMiller commented 2 months ago

I see the print in configuration. How does it end up in ngen --info? Given that you show runtime output, with strings that don't exist in my repo, I'm guessing some code didn't get committed

program-- commented 2 months ago

I see the print in configuration. How does it end up in ngen --info? Given that you show runtime output, with strings that don't exist in my repo, I'm guessing some code didn't get committed

The ngen_multiline_message and ngen_dependent_multiline_message CMake functions store their string arguments into a separate CMake variable NGEN_CONF_SUMMARY as a side effect. When NGenConfig.h is configured, that variable is outputted as a string here: https://github.com/NOAA-OWP/ngen/blob/2ffedf8ecb3d6311be65d8c7c8f99c2fecf7ee07/include/NGenConfig.h.in#L46

So for every ngen build, the exact build summary is embedded into it via that header

PhilMiller commented 2 months ago

Ah, that was a depth of cleverness that I hadn't realized. Excellent.