Skip to content

Commit 4190bb0

Browse files
author
Stephen Gutekanst
committed
fix Zig/clang msvc support
Signed-off-by: Stephen Gutekanst <[email protected]>
1 parent 55f9bf0 commit 4190bb0

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

include/dxc/Support/dxcapi.use.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
#include "dxc/dxcapi.h"
1616

17+
// Mach change start: static dxcompiler/dxil
18+
#include <string>
19+
// Mach change end
20+
1721
namespace dxc {
1822

1923
extern const char *kDxCompilerLib;

include/dxc/ZigGNUWinAdapter.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,34 @@
99
#ifndef LLVM_SUPPORT_ZIG_GNU_WIN_ADAPTER_H
1010
#define LLVM_SUPPORT_ZIG_GNU_WIN_ADAPTER_H
1111

12+
#if defined(__clang__) && defined(_MSC_VER) && defined(_WIN32) // Zig windows-msvc target
13+
14+
// ETW tracing shims, because we do not use ETW (requires codegen tool)
15+
//
16+
// Event Tracing for Windows (ETW) provides application programmers the ability
17+
// to start and stop event tracing sessions, instrument an application to
18+
// provide trace events, and consume trace events.
19+
//---------------------------------------------------------------------
20+
#define DxcEtw_DXCompilerShutdown_Start()
21+
#define DxcEtw_DXCompilerShutdown_Stop(e)
22+
#define DxcEtw_DXCompilerCreateInstance_Start()
23+
#define DxcEtw_DXCompilerCreateInstance_Stop(hr)
24+
#define DxcEtw_DXCompilerCompile_Start()
25+
#define DxcEtw_DXCompilerCompile_Stop(hr)
26+
#define DxcEtw_DXCompilerDisassemble_Start()
27+
#define DxcEtw_DXCompilerDisassemble_Stop(hr)
28+
#define DxcEtw_DXCompilerPreprocess_Start()
29+
#define DxcEtw_DXCompilerPreprocess_Stop(hr)
30+
#define DxcEtw_DxcValidation_Start()
31+
#define DxcEtw_DxcValidation_Stop(hr)
32+
33+
#define DxcEtw_DXCompilerInitialization_Start()
34+
#define DxcEtw_DXCompilerInitialization_Stop(e)
35+
#define EventRegisterMicrosoft_Windows_DXCompiler_API()
36+
#define EventUnregisterMicrosoft_Windows_DXCompiler_API()
37+
38+
#endif // Zig windows-msvc target
39+
1240
#if defined(__clang__) && !defined(_MSC_VER) && defined(_WIN32) // Zig windows-gnu target
1341

1442
// MinGW UUIDOF specializations

lib/DxcSupport/WinAdapter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// Mach change start
2222
// #include "dxc/Support/WinIncludes.h"
2323
// #ifndef _WIN32
24-
#if !defined(_WIN32) || defined(__clang__)
24+
#if !defined(_WIN32) || (defined(__clang__) && !defined(_MSC_VER))
2525
// Mach change end
2626

2727
#include "dxc/Support/Unicode.h"

lib/DxcSupport/WinFunctions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
#include <map>
2020
#include <string.h>
2121
#include <sys/stat.h>
22+
#ifndef _MSC_VER
2223
#include <unistd.h>
24+
#endif
2325

2426
#include "dxc/Support/WinFunctions.h"
2527
#include "dxc/Support/microcom.h"
2628

29+
#ifndef _MSC_VER
2730
HRESULT UInt32Mult(UINT a, UINT b, UINT *out) {
2831
uint64_t result = (uint64_t)a * (uint64_t)b;
2932
if (result > uint64_t(UINT_MAX))
@@ -32,6 +35,7 @@ HRESULT UInt32Mult(UINT a, UINT b, UINT *out) {
3235
*out = (uint32_t)result;
3336
return S_OK;
3437
}
38+
#endif // _MSC_VER
3539
#endif // defined(__clang__) && defined(_WIN32)
3640
// Mach change end
3741

0 commit comments

Comments
 (0)