diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-06-15 10:49:20 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-06-15 13:13:06 +0530 |
commit | abf81aab7769adbe853d47984cc77d90d578574d (patch) | |
tree | be1b559cbed184523069e3ef333544808ff3e974 /mesonbuild/interpreter.py | |
parent | 777c1e9c199fe641c5b9b3111d558f1cc9770288 (diff) | |
download | meson-abf81aab7769adbe853d47984cc77d90d578574d.zip meson-abf81aab7769adbe853d47984cc77d90d578574d.tar.gz meson-abf81aab7769adbe853d47984cc77d90d578574d.tar.bz2 |
Use cross-info c_args, c_link_args, etc for all compiler checks
This allows the user to specify custom arguments to the compiler to be used
while performing cross-compiler checks. For example, passing a GCC specs file as
c_link_args so that a "prefix" filled with libraries that are to be compiled
against can be found with cc.find_library, or an `-mcpu` c_arg that is required
for compilation.
Also ensure that unix_link_flags_to_native() and unix_compile_flags_to_native()
always return a copy of the original arguments and not a reference to the
original arguments. We never want to modify the original arguments.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 53d7b10..a779e99 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -624,7 +624,7 @@ class CompilerHolder(InterpreterObject): if not isinstance(testname, str): raise InterpreterException('Testname argument must be a string.') extra_args = self.determine_args(kwargs) - result = self.compiler.run(code, extra_args) + result = self.compiler.run(code, self.environment, extra_args) if len(testname) > 0: if not result.compiled: h = mlog.red('DID NOT COMPILE') @@ -648,7 +648,7 @@ class CompilerHolder(InterpreterObject): if not isinstance(prefix, str): raise InterpreterException('Prefix argument of has_function must be a string.') extra_args = self.determine_args(kwargs) - had = self.compiler.has_member(typename, membername, prefix, extra_args) + had = self.compiler.has_member(typename, membername, prefix, self.environment, extra_args) if had: hadtxt = mlog.green('YES') else: @@ -683,7 +683,7 @@ class CompilerHolder(InterpreterObject): if not isinstance(prefix, str): raise InterpreterException('Prefix argument of has_type must be a string.') extra_args = self.determine_args(kwargs) - had = self.compiler.has_type(typename, prefix, extra_args) + had = self.compiler.has_type(typename, prefix, self.environment, extra_args) if had: hadtxt = mlog.green('YES') else: @@ -713,7 +713,7 @@ class CompilerHolder(InterpreterObject): if not isinstance(testname, str): raise InterpreterException('Testname argument must be a string.') extra_args = self.determine_args(kwargs) - result = self.compiler.compiles(code, extra_args) + result = self.compiler.compiles(code, self.environment, extra_args) if len(testname) > 0: if result: h = mlog.green('YES') @@ -731,7 +731,7 @@ class CompilerHolder(InterpreterObject): if not isinstance(testname, str): raise InterpreterException('Testname argument must be a string.') extra_args = self.determine_args(kwargs) - result = self.compiler.links(code, extra_args) + result = self.compiler.links(code, self.environment, extra_args) if len(testname) > 0: if result: h = mlog.green('YES') @@ -746,7 +746,7 @@ class CompilerHolder(InterpreterObject): check_stringlist(args) string = args[0] extra_args = self.determine_args(kwargs) - haz = self.compiler.has_header(string, extra_args) + haz = self.compiler.has_header(string, self.environment, extra_args) if haz: h = mlog.green('YES') else: @@ -764,7 +764,7 @@ class CompilerHolder(InterpreterObject): if not isinstance(prefix, str): raise InterpreterException('Prefix argument of has_function must be a string.') extra_args = self.determine_args(kwargs) - haz = self.compiler.has_header_symbol(hname, symbol, prefix, extra_args) + haz = self.compiler.has_header_symbol(hname, symbol, prefix, self.environment, extra_args) if haz: h = mlog.green('YES') else: @@ -785,7 +785,7 @@ class CompilerHolder(InterpreterObject): for i in search_dirs: if not os.path.isabs(i): raise InvalidCode('Search directory %s is not an absolute path.' % i) - linkargs = self.compiler.find_library(libname, search_dirs) + linkargs = self.compiler.find_library(libname, self.environment, search_dirs) if required and linkargs is None: raise InterpreterException('Library {} not found'.format(libname)) lib = dependencies.ExternalLibrary(libname, linkargs) @@ -795,7 +795,7 @@ class CompilerHolder(InterpreterObject): args = mesonlib.stringlistify(args) if len(args) != 1: raise InterpreterException('Has_arg takes exactly one argument.') - result = self.compiler.has_argument(args[0]) + result = self.compiler.has_argument(args[0], self.environment) if result: h = mlog.green('YES') else: @@ -805,7 +805,7 @@ class CompilerHolder(InterpreterObject): def first_supported_argument_method(self, args, kwargs): for i in mesonlib.stringlistify(args): - if self.compiler.has_argument(i): + if self.compiler.has_argument(i, self.environment): mlog.log('First supported argument:', mlog.bold(i)) return [i] mlog.log('First supported argument:', mlog.red('None')) |