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 @@ -99,6 +99,7 @@ vars.Add(BoolVariable("experimental_ft", "Build experimental file transfer", "ye 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")) diff --git a/Swiften/SConscript b/Swiften/SConscript index de71849..aff1478 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -1,4 +1,4 @@ -import os, re, Version, os.path, time +import os, re, Version, os.path, time, urllib Import("env") @@ -541,6 +541,7 @@ if env["SCONS_STAGE"] == "build" : 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") : @@ -568,6 +569,7 @@ if env["SCONS_STAGE"] == "build" : 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") @@ -578,6 +580,18 @@ if env["SCONS_STAGE"] == "build" : 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) |