19ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, 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 /** 173b9caef5SJeremy L Thompson @brief Get output of `git describe --dirty` from build time. 18944f002eSJeremy L Thompson 193b9caef5SJeremy 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() 303b9caef5SJeremy L Thompson 313b9caef5SJeremy 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*e9f76d14SJeremy L Thompson @brief Set whether or not to use Clang when compiling for GPU (instead of nvrtc) 402027fb9dSSirAlienTheGreat 41*e9f76d14SJeremy L Thompson @param[in,out] ceed `Ceed` context to set Clang GPU compilation flag 42*e9f76d14SJeremy L Thompson @param[in] is_clang Flag to use clang for GPU compilation 432027fb9dSSirAlienTheGreat 442027fb9dSSirAlienTheGreat @ref Developer 452027fb9dSSirAlienTheGreat 462027fb9dSSirAlienTheGreat @sa CeedGetIsClang() 472027fb9dSSirAlienTheGreat 482027fb9dSSirAlienTheGreat @return An error code: 0 - success, otherwise - failure 492027fb9dSSirAlienTheGreat */ 502027fb9dSSirAlienTheGreat int CeedSetIsClang(Ceed ceed, bool is_clang) { 512027fb9dSSirAlienTheGreat ceed->cuda_compile_with_clang = is_clang; 522027fb9dSSirAlienTheGreat return CEED_ERROR_SUCCESS; 532027fb9dSSirAlienTheGreat } 542027fb9dSSirAlienTheGreat 552027fb9dSSirAlienTheGreat /** 56*e9f76d14SJeremy L Thompson @brief Determine if the current `ceed` is set to compile with Clang for CPU 572027fb9dSSirAlienTheGreat 58*e9f76d14SJeremy L Thompson @param[in] ceed `Ceed` context to get Clang GPU compilation flag 59*e9f76d14SJeremy L Thompson @param[out] is_clang Variable to store Clang GPU compilation flag 602027fb9dSSirAlienTheGreat 612027fb9dSSirAlienTheGreat @ref Developer 622027fb9dSSirAlienTheGreat 632027fb9dSSirAlienTheGreat @sa CeedSetIsClang() 642027fb9dSSirAlienTheGreat 652027fb9dSSirAlienTheGreat @return An error code: 0 - success, otherwise - failure 662027fb9dSSirAlienTheGreat */ 672027fb9dSSirAlienTheGreat int CeedGetIsClang(Ceed ceed, bool *is_clang) { 682027fb9dSSirAlienTheGreat *is_clang = ceed->cuda_compile_with_clang; 692027fb9dSSirAlienTheGreat return CEED_ERROR_SUCCESS; 702027fb9dSSirAlienTheGreat } 712027fb9dSSirAlienTheGreat 722027fb9dSSirAlienTheGreat /** 733b9caef5SJeremy L Thompson @brief Get build variables as a multi-line string. 74944f002eSJeremy L Thompson 75944f002eSJeremy L Thompson Each line of the string has the format `VARNAME = value`. 76944f002eSJeremy L Thompson 77944f002eSJeremy L Thompson @param[out] build_config A static string containing build variables 78944f002eSJeremy L Thompson 79944f002eSJeremy L Thompson @ref Developer 80944f002eSJeremy L Thompson 81944f002eSJeremy L Thompson @sa CeedGetVersion() CeedGetGitVersion() 823b9caef5SJeremy L Thompson 833b9caef5SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 84944f002eSJeremy L Thompson */ 85944f002eSJeremy L Thompson int CeedGetBuildConfiguration(const char **build_config) { 86944f002eSJeremy L Thompson *build_config = CeedBuildConfiguration; 87944f002eSJeremy L Thompson return CEED_ERROR_SUCCESS; 88944f002eSJeremy L Thompson } 89944f002eSJeremy L Thompson 90944f002eSJeremy L Thompson /// @} 91