Fixed building on Windows with cmake, ninja, and clang
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6364f0..26fe832 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -208,7 +208,7 @@ if(APPLE OR ARCH_64)
set(OPT_DEF_SSEMATH ON)
endif()
endif()
-if(UNIX OR MINGW OR MSYS OR USE_CLANG OR VITA)
+if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA)
set(OPT_DEF_LIBC ON)
endif()
diff --git a/src/hidapi/windows/hid.c b/src/hidapi/windows/hid.c
index f508ee1..e6fbf85 100644
--- a/src/hidapi/windows/hid.c
+++ b/src/hidapi/windows/hid.c
@@ -97,8 +97,8 @@ extern "C" {
} /* extern "C" */
#endif
-#include <stdio.h>
-#include <stdlib.h>
+/*#include <stdio.h>*/
+/*#include <stdlib.h>*/
#include "../hidapi/hidapi.h"
diff --git a/src/main/windows/version.rc b/src/main/windows/version.rc
index dc58912..2ce9cf0 100644
--- a/src/main/windows/version.rc
+++ b/src/main/windows/version.rc
@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "2, 0, 16, 0\0"
VALUE "InternalName", "SDL\0"
- VALUE "LegalCopyright", "Copyright © 2021 Sam Lantinga\0"
+ VALUE "LegalCopyright", "Copyright (C) 2021 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL2.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "2, 0, 16, 0\0"
diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c
index b848dc3..016ffc6 100644
--- a/src/render/direct3d11/SDL_render_d3d11.c
+++ b/src/render/direct3d11/SDL_render_d3d11.c
@@ -183,11 +183,13 @@ typedef struct
static const GUID SDL_IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
+#if defined(__WINRT__) && NTDDI_VERSION > NTDDI_WIN8
static const GUID SDL_IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } };
+#endif
static const GUID SDL_IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } };
static const GUID SDL_IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } };
static const GUID SDL_IID_ID3D11DeviceContext1 = { 0xbb2c6faa, 0xb5fb, 0x4082, { 0x8e, 0x6b, 0x38, 0x8b, 0x8c, 0xfa, 0x90, 0xe1 } };
-static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } };
+/*static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } };*/
#ifdef __GNUC__
#pragma GCC diagnostic pop
diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index 877b453..ec43b1e 100644
--- a/src/stdlib/SDL_string.c
+++ b/src/stdlib/SDL_string.c
@@ -281,7 +281,7 @@ SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
* execute a 32-bit set. Set first bytes manually if needed until it is
* aligned. */
value1 = (Uint8)c;
- while ((intptr_t)dstp1 & 0x3) {
+ while ((uintptr_t)dstp1 & 0x3) {
if (len--) {
*dstp1++ = value1;
} else {
@@ -329,7 +329,7 @@ SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src,
using Uint32* pointers, so we need to make sure the pointers are
aligned before we loop using them.
*/
- if (((intptr_t)src & 0x3) || ((intptr_t)dst & 0x3)) {
+ if (((uintptr_t)src & 0x3) || ((uintptr_t)dst & 0x3)) {
/* Do an unaligned byte copy */
Uint8 *srcp1 = (Uint8 *)src;
Uint8 *dstp1 = (Uint8 *)dst;
diff --git a/src/video/SDL_blit_copy.c b/src/video/SDL_blit_copy.c
index 03a60f9..8788c34 100644
--- a/src/video/SDL_blit_copy.c
+++ b/src/video/SDL_blit_copy.c
@@ -34,7 +34,7 @@ SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
__m128 values[4];
for (i = len / 64; i--;) {
- _mm_prefetch(src, _MM_HINT_NTA);
+ _mm_prefetch((const char *)src, _MM_HINT_NTA);
values[0] = *(__m128 *) (src + 0);
values[1] = *(__m128 *) (src + 16);
values[2] = *(__m128 *) (src + 32);