aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/compilers/cs.py2
-rw-r--r--mesonbuild/compilers/java.py2
-rw-r--r--mesonbuild/compilers/swift.py2
-rw-r--r--mesonbuild/mesonlib.py4
-rw-r--r--mesonbuild/mintro.py68
5 files changed, 41 insertions, 37 deletions
diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py
index a6c74d2..95b1603 100644
--- a/mesonbuild/compilers/cs.py
+++ b/mesonbuild/compilers/cs.py
@@ -82,7 +82,7 @@ class CsCompiler(Compiler):
def get_std_exe_link_args(self):
return []
- def get_include_args(self, path):
+ def get_include_args(self, path, is_system):
return []
def get_pic_args(self):
diff --git a/mesonbuild/compilers/java.py b/mesonbuild/compilers/java.py
index 978562c..686d2e0 100644
--- a/mesonbuild/compilers/java.py
+++ b/mesonbuild/compilers/java.py
@@ -63,7 +63,7 @@ class JavaCompiler(Compiler):
def get_std_exe_link_args(self):
return []
- def get_include_args(self, path):
+ def get_include_args(self, path, is_system):
return []
def get_pic_args(self):
diff --git a/mesonbuild/compilers/swift.py b/mesonbuild/compilers/swift.py
index 4d5dd0c..c156541 100644
--- a/mesonbuild/compilers/swift.py
+++ b/mesonbuild/compilers/swift.py
@@ -85,7 +85,7 @@ class SwiftCompiler(Compiler):
def build_rpath_args(self, *args):
return [] # FIXME
- def get_include_args(self, dirname):
+ def get_include_args(self, dirname, is_system):
return ['-I' + dirname]
def get_compile_only_args(self):
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 98c2366..ef02940 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -268,10 +268,12 @@ class File:
def relative_name(self):
return os.path.join(self.subdir, self.fname)
-def get_compiler_for_source(compilers, src):
+def get_compiler_for_source(compilers, src, canfail=False):
for comp in compilers:
if comp.can_compile(src):
return comp
+ if canfail:
+ return None
raise MesonException('No specified compiler can handle file {!s}'.format(src))
def classify_unity_sources(compilers, sources):
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 9af9c6c..b6c00ec 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -183,10 +183,12 @@ def list_targets(coredata, builddata, installdata):
comp_list = target.compilers.values()
source_list = target.sources + target.extra_files
- source_list = list(map(lambda x: (mesonlib.get_compiler_for_source(comp_list, x), x), source_list))
+ source_list = list(map(lambda x: (mesonlib.get_compiler_for_source(comp_list, x, True), x), source_list))
for comp, src in source_list:
- if isinstance(comp, compilers.Compiler) and isinstance(src, mesonlib.File):
+ if isinstance(src, mesonlib.File):
+ src = os.path.join(src.subdir, src.fname)
+ if isinstance(comp, compilers.Compiler) and isinstance(src, str):
lang = comp.get_language()
if lang not in sources:
parameters = []
@@ -208,7 +210,21 @@ def list_targets(coredata, builddata, installdata):
'source_files': []
}
- sources[lang]['source_files'] += [os.path.join(src.subdir, src.fname)]
+ sources[lang]['source_files'] += [src]
+ elif comp is None and isinstance(src, str):
+ if 'unknown' not in sources:
+ sources['unknown'] = {'compiler': [], 'parameters': [], 'source_files': []}
+ sources['unknown']['source_files'] += [src]
+ elif isinstance(target, build.CustomTarget):
+ source_list_raw = target.sources + target.extra_files
+ source_list = []
+ for i in source_list_raw:
+ if isinstance(i, mesonlib.File):
+ source_list += [os.path.join(i.subdir, i.fname)]
+ elif isinstance(i, str):
+ source_list += [i]
+
+ sources['unknown'] = {'compiler': [], 'parameters': [], 'source_files': source_list}
# Convert the dict to a list and add the language key.
# This list approach will also work if the gurantee is removed that all
@@ -245,21 +261,6 @@ def list_targets(coredata, builddata, installdata):
tlist.append(t)
return ('targets', tlist)
-<<<<<<< HEAD
-def list_target_files(target_name, coredata, builddata):
- try:
- t = builddata.targets[target_name]
- sources = t.sources + t.extra_files
- except KeyError:
- print("Unknown target %s." % target_name)
- sys.exit(1)
- out = []
- for i in sources:
- if isinstance(i, mesonlib.File):
- i = os.path.join(i.subdir, i.fname)
- out.append(i)
- return ('target_files', out)
-
class BuildoptionsOptionHelper:
# mimic an argparse namespace
def __init__(self, cross_file):
@@ -406,22 +407,23 @@ def list_buildoptions_from_source(sourcedir, backend):
# Reenable logging just in case
mlog.enable()
list_buildoptions(intr.coredata)
-=======
+
def list_target_files(target_name, targets):
- return ('error: TODO implement', [])
- #try:
- # t = builddata.targets[target_name]
- # sources = t.sources + t.extra_files
- #except KeyError:
- # print("Unknown target %s." % target_name)
- # sys.exit(1)
- #out = []
- #for i in sources:
- # if isinstance(i, mesonlib.File):
- # i = os.path.join(i.subdir, i.fname)
- # out.append(i)
- #return ('target_files', out)
->>>>>>> More refactoring
+ result = []
+ tgt = None
+
+ for i in targets:
+ if i['id'] == target_name:
+ tgt = i
+ break
+
+ if tgt is None:
+ raise RuntimeError('Target with the ID "{}" could not be found'.format(target_name))
+
+ for i in tgt['sources']:
+ result += i['source_files']
+
+ return ('target_files', result)
def list_buildoptions(coredata):
optlist = []