diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-08-30 23:43:27 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-08-30 23:43:27 +0300 |
commit | 845eda2938f67cae3b7bccf813b994441a2c8a5d (patch) | |
tree | 75a0da812bd5257ac5d40279fe81977bbf0b9352 | |
parent | c3640ef03648bf79a39029e851970073063b46ac (diff) | |
download | meson-845eda2938f67cae3b7bccf813b994441a2c8a5d.zip meson-845eda2938f67cae3b7bccf813b994441a2c8a5d.tar.gz meson-845eda2938f67cae3b7bccf813b994441a2c8a5d.tar.bz2 |
Better build type introspection.
-rw-r--r-- | interpreter.py | 22 | ||||
-rwxr-xr-x | run_cross_test.py | 4 |
2 files changed, 21 insertions, 5 deletions
diff --git a/interpreter.py b/interpreter.py index e0adca3..9cf45a1 100644 --- a/interpreter.py +++ b/interpreter.py @@ -798,17 +798,33 @@ class MesonMain(InterpreterObject): def __init__(self, build): InterpreterObject.__init__(self) self.build = build - self.methods.update({'get_compiler': self.get_compiler_method}) + self.methods.update({'get_compiler': self.get_compiler_method, + 'is_cross_build' : self.is_cross_build_method, + }) + + def is_cross_build_method(self, args, kwargs): + return self.build.environment.is_cross_build() def get_compiler_method(self, args, kwargs): if len(args) != 1: raise InterpreterException('get_compiler_method must have one and only one argument.') cname = args[0] - for c in self.build.compilers: + native = kwargs.get('native', None) + if native is None: + if self.build.environment.is_cross_build(): + native = False + else: + native = True + if not isinstance(native, bool): + raise InterpreterException('Type of "native" must be a boolean.') + if native: + clist = self.build.compilers + else: + clist = self.build.cross_compilers + for c in clist: if c.get_language() == cname: return CompilerHolder(c, self.build.environment) raise InterpreterException('Tried to access compiler for unspecified language "%s".' % cname) - class Interpreter(): diff --git a/run_cross_test.py b/run_cross_test.py index 6e639cd..c479eaf 100755 --- a/run_cross_test.py +++ b/run_cross_test.py @@ -31,8 +31,8 @@ test_build_dir = 'work area' install_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], 'install dir') meson_command = './meson.py' -#extra_flags = ['--cross-file', 'cross/ubuntu-armhf.txt'] -extra_flags = ['--cross-file', 'cross/ubuntu-mingw.txt'] +extra_flags = ['--cross-file', 'cross/ubuntu-armhf.txt'] +#extra_flags = ['--cross-file', 'cross/ubuntu-mingw.txt'] ninja_command = environment.detect_ninja() if ninja_command is None: raise RuntimeError('Could not find Ninja executable.') |