diff options
Diffstat (limited to 'BuildTools/SCons/SConstruct')
-rw-r--r-- | BuildTools/SCons/SConstruct | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index a7e2bed..78f388b 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -7,9 +7,9 @@ root = Dir("../..").abspath # Override SConscript to handle tests oldSConscript = SConscript -def SConscript(*arguments, **keywords) : - if not keywords.get("test_only", False) or env["TEST"] : - return apply(oldSConscript, arguments, keywords) +def SConscript(*args, **kwargs) : + if not kwargs.get("test_only", False) or env["TEST"] : + return oldSConscript(*args, **kwargs) env.SConscript = SConscript ################################################################################ @@ -142,11 +142,11 @@ conf = Configure(conf_env, custom_tests = { }) if not conf.CheckCXX() or not conf.CheckCC() : - print "Error: You need a working compiler" + print("Error: You need a working compiler") Exit(1) if not conf.CheckCpp11Support() : - print "Error: You need a compiler with support for the C++11 standard" + print("Error: You need a compiler with support for the C++11 standard") Exit(1) @@ -170,7 +170,7 @@ if (not zlib_okay) and conf.CheckLib("z") : if zlib_okay : env["ZLIB_FLAGS"] = zlib_flags elif not env.get("zlib_bundled_enable", True) : - print "Error: Zlib not found and zlib_bundled_enable is false" + print("Error: Zlib not found and zlib_bundled_enable is false") Exit(1) else : env["ZLIB_BUNDLED"] = True @@ -238,10 +238,16 @@ if not env.get("boost_force_bundled") and allLibsPresent : # FIXME: Remove this workaround when UUID is available in most distros env["BOOST_BUNDLED_UUID_ONLY"] = True elif not env.get("boost_bundled_enable", True) : - print "Error: Boost not found and boost_bundled_enable is false" + print("Error: Boost not found and boost_bundled_enable is false") Exit(1) else : env["BOOST_BUNDLED"] = True +boost_version = GetVersion(conf, "BOOST_VERSION", "boost/version.hpp") +if boost_version == 106400 : + #Version 1.64 has some issues with the serialization of boost::optional, see https://svn.boost.org/trac10/ticket/13050 + env["BOOST_1_64_DETECTED"] = True +else: + env["BOOST_1_64_DETECTED"] = False conf.Finish() @@ -268,6 +274,9 @@ if env.get("try_gconf", True) and env["PLATFORM"] != "win32" and env["PLATFORM"] if conf.CheckPKG("gconf-2.0") : gconf_bare_env = Environment() gconf_bare_env.ParseConfig('pkg-config --cflags gconf-2.0 gobject-2.0 --libs gconf-2.0 gobject-2.0') + if os.path.basename(env["CXX"]).startswith(("g++", "clang++")) : + gconf_bare_env["CCFLAGS"] = [("-isystem" + ccflag) for ccflag in gconf_bare_env["CPPPATH"]] + gconf_bare_env["CPPPATH"] = [] gconf_flags = { "LIBS": gconf_bare_env["LIBS"], "CCFLAGS": gconf_bare_env["CCFLAGS"], @@ -280,7 +289,7 @@ if env.get("try_gconf", True) and env["PLATFORM"] != "win32" and env["PLATFORM"] env["GCONF_FLAGS"] = { "LIBS": gconf_env["LIBS"], "CCFLAGS": gconf_env["CCFLAGS"], - "CPPPATH": gconf_env["CPPPATH"], + "CPPPATH": gconf_env.get("CPPPATH", []), "CPPDEFINES": gconf_env.get("CPPDEFINES", []), } conf.Finish() @@ -364,7 +373,7 @@ if env.get("try_expat", True) and not env.get("HAVE_LIBXML",0) : # Bundled expat bundledExpat = False if not env.get("HAVE_EXPAT", 0) and not env.get("HAVE_LIBXML", 0) : - print "Expat or LibXML not found. Using bundled Expat" + print("Expat or LibXML not found. Using bundled Expat") SConscript("#/3rdParty/Expat/SConscript") env["HAVE_EXPAT"] = 1 env["EXPAT_BUNDLED"] = True @@ -415,10 +424,10 @@ if not env.get("HAVE_ICU", False) and not env.get("HAVE_LIBIDN", False) : env["HAVE_LIBIDN"] = 1 env["LIBIDN_BUNDLED"] = 1 elif env.get("need_idn", True): - print "Error: ICU and LIBIDN not found, and libidn_bundled_enable is false" + print("Error: ICU and LIBIDN not found, and libidn_bundled_enable is false") Exit(1) else: - print "Proceeding without an IDN library because need_idn was false. This will break all internal binaries" + print("Proceeding without an IDN library because need_idn was false. This will break all internal binaries") # Unbound if env["unbound"] : @@ -505,7 +514,7 @@ if not env.get("lua_force_bundled", False) and conf.CheckLibWithHeader(env["lua_ if lua_version > 0 : env["LUA_FLAGS"]["LUA_VERSION"] = str(lua_version // 100) + "." + str(lua_version % 100) else : - print "Warning: Unable to determine Lua version. Not installing Lua libraries." + print("Warning: Unable to determine Lua version. Not installing Lua libraries.") env["LUA_FLAGS"].update(lua_flags) else : env["LUA_BUNDLED"] = 1 @@ -545,6 +554,10 @@ conf.Finish() if env["qt"] : env["QTDIR"] = env["qt"] +if env["PLATFORM"] == "win32" : + systemIncludeFlag = "/I" +else: + systemIncludeFlag = "-isystem" ################################################################################ # TLS backend selection @@ -574,9 +587,9 @@ elif env.get("tls_backend") == "openssl" : openssl_include = env.get("openssl_include") openssl_libdir = env.get("openssl_libdir") if openssl_include: - openssl_flags = {"CPPPATH":[openssl_include]} + openssl_flags = { "CPPFLAGS": [systemIncludeFlag + openssl_include]} else: - openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] } + openssl_flags = { "CPPFLAGS": [systemIncludeFlag + os.path.join(openssl_prefix, "include")] } if openssl_libdir: openssl_flags["LIBPATH"] = [openssl_libdir] env["OPENSSL_DIR"] = openssl_prefix @@ -657,7 +670,7 @@ try : except SCons.Errors.StopError: env["HAVE_QT"] = False except Exception as e: - print "Info: %s" % str(e) + print("Info: %s" % str(e)) env["HAVE_QT"] = False ################################################################################ @@ -679,7 +692,7 @@ try: if not env.GetOption("clean") and env.get("install_git_hooks", True) : env.Install("#/.git/hooks", Glob("#/BuildTools/Git/Hooks/*")) except TypeError: - print "You seem to be using Swift in a Git submodule. Not installing hooks." + print("You seem to be using Swift in a Git submodule. Not installing hooks.") ################################################################################ @@ -694,6 +707,8 @@ if ARGUMENTS.get("replace_pragma_once", False) : return path[i+1:] for actual_root, dirs, files in os.walk(root) : + dirs.sort() + files.sort() if "3rdParty" in actual_root : continue for file in files : @@ -720,14 +735,14 @@ if ARGUMENTS.get("dump_trace", False) : # Modules modules = [] if os.path.isdir(Dir("#/3rdParty").abspath) : - for dir in os.listdir(Dir("#/3rdParty").abspath) : + for dir in sorted(os.listdir(Dir("#/3rdParty").abspath)) : full_dir = os.path.join(Dir("#/3rdParty").abspath, dir) if not os.path.isdir(full_dir) : continue sconscript = os.path.join(full_dir, "SConscript") if os.path.isfile(sconscript) : modules.append("3rdParty/" + dir) -for dir in os.listdir(Dir("#").abspath) : +for dir in sorted(os.listdir(Dir("#").abspath)) : full_dir = os.path.join(Dir("#").abspath, dir) if not os.path.isdir(full_dir) : continue @@ -743,7 +758,7 @@ modules.append("QA") env["PROJECTS"] = [m for m in modules if m not in ["Documentation", "QA", "SwifTools"] and not m.startswith("3rdParty")] for stage in ["flags", "build"] : env["SCONS_STAGE"] = stage - SConscript(dirs = map(lambda x : root + "/" + x, modules)) + SConscript(dirs = list(map(lambda x : root + "/" + x, modules))) # SLOCCount if ARGUMENTS.get("sloccount", False) : @@ -755,9 +770,9 @@ if ARGUMENTS.get("sloccount", False) : # Print summary ################################################################################ -print -print " Build Configuration" -print " -------------------" +print("") +print(" Build Configuration") +print(" -------------------") parsers = [] if env.get("HAVE_LIBXML", 0): @@ -766,15 +781,14 @@ if env.get("HAVE_EXPAT", 0): parsers.append("Expat") if env.get("EXPAT_BUNDLED", False) : parsers.append("(Bundled)") -print " Projects: " + ' '.join(env["PROJECTS"]) -print "" -print " XML Parsers: " + ' '.join(parsers) +print(" Projects: " + ' '.join(env["PROJECTS"])) +print("") +print(" XML Parsers: " + ' '.join(parsers)) -print " TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SECURETRANSPORT",0) and "Secure Transport" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled") -print " DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled")) -print +print(" TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SECURETRANSPORT",0) and "Secure Transport" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled")) +print(" DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled"))) +print("") if not GetOption("help") and not env.get("HAVE_OPENSSL", 0) and not env.get("HAVE_SCHANNEL", 0) and not env.get("HAVE_SECURETRANSPORT", 0): - print "Error: A working TLS backend is required. Please check the documentation for more information." + print("Error: A working TLS backend is required. Please check the documentation for more information.") Exit(1) - |