Extract prerelease/build information from package semver (#6839)

* Extract prerelease/build information from package semver

Currently we only extract the major.minor.patch identifiers from
the semver label stored in package.json.

This leads to version information in executables incorrectly
reporting a release version is running on prereleases and special builds.

This commit is a quickfix to extract this information and report it
in version strings.

CMake regex parsing is not sophisticated enough to handle the full semver
regex, so we might need to explore other CMake modules if we want to
strictly parse the label.
This commit is contained in:
Michael Bell
2024-03-24 18:33:07 +00:00
committed by GitHub
parent 8526cc7d45
commit d0e3e2af23
3 changed files with 17 additions and 12 deletions
+7 -6
View File
@@ -1,12 +1,13 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define OSRM_VERSION_MAJOR @OSRM_VERSION_MAJOR@
#define OSRM_VERSION_MINOR @OSRM_VERSION_MINOR@
#define OSRM_VERSION_PATCH @OSRM_VERSION_PATCH@
#define OSRM_VERSION_MAJOR @OSRM_VERSION_MAJOR@
#define OSRM_VERSION_MINOR @OSRM_VERSION_MINOR@
#define OSRM_VERSION_PATCH @OSRM_VERSION_PATCH@
#define OSRM_VERSION_PRERELEASE_BUILD "@OSRM_VERSION_PRERELEASE_BUILD@"
#define OSRM_VERSION__(A,B,C) "v" #A "." #B "." #C
#define OSRM_VERSION_(A,B,C) OSRM_VERSION__(A,B,C)
#define OSRM_VERSION OSRM_VERSION_(OSRM_VERSION_MAJOR, OSRM_VERSION_MINOR, OSRM_VERSION_PATCH)
#define OSRM_VERSION__(A,B,C,D) "v" #A "." #B "." #C D
#define OSRM_VERSION_(A,B,C,D) OSRM_VERSION__(A,B,C,D)
#define OSRM_VERSION OSRM_VERSION_(OSRM_VERSION_MAJOR, OSRM_VERSION_MINOR, OSRM_VERSION_PATCH, OSRM_VERSION_PRERELEASE_BUILD)
#endif // VERSION_HPP