75 lines
2.5 KiB
Diff
75 lines
2.5 KiB
Diff
From 45fd7a314a2dc4b39bacbd91369128e04adc0699 Mon Sep 17 00:00:00 2001
|
|
From: Syoyo Fujita <syoyo@lighttransport.com>
|
|
Date: Thu, 28 May 2020 21:38:16 +0900
|
|
Subject: [PATCH 1/4] Fix build on MinGW cross compiling environment.
|
|
|
|
---
|
|
loader/CMakeLists.txt | 4 +++-
|
|
loader/loader.rc | 4 ++++
|
|
loader/loader_windows.c | 12 ++++++++++++
|
|
3 files changed, 19 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
|
|
index 56aece671..6e7971845 100644
|
|
--- a/loader/CMakeLists.txt
|
|
+++ b/loader/CMakeLists.txt
|
|
@@ -187,7 +187,7 @@ if(WIN32)
|
|
if (USE_MASM)
|
|
enable_language(ASM_MASM)
|
|
endif ()
|
|
- if(CMAKE_ASM_MASM_COMPILER_WORKS OR JWASM_FOUND)
|
|
+ if((CMAKE_ASM_MASM_COMPILER_WORKS AND NOT CMAKE_CROSSCOMPILING) OR JWASM_FOUND)
|
|
if(MINGW)
|
|
set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} ${JWASM_FLAGS})
|
|
elseif(NOT CMAKE_CL_64 AND NOT JWASM_FOUND)
|
|
@@ -207,6 +207,8 @@ if(WIN32)
|
|
add_library(loader-unknown-chain OBJECT unknown_ext_chain.c)
|
|
set_target_properties(loader-unknown-chain PROPERTIES CMAKE_C_FLAGS_DEBUG "${MODIFIED_C_FLAGS_DEBUG}")
|
|
target_compile_options(loader-unknown-chain PUBLIC ${MSVC_LOADER_COMPILE_OPTIONS})
|
|
+
|
|
+ target_include_directories(loader-unknown-chain PRIVATE "$<TARGET_PROPERTY:Vulkan::Headers,INTERFACE_INCLUDE_DIRECTORIES>")
|
|
endif()
|
|
elseif(APPLE)
|
|
# For MacOS, use the C code and force the compiler's tail-call optimization instead of using assembly code.
|
|
diff --git a/loader/loader.rc b/loader/loader.rc
|
|
index 44193ea33..456ac70a2 100644
|
|
--- a/loader/loader.rc
|
|
+++ b/loader/loader.rc
|
|
@@ -19,7 +19,11 @@
|
|
// Author: Charles Giessen <charles@lunarg.com>
|
|
//
|
|
|
|
+#if defined(__MINGW32__)
|
|
+#include <winresrc.h>
|
|
+#else
|
|
#include "winres.h"
|
|
+#endif
|
|
|
|
// All set through CMake
|
|
#define VER_FILE_VERSION 1, 0, 1111, 2222
|
|
diff --git a/loader/loader_windows.c b/loader/loader_windows.c
|
|
index aff3b276e..e1579bf3a 100644
|
|
--- a/loader/loader_windows.c
|
|
+++ b/loader/loader_windows.c
|
|
@@ -58,6 +58,18 @@
|
|
typedef HRESULT(APIENTRY *PFN_CreateDXGIFactory1)(REFIID riid, void **ppFactory);
|
|
static PFN_CreateDXGIFactory1 fpCreateDXGIFactory1;
|
|
|
|
+#if defined(__MINGW32__)
|
|
+// MinGW header may not have some definitions(cfgmgr32.h).
|
|
+#if !defined(CM_GETIDLIST_FILTER_CLASS)
|
|
+#define CM_GETIDLIST_FILTER_CLASS (0x200)
|
|
+#endif
|
|
+
|
|
+#if !defined(CM_GETIDLIST_FILTER_PRESENT)
|
|
+#define CM_GETIDLIST_FILTER_PRESENT (0x100)
|
|
+#endif
|
|
+
|
|
+#endif // __MINGW32__
|
|
+
|
|
void windows_initialization(void) {
|
|
char dll_location[MAX_PATH];
|
|
HMODULE module_handle = NULL;
|
|
--
|
|
2.25.1
|
|
|