diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-06-08 19:10:52 (GMT) |
|---|---|---|
| committer | Kevin Smith <kevin.smith@isode.com> | 2015-06-14 15:03:54 (GMT) |
| commit | a510bfe657067999904a7ff8d2cabab7b8b508d2 (patch) | |
| tree | 5c1340bd3cd5d05581784db696e22083b931ee24 | |
| parent | 93248fdd5a4974a00c1dec6068950c61f58b84fe (diff) | |
| download | swift-a510bfe657067999904a7ff8d2cabab7b8b508d2.zip swift-a510bfe657067999904a7ff8d2cabab7b8b508d2.tar.bz2 | |
Fix SCons qt4 tool pkg-config detection
Correctly use pkg-config to test for Qt, if no qt path is specified
in config.py. 'Import(…)' at the top caused an error which was hidden
by try/catch at upper layer.
Test-Information:
Tested on Kubuntu 14.04, with and w/o qt path set and verified that
no exception is thrown if Qt is registered at pkg-config.
Change-Id: I82800c23e9f75bd5f6b136fe384a70165a92bb45
| -rw-r--r-- | BuildTools/SCons/Tools/qt4.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py index 1c82324..afa61de 100644 --- a/BuildTools/SCons/Tools/qt4.py +++ b/BuildTools/SCons/Tools/qt4.py | |||
| @@ -43,8 +43,7 @@ import SCons.Defaults | |||
| 43 | import SCons.Scanner | 43 | import SCons.Scanner |
| 44 | import SCons.Tool | 44 | import SCons.Tool |
| 45 | import SCons.Util | 45 | import SCons.Util |
| 46 | 46 | import SCons.SConf | |
| 47 | Import("conf_env") | ||
| 48 | 47 | ||
| 49 | class ToolQtWarning(SCons.Warnings.Warning): | 48 | class ToolQtWarning(SCons.Warnings.Warning): |
| 50 | pass | 49 | pass |
| @@ -504,20 +503,18 @@ def enable_modules(self, modules, debug=False, crosscompiling=False, version='4' | |||
| 504 | self["QT4_MOCCPPPATH"] = self["CPPPATH"] | 503 | self["QT4_MOCCPPPATH"] = self["CPPPATH"] |
| 505 | return | 504 | return |
| 506 | else: | 505 | else: |
| 507 | test_env = self.Clone() | 506 | test_conf = self.Configure() |
| 508 | test_conf = Configure(test_env) | ||
| 509 | modules_str = " ".join(modules) | 507 | modules_str = " ".join(modules) |
| 510 | if not version == '4' : | 508 | if not version == '4' : |
| 511 | modules_str = modules_str.replace('Qt', 'Qt5') | 509 | modules_str = modules_str.replace('Qt', 'Qt5') |
| 512 | 510 | ||
| 513 | # Check if Qt is registed at pkg-config | 511 | # Check if Qt is registered at pkg-config |
| 514 | ret = test_conf.TryAction('pkg-config --exists \'%s\'' % modules_str)[0] | 512 | ret = test_conf.TryAction('pkg-config --exists \'%s\'' % modules_str)[0] |
| 515 | test_conf.Result( ret ) | 513 | if ret != 1: |
| 516 | if not ret: | 514 | raise Exception("Qt has not been found using pkg-config.") |
| 517 | print("Qt not found.") | ||
| 518 | return | 515 | return |
| 519 | test_env.ParseConfig("pkg-config --cflags --libs " + modules_str) | 516 | test_conf.env.ParseConfig("pkg-config --cflags --libs " + modules_str) |
| 520 | self.AppendUnique(LIBS=test_env["LIBS"], LIBPATH=test_env["LIBPATH"], CPPPATH=test_env["CPPPATH"]) | 517 | self.AppendUnique(LIBS=test_conf.env["LIBS"], LIBPATH=test_conf.env["LIBPATH"], CPPPATH=test_conf.env["CPPPATH"]) |
| 521 | self["QT4_MOCCPPPATH"] = self["CPPPATH"] | 518 | self["QT4_MOCCPPPATH"] = self["CPPPATH"] |
| 522 | return | 519 | return |
| 523 | 520 | ||
Swift