FFmpeg-Builds/patches/vulkan/0002-Fixes-for-MinGW-build.patch
2021-04-05 08:47:41 +02:00

87 lines
2.9 KiB
Diff

From 1733181194d4f356e599a748c6d8c5009541604f Mon Sep 17 00:00:00 2001
From: BtbN <btbn@btbn.de>
Date: Mon, 7 Sep 2020 20:07:39 +0200
Subject: [PATCH 2/4] Fixes for MinGW build
Adapted from https://github.com/msys2/MINGW-packages/blob/348f1d46d9d273a2cc928deadf9d9114f7a69c2f/mingw-w64-vulkan-loader/002-proper-def-files-for-32bit.patch
---
loader/CMakeLists.txt | 6 ++++--
loader/loader.h | 4 +++-
tests/layers/vk_format_utils.h | 4 +++-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
index 04faf23cc..b5f90393d 100644
--- a/loader/CMakeLists.txt
+++ b/loader/CMakeLists.txt
@@ -67,6 +67,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
if(WIN32)
# Use static MSVCRT libraries
+ if(MSVC)
foreach(configuration
in
CMAKE_C_FLAGS_DEBUG
@@ -85,6 +86,7 @@ if(WIN32)
"${${configuration}}")
endif()
endforeach()
+ endif()
if(ENABLE_WIN10_ONECORE)
# Note: When linking your app or driver to OneCore.lib, be sure to remove any links to non-umbrella libs (such as
@@ -231,7 +233,7 @@ if(WIN32)
"")
target_link_libraries(vulkan Vulkan::Headers)
- if(ENABLE_WIN10_ONECORE)
+ if(ENABLE_WIN10_ONECORE AND MSVC)
target_link_libraries(vulkan OneCoreUAP.lib LIBCMT.LIB LIBCMTD.LIB LIBVCRUNTIME.LIB LIBUCRT.LIB)
set_target_properties(vulkan PROPERTIES LINK_FLAGS "/NODEFAULTLIB")
else()
@@ -318,11 +320,11 @@ else()
)
# cmake-format: on
endif()
+endif()
if(NOT APPLE)
target_compile_definitions(vulkan PRIVATE _XOPEN_SOURCE=500) # hush compiler warnings for readlink
endif()
-endif()
# Generate pkg-config file.
include(FindPkgConfig QUIET)
diff --git a/loader/loader.h b/loader/loader.h
index ea0c976b5..64ad08693 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -38,7 +38,9 @@
#include "vk_layer_dispatch_table.h"
#include "vk_loader_extensions.h"
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(_WIN32)
+#define LOADER_EXPORT __declspec(dllexport)
+#elif defined(__GNUC__) && __GNUC__ >= 4
#define LOADER_EXPORT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
#define LOADER_EXPORT __attribute__((visibility("default")))
diff --git a/tests/layers/vk_format_utils.h b/tests/layers/vk_format_utils.h
index e76f9ec2f..ef06e12af 100644
--- a/tests/layers/vk_format_utils.h
+++ b/tests/layers/vk_format_utils.h
@@ -25,7 +25,9 @@
#include "vulkan/vulkan.h"
#if !defined(VK_LAYER_EXPORT)
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(_WIN32)
+#define VK_LAYER_EXPORT __declspec(dllexport)
+#elif defined(__GNUC__) && __GNUC__ >= 4
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
--
2.25.1