summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2013-03-04 13:23:10 (GMT)
committerRemko Tronçon <git@el-tramo.be>2013-03-04 16:03:53 (GMT)
commitca7a45a25c2fe332fad1ee3f7a2822415c249206 (patch)
tree268c6d37f087935a307061f9d5ef507ddd5162cf /BuildTools/SCons
parent836925a5cdc7017da7fb84416c803e652b48e399 (diff)
downloadswift-contrib-ca7a45a25c2fe332fad1ee3f7a2822415c249206.zip
swift-contrib-ca7a45a25c2fe332fad1ee3f7a2822415c249206.tar.bz2
Qt5 support & warning fixes.
Change-Id: I62c7d5ca44c915e36c797c798294b7c34b465514
Diffstat (limited to 'BuildTools/SCons')
-rw-r--r--BuildTools/SCons/SConscript.boot7
-rw-r--r--BuildTools/SCons/Tools/qt4.py30
2 files changed, 25 insertions, 12 deletions
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 4f68b1b..a8b7446 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -54,6 +54,7 @@ vars.Add("sqlite_force_bundled", "Force use of the bundled SQLite", None)
vars.Add(PathVariable("avahi_includedir", "Avahi headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("avahi_libdir", "Avahi library location", None, PathVariable.PathAccept))
vars.Add(PathVariable("qt", "Qt location", "", PathVariable.PathAccept))
+vars.Add(BoolVariable("qt5", "Compile in Qt5 mode", "no")) # TODO: auto-detect this
vars.Add(PathVariable("docbook_xml", "DocBook XML", None, PathVariable.PathAccept))
vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccept))
vars.Add(BoolVariable("build_examples", "Build example programs", "yes"))
@@ -117,7 +118,9 @@ if env["PLATFORM"] == "darwin" :
env["CCFLAGS"] = ["-arch", "x86_64"]
if "cxx" not in env :
env["CXX"] = "clang++"
- env["CXXFLAGS"] = ["-std=c++11"]
+ # Compiling Qt5 in C++0x mode includes headers that we don't have
+ if not env["qt5"] :
+ env["CXXFLAGS"] = ["-std=c++11"]
if "link" not in env :
env["LINK"] = "clang"
if platform.machine() == "x86_64" :
@@ -237,7 +240,7 @@ else :
"-Wno-global-constructors", # We depend on this for e.g. string constants
"-Wno-disabled-macro-expansion", # Caused due to system headers
"-Wno-c++11-extensions", # We use C++11; turn this off when we use -std=c++11
- "-Wno-pedantic", # Fix these when we have time
+ "-Wno-long-long", # We use long long
"-Wno-padded",
])
else :
diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py
index 671fd08..8e174c0 100644
--- a/BuildTools/SCons/Tools/qt4.py
+++ b/BuildTools/SCons/Tools/qt4.py
@@ -286,9 +286,9 @@ def generate(env):
# Commands for the qt support ...
QT4_UICCOM = '$QT4_UIC $QT4_UICFLAGS -o $TARGET $SOURCE',
- # FIXME: The -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED flag is a hack to work
- # around an issue in Qt
- # See https://bugreports.qt-project.org/browse/QTBUG-22829
+ # FIXME: The -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED flag is a hack to work
+ # around an issue in Qt
+ # See https://bugreports.qt-project.org/browse/QTBUG-22829
QT4_MOCFROMHCOM = '$QT4_MOC -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED $QT4_MOCFROMHFLAGS $QT4_MOCINCFLAGS -o $TARGET $SOURCE',
QT4_MOCFROMCXXCOM = [
'$QT4_MOC -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED $QT4_MOCFROMCXXFLAGS $QT4_MOCINCFLAGS -o $TARGET $SOURCE',
@@ -395,7 +395,7 @@ def generate(env):
# TODO: Does dbusxml2cpp need an adapter
env.AddMethod(enable_modules, "EnableQt4Modules")
-def enable_modules(self, modules, debug=False, crosscompiling=False) :
+def enable_modules(self, modules, debug=False, crosscompiling=False, version='4') :
import sys
validModules = [
@@ -420,6 +420,11 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
'QtWebKit',
'QtHelp',
'QtScript',
+
+ # Qt5 modules
+ 'QtWidgets',
+ 'QtMultimedia',
+ 'QtWebKitWidgets',
]
staticModules = [
'QtUiTools',
@@ -440,6 +445,8 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
'QtXml' : ['QT_XML_LIB'],
'QtOpenGL' : ['QT_OPENGL_LIB'],
'QtGui' : ['QT_GUI_LIB'],
+ 'QtWidgets' : ['QT_WIDGETS_LIB'],
+ 'QtWebKitWidgets' : [],
'QtNetwork' : ['QT_NETWORK_LIB'],
'QtCore' : ['QT_CORE_LIB'],
}
@@ -450,7 +457,8 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
if sys.platform.startswith("linux") and not crosscompiling :
if debug : debugSuffix = '_debug'
- self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include", "phonon")])
+ if version == '4' :
+ self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include", "phonon")])
for module in modules :
self.AppendUnique(LIBS=[module+debugSuffix])
self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")])
@@ -472,8 +480,9 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
modules.remove("QtAssistant")
modules.append("QtAssistantClient")
# FIXME: Phonon Hack
- self.AppendUnique(LIBS=['phonon'+debugSuffix+'4'])
- self.AppendUnique(LIBS=[lib+debugSuffix+'4' for lib in modules if lib not in staticModules])
+ if version == '4' :
+ self.AppendUnique(LIBS=['phonon'+debugSuffix+version])
+ self.AppendUnique(LIBS=[lib+debugSuffix+version for lib in modules if lib not in staticModules])
self.PrependUnique(LIBS=[lib+debugSuffix for lib in modules if lib in staticModules])
if 'QtOpenGL' in modules:
self.AppendUnique(LIBS=['opengl32'])
@@ -498,7 +507,8 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
self.AppendUnique(LINKFLAGS="-L$QTDIR/lib") #TODO clean!
# FIXME: Phonon Hack
- self.Append(LINKFLAGS=['-framework', "phonon"])
+ if version == '4' :
+ self.Append(LINKFLAGS=['-framework', "phonon"])
for module in modules :
if module in staticModules :
@@ -506,9 +516,9 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")])
else :
if len(self["QTDIR"]) > 0 :
- self.Append(CPPFLAGS = ["-I" + os.path.join("$QTDIR", "lib", module + ".framework", "Versions", "4", "Headers")])
+ self.Append(CPPFLAGS = ["-I" + os.path.join("$QTDIR", "lib", module + ".framework", "Versions", version, "Headers")])
else :
- self.Append(CPPFLAGS = ["-I" + os.path.join("/Library/Frameworks", module + ".framework", "Versions", "4", "Headers")])
+ self.Append(CPPFLAGS = ["-I" + os.path.join("/Library/Frameworks", module + ".framework", "Versions", version, "Headers")])
self.Append(LINKFLAGS=['-framework', module])
if 'QtOpenGL' in modules:
self.AppendUnique(LINKFLAGS="-F/System/Library/Frameworks")