diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-04-17 12:45:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-17 12:45:10 +0300 |
commit | 0e45134dee09b12005c028aee066b04ff86228e5 (patch) | |
tree | aed0a5da400746f896dced38e0a47bad8981f6c1 | |
parent | a57f441b37fbabd96f35759c22f571bf39a7c9e3 (diff) | |
parent | e23c987ad2f0898bc8658ab6447d4a103d1362f0 (diff) | |
download | meson-0e45134dee09b12005c028aee066b04ff86228e5.zip meson-0e45134dee09b12005c028aee066b04ff86228e5.tar.gz meson-0e45134dee09b12005c028aee066b04ff86228e5.tar.bz2 |
Merge pull request #1628 from ximion/dfix
d: Fix linking shared libraries with DMD
-rw-r--r-- | mesonbuild/backend/backends.py | 2 | ||||
-rw-r--r-- | test cases/d/7 multilib/app.d | 9 | ||||
-rw-r--r-- | test cases/d/7 multilib/installed_files.txt | 7 | ||||
-rw-r--r-- | test cases/d/7 multilib/meson.build | 21 | ||||
-rw-r--r-- | test cases/d/7 multilib/say1.d | 9 | ||||
-rw-r--r-- | test cases/d/7 multilib/say2.d | 9 |
6 files changed, 56 insertions, 1 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 6a00d17..389e759 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -435,7 +435,7 @@ class Backend: for d in deps: if not isinstance(d, (build.StaticLibrary, build.SharedLibrary)): raise RuntimeError('Tried to link with a non-library target "%s".' % d.get_basename()) - if isinstance(compiler, compilers.LLVMDCompiler): + if isinstance(compiler, compilers.LLVMDCompiler) or isinstance(compiler, compilers.DmdDCompiler): args += ['-L' + self.get_target_filename_for_linking(d)] else: args.append(self.get_target_filename_for_linking(d)) diff --git a/test cases/d/7 multilib/app.d b/test cases/d/7 multilib/app.d new file mode 100644 index 0000000..892596a --- /dev/null +++ b/test cases/d/7 multilib/app.d @@ -0,0 +1,9 @@ + +import say1; +import say2; + +void main () +{ + assert (sayHello1 ("Dave") == 4); + assert (sayHello2 ("HAL 9000") == 8); +} diff --git a/test cases/d/7 multilib/installed_files.txt b/test cases/d/7 multilib/installed_files.txt new file mode 100644 index 0000000..fc6be16 --- /dev/null +++ b/test cases/d/7 multilib/installed_files.txt @@ -0,0 +1,7 @@ +usr/bin/app_d?exe +usr/lib/libsay1.so +usr/lib/libsay1.so.0 +usr/lib/libsay1.so.1.2.3 +usr/lib/libsay2.so +usr/lib/libsay2.so.1 +usr/lib/libsay2.so.1.2.4 diff --git a/test cases/d/7 multilib/meson.build b/test cases/d/7 multilib/meson.build new file mode 100644 index 0000000..6ebe1ca --- /dev/null +++ b/test cases/d/7 multilib/meson.build @@ -0,0 +1,21 @@ +project('D Multiple Versioned Shared Libraries', 'd') + +if meson.get_compiler('d').get_id() == 'gcc' + error('MESON_SKIP_TEST: GDC can not build shared libraries (2016)') +endif + +ldyn1 = shared_library('say1', + 'say1.d', + install: true, + version : '1.2.3', + soversion : '0' +) +ldyn2 = shared_library('say2', + 'say2.d', + install: true, + version : '1.2.4', + soversion : '1' +) + +ed = executable('app_d', 'app.d', link_with: [ldyn1, ldyn2], install: true) +test('multilink_test', ed) diff --git a/test cases/d/7 multilib/say1.d b/test cases/d/7 multilib/say1.d new file mode 100644 index 0000000..07127d3 --- /dev/null +++ b/test cases/d/7 multilib/say1.d @@ -0,0 +1,9 @@ + +import std.stdio; +import std.string : format; + +int sayHello1 (string str) +{ + writeln ("Hello %s from library 1.".format (str)); + return 4; +} diff --git a/test cases/d/7 multilib/say2.d b/test cases/d/7 multilib/say2.d new file mode 100644 index 0000000..f77d0d2 --- /dev/null +++ b/test cases/d/7 multilib/say2.d @@ -0,0 +1,9 @@ + +import std.stdio; +import std.string : format; + +int sayHello2 (string str) +{ + writeln ("Hello %s from library 2.".format (str)); + return 8; +} |