smanders / externpro

build external projects with cmake
MIT License
13 stars 12 forks source link

revision bug fix and enhancements #385

Closed smanders closed 1 year ago

smanders commented 1 year ago

the cmake-generated Revision.hpp, built by the Revision_hpp cmake custom target, contained in the revision.cmake file has evolved over the years: see previous issues related to it https://github.com/smanders/externpro/issues/45 https://github.com/smanders/externpro/issues/233

there appears to have been a regression with Revision_hpp: it no longer appears to be running and updating Revision.hpp at build time as it once was, see https://isrhub.usurf.usu.edu/bnelson/CorelliaPlugin/pull/430#issuecomment-272899

smanders commented 1 year ago

enhancement: it would be useful if there were a header-only Revision INTERFACE library that gave access to the Revision.hpp file and if this library had a dependency on the Revision_hpp custom target -- so a project wouldn't need to

add_dependencies(<target> Revision_hpp)

also, if the Revision.hpp were generated in a subdirectory of CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}/Revision/Revision.hpp then getting access to Revision.hpp wouldn't be giving access to the entire CMAKE_BINARY_DIR, but only the ${CMAKE_BINARY_DIR}/Revision directory

smanders commented 1 year ago

there's a build warning on Windows

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5):
warning MSB8065: Custom build for item
"C:\Users\smanders\src\vantage\TemplateMicroservice\_bld\CMakeFiles\fefdabf28e31243f05058c97828d66d5\alwaysRun.rule"
succeeded, but specified output
"c:\users\smanders\src\vantage\templatemicroservice\_bld\alwaysrun"
has not been created. This may cause incremental build to work incorrectly.

because of how I "fixed" always running Revision_hpp with commit https://github.com/smanders/externpro/commit/00124059a2e159d6f0b4533f075090a721196163 -- so I should probably come up with a better/different way...

smanders commented 1 year ago

currently the revision is slightly different depending on whether you are building the xpRelBranch (aka release branch which is master, by default) or not. https://github.com/smanders/externpro/blob/23.02/modules/revision.cmake#L24-L25

  # xpRelBranch (release branch): date yyyymmdd-gitdescribe (20120518-gitdescribe)
  # other branches: user-branch-gitdescribe (smanders-padawan-gitdescribe)

there is a desire to go away from having a release/master branch and just use tags if we want to branch off of a release or go back to a release

the idea is to use the .codereview/CM.txt file to dictate what the revision looks like -- if the build is being made by someone in the CM.txt file (and we'll add ghactions to CM.txt) then it will look like the current "release" revision (date-gitdescribe), and if not then it will look like the current "developer" revision (user-branch-gitdescribe)

smanders commented 1 year ago

completed with commits to dev branch referenced above

verified by introducing a new commit (unnecessary iostream include in TemplateMicroserviceMain.cpp) and resetting (git reset HEAD~1), running make, examining Revision/Revision.hpp and running ./main/TemplateMicroservice --version -- also modifying .codereview/CM.txt to have/remove smanders and verify revision type (release or developer)