Browse Source

Fixed building on Windows with cmake, ninja, and clang

Sam Lantinga 4 years ago
parent
commit
a91ab883e9

+ 1 - 1
CMakeLists.txt

@@ -208,7 +208,7 @@ if(APPLE OR ARCH_64)
     set(OPT_DEF_SSEMATH ON)
     set(OPT_DEF_SSEMATH ON)
   endif()
   endif()
 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)
   set(OPT_DEF_LIBC ON)
 endif()
 endif()
 
 

+ 2 - 2
src/hidapi/windows/hid.c

@@ -97,8 +97,8 @@ extern "C" {
 } /* extern "C" */
 } /* extern "C" */
 #endif
 #endif
 
 
-#include <stdio.h>
-#include <stdlib.h>
+/*#include <stdio.h>*/
+/*#include <stdlib.h>*/
 
 
 
 
 #include "../hidapi/hidapi.h"
 #include "../hidapi/hidapi.h"

+ 1 - 1
src/main/windows/version.rc

@@ -25,7 +25,7 @@ BEGIN
             VALUE "FileDescription", "SDL\0"
             VALUE "FileDescription", "SDL\0"
             VALUE "FileVersion", "2, 0, 16, 0\0"
             VALUE "FileVersion", "2, 0, 16, 0\0"
             VALUE "InternalName", "SDL\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 "OriginalFilename", "SDL2.dll\0"
             VALUE "ProductName", "Simple DirectMedia Layer\0"
             VALUE "ProductName", "Simple DirectMedia Layer\0"
             VALUE "ProductVersion", "2, 0, 16, 0\0"
             VALUE "ProductVersion", "2, 0, 16, 0\0"

+ 3 - 1
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_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 } };
 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 } };
 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_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_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_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__
 #ifdef __GNUC__
 #pragma GCC diagnostic pop
 #pragma GCC diagnostic pop

+ 2 - 2
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
      * execute a 32-bit set. Set first bytes manually if needed until it is
      * aligned. */
      * aligned. */
     value1 = (Uint8)c;
     value1 = (Uint8)c;
-    while ((intptr_t)dstp1 & 0x3) {
+    while ((uintptr_t)dstp1 & 0x3) {
         if (len--) {
         if (len--) {
             *dstp1++ = value1;
             *dstp1++ = value1;
         } else {
         } 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
        using Uint32* pointers, so we need to make sure the pointers are
        aligned before we loop using them.
        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 */
         /* Do an unaligned byte copy */
         Uint8 *srcp1 = (Uint8 *)src;
         Uint8 *srcp1 = (Uint8 *)src;
         Uint8 *dstp1 = (Uint8 *)dst;
         Uint8 *dstp1 = (Uint8 *)dst;

+ 1 - 1
src/video/SDL_blit_copy.c

@@ -34,7 +34,7 @@ SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
 
 
     __m128 values[4];
     __m128 values[4];
     for (i = len / 64; i--;) {
     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[0] = *(__m128 *) (src + 0);
         values[1] = *(__m128 *) (src + 16);
         values[1] = *(__m128 *) (src + 16);
         values[2] = *(__m128 *) (src + 32);
         values[2] = *(__m128 *) (src + 32);