Merge pull request #261 from Joshua-Ashton/mingw-support

Implement MinGW build support
This commit is contained in:
Alexander Galazin 2021-05-06 18:51:24 +03:00 committed by GitHub
commit dab93ea8f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 41 additions and 15 deletions

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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,

View file

@ -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()

View file

@ -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}")

View file

@ -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);

View file

@ -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

View file

@ -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)

View file

@ -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)
{

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -33,8 +33,6 @@
#include "deUniquePtr.hpp"
#include "deMemory.h"
#pragma comment(lib, "version.lib")
namespace tcu
{
namespace win32