aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interpreter.py22
-rwxr-xr-xrun_cross_test.py4
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.')