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