diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-07-24 15:44:39 (GMT) |
|---|---|---|
| committer | Kevin Smith <kevin.smith@isode.com> | 2015-08-11 09:53:41 (GMT) |
| commit | 1227b9d9b5ccfde57e9c7e946275907391d17ce1 (patch) | |
| tree | 2305c0faa976556f085a845c36c28b206bc43a24 /Swiften | |
| parent | 009e552f76e17570f2c09789949d3804a153d696 (diff) | |
| download | swift-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/SConscript | 16 |
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 @@ | |||
| 1 | import os, re, Version, os.path, time | 1 | import os, re, Version, os.path, time, urllib |
| 2 | 2 | ||
| 3 | Import("env") | 3 | Import("env") |
| 4 | 4 | ||
| @@ -541,6 +541,7 @@ if env["SCONS_STAGE"] == "build" : | |||
| 541 | return path[i+1:] | 541 | return path[i+1:] |
| 542 | swiften_header = "#pragma once\n" | 542 | swiften_header = "#pragma once\n" |
| 543 | swiften_includes = [] | 543 | swiften_includes = [] |
| 544 | swiften_public_includes = [] | ||
| 544 | top_path = env.Dir("..").abspath | 545 | top_path = env.Dir("..").abspath |
| 545 | for root, dirs, files in os.walk(env.Dir(".").abspath) : | 546 | for root, dirs, files in os.walk(env.Dir(".").abspath) : |
| 546 | if root.endswith("UnitTest") : | 547 | if root.endswith("UnitTest") : |
| @@ -568,6 +569,7 @@ if env["SCONS_STAGE"] == "build" : | |||
| 568 | if file == "Swiften.h" or file == "foreach.h" or file == "Log.h" or file == "format.h" : | 569 | if file == "Swiften.h" or file == "foreach.h" or file == "Log.h" or file == "format.h" : |
| 569 | continue | 570 | continue |
| 570 | swiften_header += "#include <" + include + ">\n" | 571 | swiften_header += "#include <" + include + ">\n" |
| 572 | swiften_public_includes.append(include) | ||
| 571 | swiften_includes.append(include) | 573 | swiften_includes.append(include) |
| 572 | swiften_env.WriteVal("Swiften.h", swiften_env.Value(swiften_header)) | 574 | swiften_env.WriteVal("Swiften.h", swiften_env.Value(swiften_header)) |
| 573 | swiften_includes.append("Swiften/Swiften.h") | 575 | swiften_includes.append("Swiften/Swiften.h") |
| @@ -578,6 +580,18 @@ if env["SCONS_STAGE"] == "build" : | |||
| 578 | swiften_env.WriteVal("Version.h", swiften_env.Value(version_header)) | 580 | swiften_env.WriteVal("Version.h", swiften_env.Value(version_header)) |
| 579 | swiften_includes.append("Swiften/Version.h") | 581 | swiften_includes.append("Swiften/Version.h") |
| 580 | 582 | ||
| 583 | # Check headers | ||
| 584 | if env["check_headers"] : | ||
| 585 | test_env = swiften_env.Clone() | ||
| 586 | for header in swiften_public_includes: | ||
| 587 | program_text = "#include <%s>\n" % (header) | ||
| 588 | filename = Dir('#/.sconf_temp').abspath + ("/%s.cpp" % (urllib.quote(header, '') )) | ||
| 589 | text_file = open(filename, "w") | ||
| 590 | text_file.write(program_text) | ||
| 591 | text_file.close() | ||
| 592 | test_obj = test_env.Object(File("#/.sconf_temp/%s.cpp" % (urllib.quote(header, '') ))) | ||
| 593 | test_env.Default(test_obj) | ||
| 594 | |||
| 581 | # Install swiften | 595 | # Install swiften |
| 582 | if swiften_env.get("SWIFTEN_INSTALLDIR", "") : | 596 | if swiften_env.get("SWIFTEN_INSTALLDIR", "") : |
| 583 | swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib"), swiften_lib) | 597 | swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib"), swiften_lib) |
Swift