diff --git a/environment.py b/environment.py index 07c1c2832..4c6a36ad6 100644 --- a/environment.py +++ b/environment.py @@ -468,6 +468,9 @@ class MonoCompiler(): def get_linker_always_args(self): return [] + def get_link_args(self, fname): + return ['-r:' + fname] + def get_soname_args(self, shlib_name, path): return [] diff --git a/ninjabackend.py b/ninjabackend.py index 21dfd351c..c9f69938b 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -449,7 +449,12 @@ class NinjaBackend(backends.Backend): else: raise MesonException('Unknown C# target type.') commands += compiler.get_output_args(outname_rel) + deps = [] + for l in target.link_targets: + commands += compiler.get_link_args(l.get_filename()) + deps.append(l.get_filename()) elem = NinjaBuildElement(outname_rel, 'cs_COMPILER', rel_srcs) + elem.add_dep(deps) elem.add_item('ARGS', commands) elem.write(outfile) diff --git a/test cases/csharp/2 library/helper.cs b/test cases/csharp/2 library/helper.cs new file mode 100644 index 000000000..266e37969 --- /dev/null +++ b/test cases/csharp/2 library/helper.cs @@ -0,0 +1,7 @@ +using System; + +public class Helper { + public void print() { + Console.WriteLine("Library class called."); + } +} diff --git a/test cases/csharp/2 library/installed_files.txt b/test cases/csharp/2 library/installed_files.txt new file mode 100644 index 000000000..48d527751 --- /dev/null +++ b/test cases/csharp/2 library/installed_files.txt @@ -0,0 +1,2 @@ +bin/prog.exe +lib/libhelper.dll diff --git a/test cases/csharp/2 library/meson.build b/test cases/csharp/2 library/meson.build new file mode 100644 index 000000000..2082e0375 --- /dev/null +++ b/test cases/csharp/2 library/meson.build @@ -0,0 +1,5 @@ +project('C# library', 'cs') + +l = shared_library('helper', 'helper.cs', install : true) +e = executable('prog', 'prog.cs', link_with : l, install : true) +test('libtest', e) diff --git a/test cases/csharp/2 library/prog.cs b/test cases/csharp/2 library/prog.cs new file mode 100644 index 000000000..8bf6a3136 --- /dev/null +++ b/test cases/csharp/2 library/prog.cs @@ -0,0 +1,8 @@ +using System; + +public class Prog { + static public void Main () { + Helper h = new Helper(); + h.print(); + } +}