aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-03-27 14:40:34 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-03-27 14:40:34 +0530
commit001cf52c3a10aa4d2b0db5ec008fb5d2160ce23e (patch)
treefdffc3df42e987632a9da67a643d643fcbc158e8 /mesonbuild/interpreter.py
parent58131c05153f947c37362dba4248bdaca7ebcbfa (diff)
downloadmeson-001cf52c3a10aa4d2b0db5ec008fb5d2160ce23e.zip
meson-001cf52c3a10aa4d2b0db5ec008fb5d2160ce23e.tar.gz
meson-001cf52c3a10aa4d2b0db5ec008fb5d2160ce23e.tar.bz2
Try even harder to use the C compiler for assembly
Now as long as you have a C compiler available in the project, it will be used to compile assembly even if the target contains a C++ compiler and even if the target contains only assembly and C++ sources. Earlier, the order in which sources appeared in a target would decide which compiler would be used. However, if the project only provides a C++ compiler, that will be used for compiling assembly sources. If this breaks your use-case, please tell us. Includes a test that ensures that all of the above is adhered to.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 550e2f9..198c758 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1752,22 +1752,10 @@ class Interpreter(InterpreterBase):
self.coredata.compiler_options = new_options
return comp, cross_comp
- @staticmethod
- def sort_clike(lang):
- '''
- Sorting function to sort the list of languages according to
- reversed(compilers.clike_langs) and append the unknown langs in the end.
- The purpose is to prefer C over C++ for files that can be compiled by
- both such as assembly, C, etc. Also applies to ObjC, ObjC++, etc.
- '''
- if lang not in compilers.clike_langs:
- return 1
- return -compilers.clike_langs.index(lang)
-
def add_languages(self, args, required):
success = True
need_cross_compiler = self.environment.is_cross_build() and self.environment.cross_info.need_cross_compiler()
- for lang in sorted(args, key=self.sort_clike):
+ for lang in sorted(args, key=compilers.sort_clike):
lang = lang.lower()
if lang in self.coredata.compilers:
comp = self.coredata.compilers[lang]