[vlc-commits] contrib: allow static linking of ANGLE on Windows

Pierre Lamot git at videolan.org
Tue May 19 16:52:50 CEST 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed May  6 18:29:10 2020 +0200| [a7e6ee23ada32c86a008075201210de77f6a160f] | committer: Pierre Lamot

contrib: allow static linking of ANGLE on Windows

  Add KHRONOS_STATIC to allow static linking on Windows.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a7e6ee23ada32c86a008075201210de77f6a160f
---

 ...STATIC-to-allow-static-linking-on-Windows.patch | 48 ++++++++++++++++++++++
 contrib/src/qt/rules.mak                           |  1 +
 2 files changed, 49 insertions(+)

diff --git a/contrib/src/qt/0009-Add-KHRONOS_STATIC-to-allow-static-linking-on-Windows.patch b/contrib/src/qt/0009-Add-KHRONOS_STATIC-to-allow-static-linking-on-Windows.patch
new file mode 100644
index 0000000000..701c3edd67
--- /dev/null
+++ b/contrib/src/qt/0009-Add-KHRONOS_STATIC-to-allow-static-linking-on-Windows.patch
@@ -0,0 +1,48 @@
+From 94ba8ee876206364cf45a9bc08b8db5a52cb9543 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Krzysztof=20Kosi=C5=84ski?= <krzysio at 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
diff --git a/contrib/src/qt/rules.mak b/contrib/src/qt/rules.mak
index 72d60ca6f1..1eb09d87ae 100644
--- a/contrib/src/qt/rules.mak
+++ b/contrib/src/qt/rules.mak
@@ -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



More information about the vlc-commits mailing list