xref: /libCEED/rust/libceed-sys/c-src/interface/ceed-config.c (revision 3b9caef58af0b75e45cbbaf9089919028a809fac)
1944f002eSJeremy L Thompson // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and other CEED contributors.
2944f002eSJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3944f002eSJeremy L Thompson //
4944f002eSJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5944f002eSJeremy L Thompson //
6944f002eSJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7944f002eSJeremy L Thompson 
8944f002eSJeremy L Thompson #include <ceed-impl.h>
9944f002eSJeremy L Thompson 
10944f002eSJeremy L Thompson const char *CeedGitVersion         = CEED_GIT_VERSION;
11944f002eSJeremy L Thompson const char *CeedBuildConfiguration = CEED_BUILD_CONFIGURATION;
12944f002eSJeremy L Thompson 
13944f002eSJeremy L Thompson /// @addtogroup CeedUser
14944f002eSJeremy L Thompson /// @{
15944f002eSJeremy L Thompson 
16944f002eSJeremy L Thompson /**
17*3b9caef5SJeremy L Thompson   @brief Get output of `git describe --dirty` from build time.
18944f002eSJeremy L Thompson 
19*3b9caef5SJeremy L Thompson   While @ref CeedGetVersion() uniquely identifies the source code for release
20944f002eSJeremy L Thompson   builds, it does not identify builds from other commits.
21944f002eSJeremy L Thompson 
22944f002eSJeremy L Thompson   @param[out] git_version A static string containing the Git commit description.
23944f002eSJeremy L Thompson 
24944f002eSJeremy L Thompson   If `git describe --always --dirty` fails, the string `"unknown"` will be provided.
25944f002eSJeremy L Thompson   This could occur if Git is not installed or if libCEED is not being built from a repository, for example.`
26944f002eSJeremy L Thompson 
27944f002eSJeremy L Thompson   @ref Developer
28944f002eSJeremy L Thompson 
29944f002eSJeremy L Thompson   @sa CeedGetVersion() CeedGetBuildConfiguration()
30*3b9caef5SJeremy L Thompson 
31*3b9caef5SJeremy L Thompson   @return An error code: 0 - success, otherwise - failure
32944f002eSJeremy L Thompson */
33944f002eSJeremy L Thompson int CeedGetGitVersion(const char **git_version) {
34944f002eSJeremy L Thompson   *git_version = CeedGitVersion;
35944f002eSJeremy L Thompson   return CEED_ERROR_SUCCESS;
36944f002eSJeremy L Thompson }
37944f002eSJeremy L Thompson 
38944f002eSJeremy L Thompson /**
39*3b9caef5SJeremy L Thompson   @brief Get build variables as a multi-line string.
40944f002eSJeremy L Thompson 
41944f002eSJeremy L Thompson   Each line of the string has the format `VARNAME = value`.
42944f002eSJeremy L Thompson 
43944f002eSJeremy L Thompson   @param[out] build_config A static string containing build variables
44944f002eSJeremy L Thompson 
45944f002eSJeremy L Thompson   @ref Developer
46944f002eSJeremy L Thompson 
47944f002eSJeremy L Thompson   @sa CeedGetVersion() CeedGetGitVersion()
48*3b9caef5SJeremy L Thompson 
49*3b9caef5SJeremy L Thompson   @return An error code: 0 - success, otherwise - failure
50944f002eSJeremy L Thompson */
51944f002eSJeremy L Thompson int CeedGetBuildConfiguration(const char **build_config) {
52944f002eSJeremy L Thompson   *build_config = CeedBuildConfiguration;
53944f002eSJeremy L Thompson   return CEED_ERROR_SUCCESS;
54944f002eSJeremy L Thompson }
55944f002eSJeremy L Thompson 
56944f002eSJeremy L Thompson /// @}
57