Krita ANGLE with mingw-w64 fix
ActivePublic

Authored by alvinhochun on Aug 2 2017, 5:33 PM.
diff --git a/3rdparty/ext_qt/CMakeLists.txt b/3rdparty/ext_qt/CMakeLists.txt
index 14263f8436..fa3e2fd4e3 100644
--- a/3rdparty/ext_qt/CMakeLists.txt
+++ b/3rdparty/ext_qt/CMakeLists.txt
@@ -35,6 +35,7 @@ if (WIN32)
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0002-Hack-always-return-we-support-DIBV5.patch
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0003-Hack-for-fullscreen-workaround.patch
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/qopengldebug-gles.patch
+ COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/gerrit-189539-ANGLE-mingw-fix.patch
INSTALL_DIR ${EXTPREFIX_qt}
CONFIGURE_COMMAND <SOURCE_DIR>/configure.bat ${_QT_conf}
diff --git a/3rdparty/ext_qt/gerrit-189539-ANGLE-mingw-fix.patch b/3rdparty/ext_qt/gerrit-189539-ANGLE-mingw-fix.patch
new file mode 100644
index 0000000000..6698fb5d0c
--- /dev/null
+++ b/3rdparty/ext_qt/gerrit-189539-ANGLE-mingw-fix.patch
@@ -0,0 +1,158 @@
+diff --git a/qtbase/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp b/qtbase/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
+index 972c289412..cbb813b83f 100644
+--- a/qtbase/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
++++ b/qtbase/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
+@@ -20,7 +20,7 @@ typedef struct D3D11_QUERY_DATA_SO_STATISTICS {
+ } D3D11_QUERY_DATA_SO_STATISTICS;
+ #endif // ANGLE_MINGW32_COMPAT
+
+-#ifdef __MINGW32__
++#if defined __MINGW32__ && __GNUC__ < 6L
+ typedef struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT {
+ UINT64 Frequency;
+ BOOL Disjoint;
+diff --git a/qtbase/src/angle/src/common/common.pri b/qtbase/src/angle/src/common/common.pri
+index 7305362d86..c1f6e22a87 100644
+--- a/qtbase/src/angle/src/common/common.pri
++++ b/qtbase/src/angle/src/common/common.pri
+@@ -21,20 +21,6 @@ lib_replace.replace = \$\$\$\$[QT_INSTALL_LIBS]
+ lib_replace.CONFIG = path
+ QMAKE_PRL_INSTALL_REPLACE += lib_replace
+
+-# DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK.
+-winrt|msvc {
+- FXC = fxc.exe
+-} else {
+- DX_DIR = $$(DXSDK_DIR)
+- isEmpty(DX_DIR) {
+- error("Cannot determine DirectX SDK location. Please set DXSDK_DIR environment variable.")
+- }
+-
+- equals(QMAKE_TARGET.arch, x86_64) {
+- FXC = \"$${DX_DIR}Utilities\\bin\\x64\\fxc.exe\"
+- } else {
+- FXC = \"$${DX_DIR}Utilities\\bin\\x86\\fxc.exe\"
+- }
+-}
++FXC = $$QMAKE_FXC_LOCATION
+
+ static: DEFINES *= LIBGLESV2_EXPORT_H_ ANGLE_EXPORT=
+diff --git a/qtbase/src/gui/configure.json b/qtbase/src/gui/configure.json
+index 2fb03a452a..a5f85e54ba 100644
+--- a/qtbase/src/gui/configure.json
++++ b/qtbase/src/gui/configure.json
+@@ -330,11 +330,14 @@
+ "label": "DirectX SDK",
+ "type": "directX",
+ "files": [
+- "d3dcompiler.h",
+- "d3d11.lib",
+- "fxc.exe"
++ "d3dcompiler.h"
+ ]
+ },
++ "fxc": {
++ "label": "DirectX Shader Compiler",
++ "type": "fxc",
++ "log": "value"
++ },
+ "egl-x11": {
+ "label": "EGL on X11",
+ "type": "compile",
+@@ -440,10 +443,11 @@
+ "angle": {
+ "label": "ANGLE",
+ "autoDetect": "features.opengles2 || features.opengl-dynamic",
+- "condition": "config.win32 && tests.directx",
++ "condition": "config.win32 && tests.directx && tests.fxc",
+ "output": [
+ "publicFeature",
+- { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" }
++ { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" },
++ { "type": "varAssign", "name": "QMAKE_FXC_LOCATION", "value": "tests.fxc.value" }
+ ]
+ },
+ "combined-angle-lib": {
+diff --git a/qtbase/src/gui/configure.pri b/qtbase/src/gui/configure.pri
+index aaffa835dc..c048129f55 100644
+--- a/qtbase/src/gui/configure.pri
++++ b/qtbase/src/gui/configure.pri
+@@ -15,22 +15,12 @@ defineTest(qtConfLibrary_freetype) {
+ return(true)
+ }
+
+-# Check for Direct X SDK (include, lib, and direct shader compiler 'fxc').
+-# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
+-# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
+-# the Windows SDK. Checking for the header is not sufficient, since it
+-# is also present in MinGW.
++# For MSVC everything DirectX related is included in Windows Kit >= 8,
++# so we do not do any magic in this case.
++# For MinGW we need the shader compiler (fxc.exe), which
++# are not part of MinGW. They can either be obtained from a DirectX SDK
++# (keep the old approach working) or Windows Kit (>= 8).
+ defineTest(qtConfTest_directX) {
+- dxdir = $$getenv("DXSDK_DIR")
+- !isEmpty(dxdir) {
+- EXTRA_INCLUDEPATH += $$dxdir/include
+- equals(QT_ARCH, x86_64): \
+- EXTRA_LIBDIR += $$dxdir/lib/x64
+- else: \
+- EXTRA_LIBDIR += $$dxdir/lib/x86
+- EXTRA_PATH += $$dxdir/Utilities/bin/x86
+- }
+-
+ $$qtConfEvaluate("features.sse2") {
+ ky = $$size($${1}.files._KEYS_)
+ $${1}.files._KEYS_ += $$ky
+@@ -42,6 +32,50 @@ defineTest(qtConfTest_directX) {
+ return(false)
+ }
+
++defineTest(qtConfTest_fxc) {
++ !mingw {
++ fxc = $$qtConfFindInPath("fxc.exe")
++ } else {
++ dxdir = $$getenv("DXSDK_DIR")
++ winkitdir = $$getenv("WindowsSdkDir")
++ !isEmpty(dxdir) {
++ equals(QT_ARCH, x86_64): \
++ fxc = $$dxdir/Utilities/bin/x64/fxc.exe
++ else: \
++ fxc = $$dxdir/Utilities/bin/x86/fxc.exe
++ } else: !isEmpty(winkitdir) {
++ equals(QT_ARCH, x86_64): \
++ fxc = $$winkitdir/bin/x64/fxc.exe
++ else: \
++ fxc = $$winkitdir/bin/x86/fxc.exe
++
++ !exists($$fxc) {
++ binsubdirs = $$files($$winkitdir/bin/*)
++ for (dir, binsubdirs) {
++ equals(QT_ARCH, x86_64): \
++ finalBinDir = $$dir/x64
++ else: \
++ finalBinDir = $$dir/x86
++
++ fxc = $${finalBinDir}/fxc.exe
++ exists($$fxc) {
++ break()
++ }
++ }
++ }
++ }
++ }
++
++ !isEmpty(fxc):exists($$fxc) {
++ $${1}.value = $$fxc
++ export($${1}.value)
++ $${1}.cache += value
++ export($${1}.cache)
++ return(true)
++ }
++ return(false)
++}
++
+ defineTest(qtConfTest_xkbConfigRoot) {
+ qtConfTest_getPkgConfigVariable($${1}): return(true)
+
alvinhochun created this paste.Aug 2 2017, 5:33 PM
alvinhochun created this object in space S1 KDE Community.
alvinhochun edited the content of this paste. (Show Details)
alvinhochun edited the content of this paste. (Show Details)Aug 2 2017, 5:48 PM