From c651cda1d427fe441f6acbd94952705efd218dd1 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Thu, 8 Aug 2013 15:09:41 +0100
Subject: Package necessary plugins for qt5 on Windows

Change-Id: Icfcf31668a3bcba687885aab0e548a8b42c30773

diff --git a/BuildTools/SCons/Tools/WindowsBundle.py b/BuildTools/SCons/Tools/WindowsBundle.py
index 2c0b3a4..aac1c32 100644
--- a/BuildTools/SCons/Tools/WindowsBundle.py
+++ b/BuildTools/SCons/Tools/WindowsBundle.py
@@ -1,15 +1,16 @@
 import SCons.Util, os
 
 def generate(env) :
-  def createWindowsBundle(env, bundle, resources = {}, qtimageformats = [], qtlibs = [], qtversion = '4') :
+  def createWindowsBundle(env, bundle, resources = {}, qtimageformats = [], qtlibs = [], qtplatforms = [], qtversion = '4') :
     all_files = []
     all_files += env.Install(bundle, bundle + ".exe")
     for lib in qtlibs :
       all_files += env.Install(bundle, os.path.join(env["QTDIR"], "bin", lib + ".dll"))
-    imageformats_suffix = '4'
+    plugins_suffix = '4'
     if qtversion == '5' :
-      imageformats_suffix = ''
-    all_files += env.Install(os.path.join(bundle, "imageformats"), [os.path.join(env["QTDIR"], "plugins", "imageformats", "q" + codec + imageformats_suffix + ".dll") for codec in qtimageformats])
+      plugins_suffix = ''
+    all_files += env.Install(os.path.join(bundle, "imageformats"), [os.path.join(env["QTDIR"], "plugins", "imageformats", "q" + codec + plugins_suffix + ".dll") for codec in qtimageformats])
+    all_files += env.Install(os.path.join(bundle, "platforms"), [os.path.join(env["QTDIR"], "plugins", "platforms", "q" + platform + plugins_suffix + ".dll") for platform in qtplatforms])
 
     for dir, resourceFiles in resources.items() :
       for resource in resourceFiles :
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index ae674f3..42de762 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -73,7 +73,7 @@ myenv.EnableQt4Modules(qt4modules, debug = False, version = qt_version)
 myenv.Append(CPPPATH = ["."])
 
 if env["PLATFORM"] == "win32" :
-  #myenv["LINKFLAGS"] = ["/SUBSYSTEM:CONSOLE"]
+  #myenv.Append(LINKFLAGS = ["/SUBSYSTEM:CONSOLE"])
   myenv.Append(LINKFLAGS = ["/SUBSYSTEM:WINDOWS"])
   myenv.Append(LIBS = "qtmain")
   if myenv.get("HAVE_SCHANNEL", 0) :
@@ -369,6 +369,7 @@ if env["PLATFORM"] == "win32" :
       commonResources[""] = commonResources.get("", []) + ["#/Swiften/${SWIFTEN_LIBRARY_FILE}"]
     qtimageformats = ["gif", "ico", "jpeg", "mng", "svg", "tiff"]
     qtlibs = ["QtCore", "QtGui", "QtNetwork", "QtWebKit", "QtXMLPatterns"]
+    qtplatforms = []
     if qt_version == '4' :
       qtlibs.append("phonon")
       qtlibs = [lib + '4' for lib in qtlibs]
@@ -376,10 +377,12 @@ if env["PLATFORM"] == "win32" :
       qtlibs += ['QtQuick', 'QtQml', 'QtV8', 'QtMultimedia', 'QtSql', 'QtSensors', 'QtWidgets', 'QtWebKitWidgets', 'QtMultimediaWidgets', 'QtOpenGL', 'QtPrintSupport']
       qtlibs = [lib.replace('Qt', 'Qt5') for lib in qtlibs]
       qtlibs += ['icuin51', 'icuuc51', 'icudt51', 'libGLESv2', 'libEGL']
+      qtplatforms = ['windows']
     windowsBundleFiles = myenv.WindowsBundle("Swift", 
       resources = commonResources,
       qtimageformats = qtimageformats,
       qtlibs = qtlibs,
+      qtplatforms = qtplatforms,
 			qtversion = qt_version)
 
   if env["DIST"] :
-- 
cgit v0.10.2-6-g49f6