diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-11-02 16:42:12 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-11-11 22:39:58 +0530 |
commit | 4405a1297b2d76849b40843f8456d8c086c46516 (patch) | |
tree | 4c84f5715266ffbad39b0e5895a395a1f59edb60 /test cases | |
parent | 9e2d078948d3234371e7b7df399897825938ea99 (diff) | |
download | meson-4405a1297b2d76849b40843f8456d8c086c46516.zip meson-4405a1297b2d76849b40843f8456d8c086c46516.tar.gz meson-4405a1297b2d76849b40843f8456d8c086c46516.tar.bz2 |
dependencies: Add a test for static libs with pkg-config
Demonstrates that pkg-config does not prefer static libs over shared
libs even if we use the `static: true` kwarg.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/unit/17 pkgconfig static/foo.c | 8 | ||||
-rw-r--r-- | test cases/unit/17 pkgconfig static/foo.pc.in | 10 | ||||
-rw-r--r-- | test cases/unit/17 pkgconfig static/include/foo.h | 3 | ||||
-rw-r--r-- | test cases/unit/17 pkgconfig static/main.c | 14 | ||||
-rw-r--r-- | test cases/unit/17 pkgconfig static/meson.build | 19 |
5 files changed, 54 insertions, 0 deletions
diff --git a/test cases/unit/17 pkgconfig static/foo.c b/test cases/unit/17 pkgconfig static/foo.c new file mode 100644 index 0000000..bf7fbdd --- /dev/null +++ b/test cases/unit/17 pkgconfig static/foo.c @@ -0,0 +1,8 @@ +int power_level (void) +{ +#ifdef FOO_STATIC + return 9001; +#else + return 8999; +#endif +} diff --git a/test cases/unit/17 pkgconfig static/foo.pc.in b/test cases/unit/17 pkgconfig static/foo.pc.in new file mode 100644 index 0000000..2dfa7c1 --- /dev/null +++ b/test cases/unit/17 pkgconfig static/foo.pc.in @@ -0,0 +1,10 @@ +prefix=@PREFIX@
+libdir=${prefix}
+includedir=${prefix}/include
+datadir=${prefix}/data
+
+Name: libfoo
+Description: A foo library.
+Version: 1.0
+Libs: -L${libdir} -lfoo
+Cflags: -I${includedir}
diff --git a/test cases/unit/17 pkgconfig static/include/foo.h b/test cases/unit/17 pkgconfig static/include/foo.h new file mode 100644 index 0000000..88ef554 --- /dev/null +++ b/test cases/unit/17 pkgconfig static/include/foo.h @@ -0,0 +1,3 @@ +#pragma once + +int power_level (void); diff --git a/test cases/unit/17 pkgconfig static/main.c b/test cases/unit/17 pkgconfig static/main.c new file mode 100644 index 0000000..cc4649f --- /dev/null +++ b/test cases/unit/17 pkgconfig static/main.c @@ -0,0 +1,14 @@ +#include <foo.h> +#include <stdio.h> + +int +main (int argc, char * argv[]) +{ + int value = power_level (); + if (value < 9000) { + printf ("Power level is %i\n", value); + return 1; + } + printf ("IT'S OVER 9000!!!\n"); + return 0; +} diff --git a/test cases/unit/17 pkgconfig static/meson.build b/test cases/unit/17 pkgconfig static/meson.build new file mode 100644 index 0000000..2327a50 --- /dev/null +++ b/test cases/unit/17 pkgconfig static/meson.build @@ -0,0 +1,19 @@ +project('pkg-config static', 'c') + +if build_machine.system() != 'windows' + prefix = meson.source_root() +else + # pkg-config files should not use paths with \ + prefix_parts = meson.source_root().split('\\') + prefix = '/'.join(prefix_parts) +endif + +conf = configuration_data() +conf.set('PREFIX', prefix) +configure_file(input : 'foo.pc.in', + output : 'foo.pc', + configuration : conf) + +foo_dep = dependency('foo', static : true) + +test('footest', executable('foomain', 'main.c', dependencies : foo_dep)) |