contrib: allow static linking of ANGLE on Windows

Add KHRONOS_STATIC to allow static linking on Windows.
This commit is contained in:
Pierre Lamot 2020-05-06 18:29:10 +02:00
parent 3444c79f6e
commit a7e6ee23ad
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,48 @@
From 94ba8ee876206364cf45a9bc08b8db5a52cb9543 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Krzysztof=20Kosi=C5=84ski?= <krzysio@google.com>
Date: Wed, 24 Apr 2019 17:44:46 -0700
Subject: [PATCH] Add KHRONOS_STATIC to allow static linking on Windows.
I have encountered multiple situations where it is desirable to
statically link against a software implementation of EGL on Windows.
Add the preprocessor constant KHRONOS_STATIC that disables the
annotation of EGL entry points as DLL-imported.
---
src/3rdparty/angle/include/KHR/khrplatform.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/3rdparty/angle/include/KHR/khrplatform.h b/src/3rdparty/angle/include/KHR/khrplatform.h
index 975bbff..5b55ea2 100644
--- a/src/3rdparty/angle/include/KHR/khrplatform.h
+++ b/src/3rdparty/angle/include/KHR/khrplatform.h
@@ -90,12 +90,20 @@
* int arg2) KHRONOS_APIATTRIBUTES;
*/
+#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
+# define KHRONOS_STATIC 1
+#endif
+
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+#if defined(KHRONOS_STATIC)
+ /* If the preprocessor constant KHRONOS_STATIC is defined, make the
+ * header compatible with static linking. */
+# define KHRONOS_APICALL
+#elif defined(_WIN32)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
@@ -111,7 +119,7 @@
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else

View File

@ -37,6 +37,7 @@ endif
$(APPLY) $(SRC)/qt/0006-ANGLE-don-t-use-msvc-intrinsics-when-crosscompiling-.patch
$(APPLY) $(SRC)/qt/0007-ANGLE-remove-static-assert-that-can-t-be-evaluated-b.patch
$(APPLY) $(SRC)/qt/0008-ANGLE-disable-ANGLE_STD_ASYNC_WORKERS-when-compiling.patch
$(APPLY) $(SRC)/qt/0009-Add-KHRONOS_STATIC-to-allow-static-linking-on-Windows.patch
$(APPLY) $(SRC)/qt/fix-mingw-pkgconfig-file-and-dependency-naming.patch
ifdef HAVE_CROSS_COMPILE