COSIMA / libaccessom2

ACCESS-OM2 library
3 stars 7 forks source link

Explicit support for building outside a git repo #82

Closed aidanheerdegen closed 1 year ago

aidanheerdegen commented 1 year ago

Explicit support for building outside a git repo: Check return status of git command and set GIT_COMMIT_HASH to "NA" if error. Previous behaviour emitted error message and GIT_COMMIT_HASH was an empty string.

Deleted unused build variable GIT_URL.

Closes #81

aidanheerdegen commented 1 year ago

Sorry to be a pain, but can you take a look @aekiss and check for any egregious issues.

Obviously CI passed ok, and I've checked building outside of a git repo and it works and reports the YATM_COMMIT_HASH as expected:

$ strings build/bin/yatm.exe | grep YATM_COMMIT_HASH
YATM_COMMIT_HASH=NA

I could create a peprocessor flag like I did for MOM5 and completely exclude this code, but it takes a wee bit more work as I'd need to change the CMake to not compile that module. I can do that if you think it should be done that way.

aidanheerdegen commented 1 year ago

It has been pointed out that setting to NA is non-standard. To be honest there is no standard approach, so probably best to just set to an empty string (which fortran will pad with spaces IIRC).

aidanheerdegen commented 1 year ago

Ok, I'll merge this as the change is pretty minor, and has very little effect.