summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-07-24 15:44:39 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-08-11 09:53:41 (GMT)
commit1227b9d9b5ccfde57e9c7e946275907391d17ce1 (patch)
tree2305c0faa976556f085a845c36c28b206bc43a24 /Swiften
parent009e552f76e17570f2c09789949d3804a153d696 (diff)
downloadswift-1227b9d9b5ccfde57e9c7e946275907391d17ce1.zip
swift-1227b9d9b5ccfde57e9c7e946275907391d17ce1.tar.bz2
Add 'check_headers' flag to scons for missing include detection
Running './scons check_headers=1 will compile each header file as an object file. Test-Information: Tested on OS X 10.9.5 and Elementary OS 0.2. Change-Id: Ia429ccc6dc0a5bd76c08a2c2e91bf192c6ad2901
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/SConscript16
1 files changed, 15 insertions, 1 deletions
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)