aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-03-17 22:34:19 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2019-03-18 22:01:07 +0200
commite81f48db1600056942e30e2567af73d6d7678188 (patch)
tree1a724fd7876a2cad22e016e71d34e176e3ab42c2 /mesonbuild/build.py
parent93df9530c820402d553d3db2b1b3a93ba13161fb (diff)
downloadmeson-e81f48db1600056942e30e2567af73d6d7678188.zip
meson-e81f48db1600056942e30e2567af73d6d7678188.tar.gz
meson-e81f48db1600056942e30e2567af73d6d7678188.tar.bz2
Can link against custom targets. Closes #4908.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 20f0cdb..eb8e60c 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -567,6 +567,8 @@ class BuildTarget(Target):
if self.link_targets or self.link_whole_targets:
extra = set()
for t in itertools.chain(self.link_targets, self.link_whole_targets):
+ if isinstance(t, CustomTarget):
+ continue # We can't know anything about these.
for name, compiler in t.compilers.items():
if name in clink_langs:
extra.add((name, compiler))
@@ -1062,7 +1064,7 @@ You probably should put it in link_with instead.''')
msg = "Can't link non-PIC static library {!r} into shared library {!r}. ".format(t.name, self.name)
msg += "Use the 'pic' option to static_library to build with PIC."
raise InvalidArguments(msg)
- if self.is_cross != t.is_cross:
+ if not isinstance(t, CustomTarget) and self.is_cross != t.is_cross:
raise InvalidArguments('Tried to mix cross built and native libraries in target {!r}'.format(self.name))
self.link_targets.append(t)
@@ -1149,6 +1151,8 @@ You probably should put it in link_with instead.''')
# Check if any of the internal libraries this target links to were
# written in this language
for link_target in itertools.chain(self.link_targets, self.link_whole_targets):
+ if isinstance(link_target, CustomTarget):
+ continue
for language in link_target.compilers:
if language not in langs:
langs.append(language)
@@ -2090,6 +2094,19 @@ class CustomTarget(Target):
raise InvalidArguments('Substitution in depfile for custom_target that does not have an input file.')
return self.depfile
+ def is_linkable_target(self):
+ if len(self.outputs) != 1:
+ return False
+ suf = os.path.splitext(self.outputs[0])[-1]
+ if suf == '.a' or suf == '.dll' or suf == '.lib' or suf == '.so':
+ return True
+
+ def get_link_dep_subdirs(self):
+ return OrderedSet()
+
+ def get_all_link_deps(self):
+ return []
+
def type_suffix(self):
return "@cus"