Fix version string in metadata, support optional toolname override (#4641)
Version string in metadata no longer old clang string or stale HLSL_FIXED_VER. Now it's derived from the defines in dxcversion.inc that's generated by gen_version.py or copied from fixed version file. Addition of toolname in latest-release.json allows for this to be changed for every build out of a branch or project that sets this. It defaults to "dxcoob" which matches the dxc "Out Of Box" name used for releases before. The fixed version file can also define the HLSL_TOOL_NAME, HLSL_LLVM_IDENT, and HLSL_VERSION_MACRO to override these.
This commit is contained in:
Родитель
e97577bba4
Коммит
bdb110f425
|
@ -33,7 +33,9 @@ set(get_svn_script "${LLVM_MAIN_SRC_DIR}/cmake/modules/GetSVN.cmake")
|
|||
|
||||
# HLSL Change Starts
|
||||
if (HLSL_ENABLE_FIXED_VER)
|
||||
add_definitions(/DHLSL_FIXED_VER="dxcoob 2019.05.00")
|
||||
# Actual version string is no longer specified here, but instead derived from
|
||||
# the defines in the generated or copied dxcversion.inc
|
||||
add_definitions(/DHLSL_FIXED_VER)
|
||||
endif (HLSL_ENABLE_FIXED_VER)
|
||||
# HLSL Change Ends
|
||||
|
||||
|
@ -89,6 +91,9 @@ add_clang_library(clangBasic
|
|||
VirtualFileSystem.cpp
|
||||
Warnings.cpp
|
||||
${version_inc}
|
||||
|
||||
DEPENDS
|
||||
hlsl_dxcversion_autogen # HLSL Change
|
||||
)
|
||||
|
||||
# HLSL Change Starts
|
||||
|
@ -112,4 +117,6 @@ if ( HLSL_SUPPORT_QUERY_GIT_COMMIT_INFO )
|
|||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp
|
||||
PROPERTIES OBJECT_DEPENDS "${GIT_COMMIT_INFO_FILE}")
|
||||
endif()
|
||||
|
||||
target_include_directories(clangBasic PUBLIC ${HLSL_VERSION_LOCATION}) # HLSL Change
|
||||
# HLSL Change Ends
|
||||
|
|
|
@ -22,6 +22,29 @@
|
|||
# include "SVNVersion.inc"
|
||||
#endif
|
||||
|
||||
// HLSL Change Starts
|
||||
#include "dxcversion.inc"
|
||||
|
||||
// Here are some defaults, but these should be defined in dxcversion.inc
|
||||
#ifndef HLSL_TOOL_NAME
|
||||
#define HLSL_TOOL_NAME "dxc(private)"
|
||||
#endif
|
||||
#ifndef HLSL_LLVM_IDENT
|
||||
#ifdef RC_FILE_VERSION
|
||||
#define HLSL_LLVM_IDENT HLSL_TOOL_NAME " " RC_FILE_VERSION
|
||||
#else
|
||||
#define HLSL_LLVM_IDENT HLSL_TOOL_NAME " version unknown"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef HLSL_VERSION_MACRO
|
||||
#ifdef RC_PRODUCT_VERSION
|
||||
#define HLSL_VERSION_MACRO HLSL_TOOL_NAME " " RC_PRODUCT_VERSION
|
||||
#else
|
||||
#define HLSL_VERSION_MACRO HLSL_TOOL_NAME " version unknown"
|
||||
#endif
|
||||
#endif
|
||||
// HLSL Change Ends
|
||||
|
||||
namespace clang {
|
||||
|
||||
std::string getClangRepositoryPath() {
|
||||
|
@ -136,15 +159,13 @@ std::string getClangFullRepositoryVersion() {
|
|||
}
|
||||
|
||||
std::string getClangFullVersion() {
|
||||
return getClangToolFullVersion("clang");
|
||||
return getClangToolFullVersion(HLSL_TOOL_NAME); // HLSL Change
|
||||
}
|
||||
|
||||
std::string getClangToolFullVersion(StringRef ToolName) {
|
||||
#ifdef HLSL_FIXED_VER // HLSL Change Starts
|
||||
// We fix a specific version for builds that are released;
|
||||
// this allows tools to pick a known version for a given !llvm.ident value.
|
||||
return std::string(HLSL_FIXED_VER);
|
||||
#else
|
||||
#ifdef HLSL_LLVM_IDENT // HLSL Change Starts
|
||||
return std::string(HLSL_LLVM_IDENT);
|
||||
#else // HLSL Change Ends
|
||||
std::string buf;
|
||||
llvm::raw_string_ostream OS(buf);
|
||||
#ifdef CLANG_VENDOR
|
||||
|
@ -159,15 +180,13 @@ std::string getClangToolFullVersion(StringRef ToolName) {
|
|||
#endif
|
||||
|
||||
return OS.str();
|
||||
#endif // HLSL Change Ends
|
||||
#endif // HLSL Change
|
||||
}
|
||||
|
||||
std::string getClangFullCPPVersion() {
|
||||
#ifdef HLSL_FIXED_VER // HLSL Change Starts
|
||||
// We fix a specific version for builds that are released;
|
||||
// this allows tools to pick a known version for a given !llvm.ident value.
|
||||
return std::string(HLSL_FIXED_VER);
|
||||
#else
|
||||
#ifdef HLSL_VERSION_MACRO // HLSL Change Starts
|
||||
return std::string(HLSL_VERSION_MACRO);
|
||||
#else // HLSL Change Ends
|
||||
// The version string we report in __VERSION__ is just a compacted version of
|
||||
// the one we report on the command line.
|
||||
std::string buf;
|
||||
|
@ -176,8 +195,9 @@ std::string getClangFullCPPVersion() {
|
|||
OS << CLANG_VENDOR;
|
||||
#endif
|
||||
OS << "unofficial";
|
||||
|
||||
return OS.str();
|
||||
#endif // HLSL Change Ends
|
||||
#endif // HLSL Change
|
||||
}
|
||||
|
||||
// HLSL Change Starts
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// Make sure only one cbuffer is emitted for the final
|
||||
// dxil.
|
||||
|
||||
// CHECK-LABEL: ; Buffer Definitions:
|
||||
// CHECK-NOT: cb1
|
||||
|
||||
cbuffer BAR {
|
||||
|
|
|
@ -65,6 +65,10 @@ class VersionGen():
|
|||
self.current_branch = get_current_branch()
|
||||
self.rc_version_field_4_cache = None
|
||||
|
||||
def tool_name(self):
|
||||
return self.latest_release_info.get("toolname",
|
||||
"dxcoob" if self.options.official else "dxc(private)")
|
||||
|
||||
def rc_version_field_1(self):
|
||||
return self.latest_release_info["version"]["major"]
|
||||
|
||||
|
@ -127,6 +131,9 @@ class VersionGen():
|
|||
self.print_define('RC_COPYRIGHT', '"(c) Microsoft Corporation. All rights reserved."')
|
||||
self.print_define('RC_PRODUCT_NAME', '"Microsoft(r) DirectX for Windows(r) - Out Of Band"')
|
||||
self.print_define('RC_PRODUCT_VERSION', self.product_version_str())
|
||||
self.print_define('HLSL_TOOL_NAME', '"{}"'.format(self.tool_name()))
|
||||
self.print_define('HLSL_VERSION_MACRO', 'HLSL_TOOL_NAME " " RC_FILE_VERSION')
|
||||
self.print_define('HLSL_LLVM_IDENT', 'HLSL_TOOL_NAME " " RC_PRODUCT_VERSION')
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -50,3 +50,17 @@
|
|||
#endif
|
||||
#define RC_PRODUCT_VERSION "1.7.2207.0"
|
||||
|
||||
#ifdef HLSL_TOOL_NAME
|
||||
#undef HLSL_TOOL_NAME
|
||||
#endif
|
||||
#define HLSL_TOOL_NAME "dxcoob"
|
||||
|
||||
#ifdef HLSL_VERSION_MACRO
|
||||
#undef HLSL_VERSION_MACRO
|
||||
#endif
|
||||
#define HLSL_VERSION_MACRO HLSL_TOOL_NAME " " RC_FILE_VERSION
|
||||
|
||||
#ifdef HLSL_LLVM_IDENT
|
||||
#undef HLSL_LLVM_IDENT
|
||||
#endif
|
||||
#define HLSL_LLVM_IDENT HLSL_TOOL_NAME " " RC_PRODUCT_VERSION
|
||||
|
|
Загрузка…
Ссылка в новой задаче