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