Report the commit too with ovniver
This commit is contained in:
parent
bf8a2213c1
commit
a3ffb2443a
@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
|
||||
- Add `ovni_version_get()` function.
|
||||
- Add the `ovniver` program to report the `libovni.so` version.
|
||||
- Add the `ovniver` program to report the libovni version and commit.
|
||||
|
||||
## [1.2.2] - 2022-07-26
|
||||
|
||||
|
@ -22,6 +22,11 @@ set(CMAKE_C_EXTENSIONS FALSE)
|
||||
|
||||
option(ENABLE_DEBUG_LOG "Enable debug messages (very verbose)")
|
||||
option(ENABLE_ALL_TESTS "Forces the execution of all tests")
|
||||
set(OVNI_GIT_COMMIT "unknown" CACHE STRING "Set the git commit")
|
||||
|
||||
if("${OVNI_GIT_COMMIT}" STREQUAL "unknown")
|
||||
message(WARNING "OVNI_GIT_COMMIT is unknown, please specify the git commit")
|
||||
endif()
|
||||
|
||||
if(ENABLE_DEBUG_LOG)
|
||||
add_definitions(-DENABLE_DEBUG)
|
||||
|
@ -37,6 +37,7 @@ typedef struct json_value_t JSON_Value;
|
||||
|
||||
/* Follow https://semver.org rules for versioning */
|
||||
#define OVNI_LIB_VERSION "@PROJECT_VERSION@"
|
||||
#define OVNI_GIT_COMMIT "@OVNI_GIT_COMMIT@"
|
||||
|
||||
/* ----------------------- common ------------------------ */
|
||||
|
||||
@ -129,7 +130,7 @@ struct ovni_rproc {
|
||||
|
||||
#define ovni_version_check() ovni_version_check_str(OVNI_LIB_VERSION)
|
||||
void ovni_version_check_str(const char *version);
|
||||
const char *ovni_version_get(void);
|
||||
void ovni_version_get(const char **version, const char **commit);
|
||||
|
||||
void ovni_proc_init(int app, const char *loom, int pid);
|
||||
|
||||
|
@ -7,8 +7,12 @@
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("libovni version compiled %s, dynamic %s\n",
|
||||
OVNI_LIB_VERSION, ovni_version_get());
|
||||
const char *version, *commit;
|
||||
ovni_version_get(&version, &commit);
|
||||
|
||||
printf("libovni: build v%s (%s), dynamic v%s (%s)\n",
|
||||
OVNI_LIB_VERSION, OVNI_GIT_COMMIT,
|
||||
version, commit);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,10 +23,11 @@ struct ovni_rproc rproc = {0};
|
||||
/* Data per thread */
|
||||
_Thread_local struct ovni_rthread rthread = {0};
|
||||
|
||||
const char *
|
||||
ovni_version_get(void)
|
||||
void
|
||||
ovni_version_get(const char **version, const char **commit)
|
||||
{
|
||||
return OVNI_LIB_VERSION;
|
||||
*version = OVNI_LIB_VERSION;
|
||||
*commit = OVNI_GIT_COMMIT;
|
||||
}
|
||||
|
||||
void ovni_version_check_str(const char *version)
|
||||
|
Loading…
Reference in New Issue
Block a user