xref: /honee/src/honee-config.c (revision a5677b81b23156371f678817da1e299792f51b83)
1 #include <honee.h>
2 
3 const char *HoneeGitVersion         = HONEE_GIT_VERSION;
4 const char *HoneeBuildConfiguration = HONEE_BUILD_CONFIGURATION;
5 
6 /**
7   @brief Get output of `git describe --dirty` from build time.
8 
9   While @ref HoneeGetVersion() uniquely identifies the source code for release builds, it does not identify builds from other commits.
10 
11   Not collective across MPI processes.
12 
13   @param[out]  git_version  A static string containing the Git commit description.
14                             If `git describe --always --dirty` fails, the string `"unknown"` will be provided.
15                             This could occur if Git is not installed or if Honee is not being built from a repository, for example.`
16 
17   @sa HoneeGetVersion() HoneeGetBuildConfiguration()
18 
19   @return An error code: 0 - success, otherwise - failure
20 **/
21 PetscErrorCode HoneeGetGitVersion(const char **git_version) {
22   *git_version = HoneeGitVersion;
23   return PETSC_SUCCESS;
24 }
25 
26 /**
27   @brief Get build variables as a multi-line string.
28 
29   Each line of the string has the format `VARNAME = value`.
30 
31   Not collective across MPI processes.
32 
33   @param[out]  build_config  A static string containing build variables
34 
35   @sa HoneeGetVersion() HoneeGetGitVersion()
36 
37   @return An error code: 0 - success, otherwise - failure
38 **/
39 PetscErrorCode HoneeGetBuildConfiguration(const char **build_config) {
40   *build_config = HoneeBuildConfiguration;
41   return PETSC_SUCCESS;
42 }
43