summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 64d6d1cd5..45caf55c3 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -48,13 +48,17 @@ lang_suffixes = {
all_languages = lang_suffixes.keys()
cpp_suffixes = lang_suffixes['cpp'] + ('h',)
c_suffixes = lang_suffixes['c'] + ('h',)
+# List of languages that by default consume and output libraries following the
+# C ABI; these can generally be used interchangebly
+clib_langs = ('objcpp', 'cpp', 'objc', 'c', 'fortran',)
# List of languages that can be linked with C code directly by the linker
# used in build.py:process_compilers() and build.py:get_dynamic_linker()
-clike_langs = ('d', 'objcpp', 'cpp', 'objc', 'c', 'fortran', )
-clike_suffixes = ()
-for _l in clike_langs + ('vala',):
- clike_suffixes += lang_suffixes[_l]
-clike_suffixes += ('h', 'll', 's')
+# XXX: Add Rust to this?
+clink_langs = ('d',) + clib_langs
+clink_suffixes = ()
+for _l in clink_langs + ('vala',):
+ clink_suffixes += lang_suffixes[_l]
+clink_suffixes += ('h', 'll', 's')
soregex = re.compile(r'.*\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$')
@@ -68,18 +72,18 @@ cflags_mapping = {'c': 'CFLAGS',
'vala': 'VALAFLAGS',
'rust': 'RUSTFLAGS'}
-# All these are only for C-like languages; see `clike_langs` above.
+# All these are only for C-linkable languages; see `clink_langs` above.
-def sort_clike(lang):
+def sort_clink(lang):
'''
Sorting function to sort the list of languages according to
- reversed(compilers.clike_langs) and append the unknown langs in the end.
+ reversed(compilers.clink_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 clike_langs:
+ if lang not in clink_langs:
return 1
- return -clike_langs.index(lang)
+ return -clink_langs.index(lang)
def is_header(fname):
if hasattr(fname, 'fname'):
@@ -91,7 +95,7 @@ def is_source(fname):
if hasattr(fname, 'fname'):
fname = fname.fname
suffix = fname.split('.')[-1].lower()
- return suffix in clike_suffixes
+ return suffix in clink_suffixes
def is_assembly(fname):
if hasattr(fname, 'fname'):