xref: /libCEED/rust/libceed-sys/c-src/interface/ceed-config.c (revision 944f002e154c874f981181073a53f172adf7bcd6)
1*944f002eSJeremy L Thompson // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and other CEED contributors.
2*944f002eSJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*944f002eSJeremy L Thompson //
4*944f002eSJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5*944f002eSJeremy L Thompson //
6*944f002eSJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7*944f002eSJeremy L Thompson 
8*944f002eSJeremy L Thompson #include <ceed-impl.h>
9*944f002eSJeremy L Thompson 
10*944f002eSJeremy L Thompson const char *CeedGitVersion         = CEED_GIT_VERSION;
11*944f002eSJeremy L Thompson const char *CeedBuildConfiguration = CEED_BUILD_CONFIGURATION;
12*944f002eSJeremy L Thompson 
13*944f002eSJeremy L Thompson /// @addtogroup CeedUser
14*944f002eSJeremy L Thompson /// @{
15*944f002eSJeremy L Thompson 
16*944f002eSJeremy L Thompson /**
17*944f002eSJeremy L Thompson   @brief Get output of `git describe --dirty` from build time
18*944f002eSJeremy L Thompson 
19*944f002eSJeremy L Thompson   While @ref CeedGetVersion() uniqely identifies the source code for release
20*944f002eSJeremy L Thompson   builds, it does not identify builds from other commits.
21*944f002eSJeremy L Thompson 
22*944f002eSJeremy L Thompson   @param[out] git_version A static string containing the Git commit description.
23*944f002eSJeremy L Thompson 
24*944f002eSJeremy L Thompson   If `git describe --always --dirty` fails, the string `"unknown"` will be provided.
25*944f002eSJeremy L Thompson   This could occur if Git is not installed or if libCEED is not being built from a repository, for example.`
26*944f002eSJeremy L Thompson 
27*944f002eSJeremy L Thompson   @return An error code: 0 - success, otherwise - failure
28*944f002eSJeremy L Thompson 
29*944f002eSJeremy L Thompson   @ref Developer
30*944f002eSJeremy L Thompson 
31*944f002eSJeremy L Thompson   @sa CeedGetVersion() CeedGetBuildConfiguration()
32*944f002eSJeremy L Thompson */
33*944f002eSJeremy L Thompson int CeedGetGitVersion(const char **git_version) {
34*944f002eSJeremy L Thompson   *git_version = CeedGitVersion;
35*944f002eSJeremy L Thompson   return CEED_ERROR_SUCCESS;
36*944f002eSJeremy L Thompson }
37*944f002eSJeremy L Thompson 
38*944f002eSJeremy L Thompson /**
39*944f002eSJeremy L Thompson   @brief Get build variables as a multi-line string
40*944f002eSJeremy L Thompson 
41*944f002eSJeremy L Thompson   Each line of the string has the format `VARNAME = value`.
42*944f002eSJeremy L Thompson 
43*944f002eSJeremy L Thompson   @param[out] build_config A static string containing build variables
44*944f002eSJeremy L Thompson 
45*944f002eSJeremy L Thompson   @return An error code: 0 - success, otherwise - failure
46*944f002eSJeremy L Thompson 
47*944f002eSJeremy L Thompson   @ref Developer
48*944f002eSJeremy L Thompson 
49*944f002eSJeremy L Thompson   @sa CeedGetVersion() CeedGetGitVersion()
50*944f002eSJeremy L Thompson */
51*944f002eSJeremy L Thompson int CeedGetBuildConfiguration(const char **build_config) {
52*944f002eSJeremy L Thompson   *build_config = CeedBuildConfiguration;
53*944f002eSJeremy L Thompson   return CEED_ERROR_SUCCESS;
54*944f002eSJeremy L Thompson }
55*944f002eSJeremy L Thompson 
56*944f002eSJeremy L Thompson /// @}
57