diff options
-rw-r--r-- | BuildTools/SCons/SConscript.boot | 1 | ||||
-rw-r--r-- | Swiften/SConscript | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot index 2415fde..babd585 100644 --- a/BuildTools/SCons/SConscript.boot +++ b/BuildTools/SCons/SConscript.boot @@ -96,12 +96,13 @@ vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccep vars.Add(BoolVariable("build_examples", "Build example programs", "yes")) vars.Add(BoolVariable("enable_variants", "Build in a separate dir under build/, depending on compile flags", "no")) vars.Add(BoolVariable("experimental_ft", "Build experimental file transfer", "yes")) vars.Add(BoolVariable("experimental", "Build experimental features", "no")) vars.Add(BoolVariable("set_iterator_debug_level", "Set _ITERATOR_DEBUG_LEVEL=0", "yes")) vars.Add(BoolVariable("unbound", "Build bundled ldns and unbound. Use them for DNS lookup.", "no")) +vars.Add(BoolVariable("check_headers", "Independently build compilation units for all Swiften headers for detecting missing dependencies.", "no")) vars.Add(BoolVariable("install_git_hooks", "Install git hooks", "true")) ################################################################################ # Set up default build & configure environment ################################################################################ diff --git a/Swiften/SConscript b/Swiften/SConscript index de71849..aff1478 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -1,7 +1,7 @@ -import os, re, Version, os.path, time +import os, re, Version, os.path, time, urllib Import("env") ################################################################################ # Flags ################################################################################ @@ -538,12 +538,13 @@ if env["SCONS_STAGE"] == "build" : # Generate the Swiften header def relpath(path, start) : i = len(os.path.commonprefix([path, start])) return path[i+1:] swiften_header = "#pragma once\n" swiften_includes = [] + swiften_public_includes = [] top_path = env.Dir("..").abspath for root, dirs, files in os.walk(env.Dir(".").abspath) : if root.endswith("UnitTest") : continue for file in files : if not file.endswith(".h") : @@ -565,22 +566,35 @@ if env["SCONS_STAGE"] == "build" : continue # Specific headers we don't want to globally include if file == "Swiften.h" or file == "foreach.h" or file == "Log.h" or file == "format.h" : continue swiften_header += "#include <" + include + ">\n" + swiften_public_includes.append(include) swiften_includes.append(include) swiften_env.WriteVal("Swiften.h", swiften_env.Value(swiften_header)) swiften_includes.append("Swiften/Swiften.h") version_header = "#pragma once\n\n" version_header += "#define SWIFTEN_VERSION 0x%02X%02X%02X\n" % (swiften_env["SWIFTEN_VERSION_MAJOR"], swiften_env["SWIFTEN_VERSION_MINOR"], swiften_env["SWIFTEN_VERSION_PATCH"]) version_header += "#define SWIFTEN_VERSION_STRING \"%s\"\n" % swiften_env["SWIFTEN_VERSION"] swiften_env.WriteVal("Version.h", swiften_env.Value(version_header)) swiften_includes.append("Swiften/Version.h") + # Check headers + if env["check_headers"] : + test_env = swiften_env.Clone() + for header in swiften_public_includes: + program_text = "#include <%s>\n" % (header) + filename = Dir('#/.sconf_temp').abspath + ("/%s.cpp" % (urllib.quote(header, '') )) + text_file = open(filename, "w") + text_file.write(program_text) + text_file.close() + test_obj = test_env.Object(File("#/.sconf_temp/%s.cpp" % (urllib.quote(header, '') ))) + test_env.Default(test_obj) + # Install swiften if swiften_env.get("SWIFTEN_INSTALLDIR", "") : swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib"), swiften_lib) for alias in myenv["SWIFTEN_LIBRARY_ALIASES"] : myenv.Command(myenv.File(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib", alias)), [env.Value(swiften_lib[0].name), swiften_lib[0]], symlink) for include in swiften_includes : |