diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-03-09 01:20:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 01:20:57 +0200 |
commit | 5c51d4521ab37edce88c61fd5067c93a44078854 (patch) | |
tree | 51910cba73b3017087fc13b6bdb64afd3bd4e09e /mesonbuild/build.py | |
parent | 3a57e5177ba949cff5f971f7338a1c75a2724ac2 (diff) | |
parent | 48e5c1234ad4dd0438324ab8164f94d12a8c2218 (diff) | |
download | meson-5c51d4521ab37edce88c61fd5067c93a44078854.zip meson-5c51d4521ab37edce88c61fd5067c93a44078854.tar.gz meson-5c51d4521ab37edce88c61fd5067c93a44078854.tar.bz2 |
Merge pull request #6532 from jon-turney/languages-native-kwarg
Add add_languages(native:)
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 6755dca..61894fe 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -28,7 +28,7 @@ from .mesonlib import ( extract_as_list, typeslistify, stringlistify, classify_unity_sources, get_filenames_templates_dict, substitute_values, has_path_sep, unholder ) -from .compilers import Compiler, is_object, clink_langs, sort_clink, lang_suffixes +from .compilers import Compiler, is_object, clink_langs, sort_clink, lang_suffixes, is_known_suffix from .linkers import StaticLinker from .interpreterbase import FeatureNew @@ -651,14 +651,24 @@ class BuildTarget(Target): sources.append(s) if sources: # For each source, try to add one compiler that can compile it. - # It's ok if no compilers can do so, because users are expected to - # be able to add arbitrary non-source files to the sources list. + # + # If it has a suffix that belongs to a known language, we must have + # a compiler for that language. + # + # Otherwise, it's ok if no compilers can compile it, because users + # are expected to be able to add arbitrary non-source files to the + # sources list for s in sources: for lang, compiler in compilers.items(): if compiler.can_compile(s): if lang not in self.compilers: self.compilers[lang] = compiler break + else: + if is_known_suffix(s): + raise MesonException('No {} machine compiler for "{}"'. + format(self.for_machine.get_lower_case_name(), s)) + # Re-sort according to clink_langs self.compilers = OrderedDict(sorted(self.compilers.items(), key=lambda t: sort_clink(t[0]))) |