From 7814ef986fc0413630a7a6b7dbc169fc2ce39b03 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 19 Jul 2014 01:14:21 +0300 Subject: [PATCH] Set up link paths. --- environment.py | 3 +++ ninjabackend.py | 5 +++++ test cases/csharp/2 library/helper.cs | 7 +++++++ test cases/csharp/2 library/installed_files.txt | 2 ++ test cases/csharp/2 library/meson.build | 5 +++++ test cases/csharp/2 library/prog.cs | 8 ++++++++ 6 files changed, 30 insertions(+) create mode 100644 test cases/csharp/2 library/helper.cs create mode 100644 test cases/csharp/2 library/installed_files.txt create mode 100644 test cases/csharp/2 library/meson.build create mode 100644 test cases/csharp/2 library/prog.cs 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(); + } +}