diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-06-02 15:26:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-02 15:26:51 -0400 |
| commit | d386e27dc319b2feb362acd430ff5c640d8c6fba (patch) | |
| tree | 7b43ceaf87a1fdf02fb23641f7d861d5b2e4e125 | |
| parent | f87b6327879ce425531bc1d83f3053c36773d27e (diff) | |
Added spGetBuildTagString. (#1365)
| -rw-r--r-- | slang.h | 18 | ||||
| -rw-r--r-- | source/slang/slang.cpp | 7 |
2 files changed, 24 insertions, 1 deletions
@@ -1278,6 +1278,22 @@ extern "C" SlangCompileRequest* request, SlangOptimizationLevel level); + + /*! + @brief Get the build version 'tag' string. The string is the same as produced via `git describe --tags` + for the project. If Slang is built separately from the automated build scripts + the contents will by default be 'unknown'. Any string can be set by changing the + contents of 'slang-tag-version.h' file and recompiling the project. + + This function will return exactly the same result as the method getBuildTag string on IGlobalSession. + + An advantage of using this function over the method is that doing so does not require the creation of + a session, which can be a fairly costly operation. + + @return The build tag string + */ + SLANG_API const char* spGetBuildTagString(); + /*! @brief Set the container format to be used for binary output. */ @@ -2869,6 +2885,8 @@ namespace slang the contents will by default be 'unknown'. Any string can be set by changing the contents of 'slang-tag-version.h' file and recompiling the project. + This method will return exactly the same result as the free function spGetBuildTagString. + @return The build tag string */ virtual SLANG_NO_THROW const char* SLANG_MCALL getBuildTagString() = 0; diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index e70486ca9..793b81ebf 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -265,7 +265,7 @@ SLANG_NO_THROW void SLANG_MCALL Session::getDownstreamCompilerPrelude( SLANG_NO_THROW const char* SLANG_MCALL Session::getBuildTagString() { - return SLANG_TAG_VERSION; + return spGetBuildTagString(); } SLANG_NO_THROW SlangResult SLANG_MCALL Session::setDefaultDownstreamCompiler(SlangSourceLanguage sourceLanguage, SlangPassThrough defaultCompiler) @@ -2656,6 +2656,11 @@ SLANG_API void spDestroySession( session->release(); } +SLANG_API const char* spGetBuildTagString() +{ + return SLANG_TAG_VERSION; +} + SLANG_API void spAddBuiltins( SlangSession* session, char const* sourcePath, |
