From 1e5ca0c1fe156cd614cfbfce432c40eeadb893fd Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Wed, 29 Apr 2015 20:06:24 +0200 Subject: Ignore compiler warnings from 3rdParty libraries When compiling with Clang or GCC, include 3rdParty libraries as system headers and frameworks (-isystem and -f). Test-Information: Tested with Clang on OS X. Change-Id: I184221ddc4b34d30ee6ba66e202953619b5afd56 diff --git a/3rdParty/LibNATPMP/SConscript b/3rdParty/LibNATPMP/SConscript index 5d08698..273c2d2 100644 --- a/3rdParty/LibNATPMP/SConscript +++ b/3rdParty/LibNATPMP/SConscript @@ -9,10 +9,13 @@ if env.get("LIBNATPMP_BUNDLED", False) : if env["SCONS_STAGE"] == "flags" : env["HAVE_LIBNATPMP"] = True env["LIBNATPMP_FLAGS"] = { - "CPPPATH": [Dir("src/libnatpmp")], "LIBPATH": [Dir(".")], "INTERNAL_CPPDEFINES": ["STATICLIB"], } + if env["CC"] in ("clang", "gcc") : + env["LIBNATPMP_FLAGS"].update({"CPPFLAGS": ["-isystem" "3rdParty/LibNATPMP/src/libnatpmp"]}) + else : + env["LIBNATPMP_FLAGS"].update({"CPPPATH": [Dir("src/libnatpmp")]}) #if env["PLATFORM"] == "win32" : # env["LIBIDN_FLAGS"]["CPPPATH"] += [Dir("stubs/win32")] # if env["MSVC_VERSION"][:3] == "9.0" : diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index d314ff3..6813747 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -297,7 +297,11 @@ if env.get("try_libxml", True) and not env.get("HAVE_LIBXML", 0) : if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") : # and conf.CheckVersion("LibXML", "2.6.23", "LIBXML_VERSION", "libxml/xmlversion.h", 20623): env["HAVE_LIBXML"] = 1 - env["LIBXML_FLAGS"] = { "CPPPATH": ["/usr/include/libxml2"], "LIBS": ["xml2"] } + libxml_env.Append() + if env["CC"] in ("clang", "gcc"): + env["LIBXML_FLAGS"] = { "CXXFLAGS": ["-isystem/usr/include/libxml2"], "LIBS": ["xml2"] } + else: + env["LIBXML_FLAGS"] = { "CPPPATH": ["/usr/include/libxml2"], "LIBS": ["xml2"] } conf.Finish() # Expat diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py index ea86223..e019b2c 100644 --- a/BuildTools/SCons/Tools/qt4.py +++ b/BuildTools/SCons/Tools/qt4.py @@ -471,6 +471,12 @@ def enable_modules(self, modules, debug=False, crosscompiling=False, version='4' except: pass debugSuffix = '' + + include_flag = "-I" + if self["CC"] in ("gcc", "clang"): + include_flag = "-isystem" + + if sys.platform != "win32" and sys.platform != "darwin" and not crosscompiling : if self["qt"]: # The user specified qt path in config.py and we are going to use the @@ -544,7 +550,7 @@ def enable_modules(self, modules, debug=False, crosscompiling=False, version='4' if len(self["QTDIR"]) > 0 : self.AppendUnique(LIBPATH=[os.path.join('$QTDIR','lib')]) self.AppendUnique(LINKFLAGS="-F$QTDIR/lib") - self.AppendUnique(CPPFLAGS="-F$QTDIR/lib") + self.AppendUnique(CPPFLAGS="-iframework$QTDIR/lib") self.AppendUnique(LINKFLAGS="-L$QTDIR/lib") #TODO clean! # FIXME: Phonon Hack @@ -557,9 +563,9 @@ def enable_modules(self, modules, debug=False, crosscompiling=False, version='4' 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", version, "Headers")]) + self.Append(CPPFLAGS = [include_flag + os.path.join("$QTDIR", "lib", module + ".framework", "Versions", version, "Headers")]) else : - self.Append(CPPFLAGS = ["-I" + os.path.join("/Library/Frameworks", module + ".framework", "Versions", version, "Headers")]) + self.Append(CPPFLAGS = [include_flag + 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") -- cgit v0.10.2-6-g49f6