aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-08-24 21:16:22 +0300
committerGitHub <noreply@github.com>2017-08-24 21:16:22 +0300
commitcad020f9da4d52e52577926570b68bf9decef4ca (patch)
treede66734127764c753a2a79896a302e1ee5f91efd
parent90c7b5ea58c7d1fea83236cd05b0680dc1c52cac (diff)
parent44dc02849995188f8b25158d2c71009aeb264910 (diff)
downloadmeson-cad020f9da4d52e52577926570b68bf9decef4ca.zip
meson-cad020f9da4d52e52577926570b68bf9decef4ca.tar.gz
meson-cad020f9da4d52e52577926570b68bf9decef4ca.tar.bz2
Merge pull request #2243 from thiblahute/csharp
Patchset to allow using meson for gstreamer-sharp
-rw-r--r--mesonbuild/backend/ninjabackend.py9
-rw-r--r--mesonbuild/modules/gnome.py10
-rw-r--r--test cases/csharp/2 library/meson.build12
3 files changed, 28 insertions, 3 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index ec811cb..1f6a80b 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -987,11 +987,20 @@ int dummy;
outputs = [outname_rel, outname_rel + '.mdb']
else:
outputs = [outname_rel]
+ generated_sources = self.get_target_generated_sources(target)
+ for rel_src in generated_sources.keys():
+ dirpart, fnamepart = os.path.split(rel_src)
+ if rel_src.lower().endswith('.cs'):
+ rel_srcs.append(rel_src)
+ deps.append(rel_src)
+
elem = NinjaBuildElement(self.all_outputs, outputs, 'cs_COMPILER', rel_srcs)
elem.add_dep(deps)
elem.add_item('ARGS', commands)
elem.write(outfile)
+ self.generate_generator_list_rules(target, outfile)
+
def generate_single_java_compile(self, src, target, compiler, outfile):
args = []
args += compiler.get_buildtype_args(self.get_option_for_target('buildtype', target))
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 0a39664..1632dae 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -375,8 +375,6 @@ class GnomeModule(ExtensionModule):
# Hack to avoid passing some compiler options in
if lib.startswith("-W"):
continue
- if gir_has_extra_lib_arg() and use_gir_args and lib.startswith("-l"):
- lib = lib.replace('-l', '--extra-library=', 1)
ldflags.update([lib])
if isinstance(dep, PkgConfigDependency):
@@ -389,6 +387,14 @@ class GnomeModule(ExtensionModule):
mlog.log('dependency %s not handled to build gir files' % dep)
continue
+ if gir_has_extra_lib_arg() and use_gir_args:
+ fixed_ldflags = set()
+ for ldflag in ldflags:
+ if ldflag.startswith("-l"):
+ fixed_ldflags.add(ldflag.replace('-l', '--extra-library=', 1))
+ else:
+ fixed_ldflags.add(ldflag)
+ ldflags = fixed_ldflags
return cflags, ldflags, gi_includes
@permittedKwargs({'sources', 'nsversion', 'namespace', 'symbol_prefix', 'identifier_prefix',
diff --git a/test cases/csharp/2 library/meson.build b/test cases/csharp/2 library/meson.build
index 2082e03..6b246a4 100644
--- a/test cases/csharp/2 library/meson.build
+++ b/test cases/csharp/2 library/meson.build
@@ -1,5 +1,15 @@
project('C# library', 'cs')
-l = shared_library('helper', 'helper.cs', install : true)
+python3 = import('python3').find_python()
+generated_sources = custom_target('gen_sources',
+ input: 'helper.cs',
+ output: 'helper.cs',
+ command: [python3, '-c',
+ 'import shutil, sys; shutil.copyfile(sys.argv[1], sys.argv[2])',
+ '@INPUT@', '@OUTPUT@']
+)
+
+l = shared_library('helper', generated_sources, install : true)
+
e = executable('prog', 'prog.cs', link_with : l, install : true)
test('libtest', e)