diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-03-27 14:40:34 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-03-27 14:40:34 +0530 |
commit | 001cf52c3a10aa4d2b0db5ec008fb5d2160ce23e (patch) | |
tree | fdffc3df42e987632a9da67a643d643fcbc158e8 /mesonbuild/build.py | |
parent | 58131c05153f947c37362dba4248bdaca7ebcbfa (diff) | |
download | meson-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/build.py')
-rw-r--r-- | mesonbuild/build.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index c28a8a4..1f646dc 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -12,15 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +import copy, os, re +from collections import OrderedDict + from . import environment from . import dependencies from . import mlog -import copy, os, re from .mesonlib import File, MesonException from .mesonlib import flatten, stringlistify, classify_unity_sources from .mesonlib import get_filenames_templates_dict, substitute_values from .environment import for_windows, for_darwin -from .compilers import is_object, clike_langs, lang_suffixes +from .compilers import is_object, clike_langs, sort_clike, lang_suffixes known_basic_kwargs = {'install': True, 'c_pch': True, @@ -291,7 +293,7 @@ class BuildTarget(Target): self.is_unity = environment.coredata.get_builtin_option('unity') self.environment = environment self.sources = [] - self.compilers = {} + self.compilers = OrderedDict() self.objects = [] self.external_deps = [] self.include_dirs = [] @@ -444,6 +446,9 @@ class BuildTarget(Target): if lang not in self.compilers: self.compilers[lang] = compiler break + # Re-sort according to clike_langs + self.compilers = OrderedDict(sorted(self.compilers.items(), + key=lambda t: sort_clike(t[0]))) else: # No source files, target consists of only object files of unknown # origin. Just add the first clike compiler that we have and hope |