summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Galazin <alexander.galazin@arm.com>2021-05-06 18:51:24 +0300
committerGitHub <noreply@github.com>2021-05-06 18:51:24 +0300
commitdab93ea8f88c3661c166ff0771310f36d0a7d790 (patch)
tree0add63544ddec5be66705bf0ed6b2961575d42d1
parent9698f0db4cd5a4684fad7da3c125624d9cf17a57 (diff)
parent46eef4a54367678304f0d24b04f1d0f0621abfb4 (diff)
downloadVK-GL-CTS-dab93ea8f88c3661c166ff0771310f36d0a7d790.tar.gz
VK-GL-CTS-dab93ea8f88c3661c166ff0771310f36d0a7d790.tar.bz2
VK-GL-CTS-dab93ea8f88c3661c166ff0771310f36d0a7d790.zip
Merge pull request #261 from Joshua-Ashton/mingw-support
Implement MinGW build support
-rw-r--r--external/vulkancts/framework/vulkan/vkDefs.h2
-rw-r--r--external/vulkancts/framework/vulkan/vkDefs.hpp2
-rw-r--r--external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp2
-rw-r--r--external/vulkancts/modules/vulkan/synchronization/vktSynchronizationWin32KeyedMutexTests.cpp6
-rw-r--r--framework/delibs/cmake/CFlags.cmake10
-rw-r--r--framework/delibs/cmake/Defs.cmake10
-rw-r--r--framework/delibs/debase/deDefs.c2
-rw-r--r--framework/delibs/decpp/deDirectoryIterator.hpp2
-rw-r--r--framework/delibs/deutil/CMakeLists.txt2
-rw-r--r--framework/delibs/deutil/deSocket.c6
-rw-r--r--framework/platform/CMakeLists.txt4
-rw-r--r--framework/platform/win32/tcuWGL.cpp2
-rw-r--r--framework/platform/win32/tcuWin32Platform.cpp4
-rw-r--r--framework/platform/win32/tcuWin32VulkanPlatform.cpp2
14 files changed, 41 insertions, 15 deletions
diff --git a/external/vulkancts/framework/vulkan/vkDefs.h b/external/vulkancts/framework/vulkan/vkDefs.h
index e211a5d19..257fb1567 100644
--- a/external/vulkancts/framework/vulkan/vkDefs.h
+++ b/external/vulkancts/framework/vulkan/vkDefs.h
@@ -31,7 +31,7 @@
# define VKAPI_ATTR
#endif
-#if (DE_OS == DE_OS_WIN32) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED))
+#if (DE_OS == DE_OS_WIN32) && ((defined(_MSC_VER) && _MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED))
# define VKAPI_CALL __stdcall
# define VKAPI_PTR VKAPI_CALL
#else
diff --git a/external/vulkancts/framework/vulkan/vkDefs.hpp b/external/vulkancts/framework/vulkan/vkDefs.hpp
index 22dd25603..7e38d8467 100644
--- a/external/vulkancts/framework/vulkan/vkDefs.hpp
+++ b/external/vulkancts/framework/vulkan/vkDefs.hpp
@@ -31,7 +31,7 @@
# define VKAPI_ATTR
#endif
-#if (DE_OS == DE_OS_WIN32) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED))
+#if (DE_OS == DE_OS_WIN32) && ((defined(_MSC_VER) && _MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED))
# define VKAPI_CALL __stdcall
#else
# define VKAPI_CALL
diff --git a/external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp
index bffc6438f..567b48f08 100644
--- a/external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp
+++ b/external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp
@@ -53,7 +53,7 @@
#if (DE_OS == DE_OS_WIN32)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
-# include <Dxgi1_2.h>
+# include <dxgi1_2.h>
#endif
using tcu::TestLog;
diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationWin32KeyedMutexTests.cpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationWin32KeyedMutexTests.cpp
index df2c9a1a9..4a286d4a1 100644
--- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationWin32KeyedMutexTests.cpp
+++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationWin32KeyedMutexTests.cpp
@@ -45,9 +45,9 @@
# define NOMINMAX
# include <windows.h>
# include <aclapi.h>
-# include "VersionHelpers.h"
-# include "d3d11_2.h"
-# include "d3dcompiler.h"
+# include <versionhelpers.h>
+# include <d3d11_2.h>
+# include <d3dcompiler.h>
typedef HRESULT (WINAPI * LPD3DX11COMPILEFROMMEMORY)(LPCSTR,
SIZE_T,
diff --git a/framework/delibs/cmake/CFlags.cmake b/framework/delibs/cmake/CFlags.cmake
index b3abf72c3..cde5aa55f 100644
--- a/framework/delibs/cmake/CFlags.cmake
+++ b/framework/delibs/cmake/CFlags.cmake
@@ -79,3 +79,13 @@ elseif (DE_COMPILER_IS_MSC)
else ()
message(FATAL_ERROR "DE_COMPILER is not valid")
endif ()
+
+if (DE_MINGW AND DE_PTR_SIZE EQUAL 8)
+ # Pass -mbig-obj to mingw gas on Win64. COFF has a 2**16 section limit, and
+ # on Win64, every COMDAT function creates at least 3 sections: .text, .pdata,
+ # and .xdata.
+ # Enable static libgcc and libstdc++ also to avoid needing to have
+ # Windows builds of the standard libraries distributed.
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wa,-mbig-obj -static -static-libgcc")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -static -static-libgcc -static-libstdc++")
+endif()
diff --git a/framework/delibs/cmake/Defs.cmake b/framework/delibs/cmake/Defs.cmake
index e710856e0..c1da84b46 100644
--- a/framework/delibs/cmake/Defs.cmake
+++ b/framework/delibs/cmake/Defs.cmake
@@ -149,6 +149,14 @@ if (DE_OS_IS_ANDROID AND NOT DEFINED DE_ANDROID_API)
set(DE_ANDROID_API 5)
endif ()
+# MinGW
+if (CMAKE_CXX_COMPILER MATCHES ".*-mingw32-.*")
+ set(DE_MINGW 1)
+ set(BUILD_SHARED_LIBS OFF)
+else()
+ set(DE_MINGW 0)
+endif()
+
message(STATUS "DE_OS = ${DE_OS}")
message(STATUS "DE_COMPILER = ${DE_COMPILER}")
message(STATUS "DE_CPU = ${DE_CPU}")
@@ -157,6 +165,7 @@ message(STATUS "DE_DEBUG = ${DE_DEBUG}")
if (DE_OS_IS_ANDROID)
message(STATUS "DE_ANDROID_API = ${DE_ANDROID_API}")
endif ()
+message(STATUS "DE_MINGW = ${DE_MINGW}")
# Expose definitions
if (DE_DEBUG)
@@ -167,6 +176,7 @@ add_definitions("-DDE_OS=${DE_OS}")
add_definitions("-DDE_COMPILER=${DE_COMPILER}")
add_definitions("-DDE_CPU=${DE_CPU}")
add_definitions("-DDE_PTR_SIZE=${DE_PTR_SIZE}")
+add_definitions("-DDE_MINGW=${DE_MINGW}")
if (DE_OS_IS_ANDROID)
add_definitions("-DDE_ANDROID_API=${DE_ANDROID_API}")
diff --git a/framework/delibs/debase/deDefs.c b/framework/delibs/debase/deDefs.c
index 09c1348d9..203ce0c9b 100644
--- a/framework/delibs/debase/deDefs.c
+++ b/framework/delibs/debase/deDefs.c
@@ -120,7 +120,7 @@ void deAssertFail (const char* reason, const char* file, int line)
assert(wreason);
# endif
}
-#elif ((DE_OS == DE_OS_WIN32) && (DE_COMPILER == DE_COMPILER_CLANG))
+#elif ((DE_OS == DE_OS_WIN32) && (DE_COMPILER == DE_COMPILER_CLANG || DE_COMPILER == DE_COMPILER_GCC))
_assert(reason, file, line);
#elif (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_IOS) || defined(__FreeBSD__)
fprintf(stderr, "Assertion '%s' failed at %s:%d\n", reason, file, line);
diff --git a/framework/delibs/decpp/deDirectoryIterator.hpp b/framework/delibs/decpp/deDirectoryIterator.hpp
index 6e5b04d0c..7fcec16dc 100644
--- a/framework/delibs/decpp/deDirectoryIterator.hpp
+++ b/framework/delibs/decpp/deDirectoryIterator.hpp
@@ -31,7 +31,7 @@
#if (DE_OS == DE_OS_WIN32 && DE_COMPILER == DE_COMPILER_MSC)
# define DE_DIRITER DE_DIRITER_WIN32
-#elif (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_ANDROID) || (DE_OS == DE_OS_SYMBIAN) || (DE_OS == DE_OS_IOS) || (DE_OS == DE_OS_QNX) || (DE_OS == DE_OS_WIN32 && DE_COMPILER == DE_COMPILER_CLANG)
+#elif (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_ANDROID) || (DE_OS == DE_OS_SYMBIAN) || (DE_OS == DE_OS_IOS) || (DE_OS == DE_OS_QNX) || (DE_OS == DE_OS_WIN32 && (DE_COMPILER == DE_COMPILER_CLANG || DE_COMPILER == DE_COMPILER_GCC))
# define DE_DIRITER DE_DIRITER_POSIX
#endif
diff --git a/framework/delibs/deutil/CMakeLists.txt b/framework/delibs/deutil/CMakeLists.txt
index fdfcb39cd..5d0fe2aa8 100644
--- a/framework/delibs/deutil/CMakeLists.txt
+++ b/framework/delibs/deutil/CMakeLists.txt
@@ -36,7 +36,7 @@ if (DE_OS_IS_ANDROID)
endif ()
if (DE_OS_IS_WIN32)
- set(DEUTIL_LIBS WS2_32)
+ set(DEUTIL_LIBS ${DEUTIL_LIBS} ws2_32)
endif ()
if (DE_OS_IS_UNIX OR DE_OS_IS_QNX)
diff --git a/framework/delibs/deutil/deSocket.c b/framework/delibs/deutil/deSocket.c
index 97fc17e63..fd694777a 100644
--- a/framework/delibs/deutil/deSocket.c
+++ b/framework/delibs/deutil/deSocket.c
@@ -159,9 +159,9 @@ deSocketProtocol deSocketAddress_getProtocol (const deSocketAddress* address)
#if defined(DE_USE_WINSOCK)
/* WinSock spesific. */
-# include <WinSock2.h>
-# include <WS2tcpip.h>
-# include <WinDef.h>
+# include <winsock2.h>
+# include <ws2tcpip.h>
+# include <windef.h>
static deBool initWinsock (void)
{
diff --git a/framework/platform/CMakeLists.txt b/framework/platform/CMakeLists.txt
index 536dddd53..7db9528b3 100644
--- a/framework/platform/CMakeLists.txt
+++ b/framework/platform/CMakeLists.txt
@@ -179,3 +179,7 @@ if (DEQP_USE_X11)
add_definitions(-DDEQP_SUPPORT_WAYLAND=1)
endif ()
endif ()
+
+if (DE_OS_IS_WIN32)
+ target_link_libraries(tcutil-platform "version")
+endif()
diff --git a/framework/platform/win32/tcuWGL.cpp b/framework/platform/win32/tcuWGL.cpp
index e0c79b18f..26dc96e20 100644
--- a/framework/platform/win32/tcuWGL.cpp
+++ b/framework/platform/win32/tcuWGL.cpp
@@ -35,7 +35,7 @@
#include <iterator>
#include <set>
-#include <WinGDI.h>
+#include <wingdi.h>
// WGL_ARB_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
diff --git a/framework/platform/win32/tcuWin32Platform.cpp b/framework/platform/win32/tcuWin32Platform.cpp
index bd38dbdd4..fb87b1c71 100644
--- a/framework/platform/win32/tcuWin32Platform.cpp
+++ b/framework/platform/win32/tcuWin32Platform.cpp
@@ -26,6 +26,10 @@
#include "tcuWin32EGLNativeDisplayFactory.hpp"
#include "egluGLContextFactory.hpp"
+// MinGW doesn't define this in its headers, but
+// still has the export in the libs.
+extern "C" WINUSERAPI WINBOOL WINAPI SetProcessDPIAware(VOID);
+
namespace tcu
{
namespace win32
diff --git a/framework/platform/win32/tcuWin32VulkanPlatform.cpp b/framework/platform/win32/tcuWin32VulkanPlatform.cpp
index cf31dda0b..bfdc609a9 100644
--- a/framework/platform/win32/tcuWin32VulkanPlatform.cpp
+++ b/framework/platform/win32/tcuWin32VulkanPlatform.cpp
@@ -33,8 +33,6 @@
#include "deUniquePtr.hpp"
#include "deMemory.h"
-#pragma comment(lib, "version.lib")
-
namespace tcu
{
namespace win32