diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-11-15 22:51:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-15 22:51:34 +0200 |
| commit | e51da1a34d3ac2ed23451e05c971720c20aaa064 (patch) | |
| tree | 4f929542408830518055b5258c3059931ade4d22 /test cases | |
| parent | b9ef15a7193e55bb72216135066666b7bacbfaf0 (diff) | |
| parent | da654dd2b9ebb91a2202e7a841c4ae1c71ebf8ea (diff) | |
| download | meson-e51da1a34d3ac2ed23451e05c971720c20aaa064.tar.gz | |
Merge pull request #2611 from mesonbuild/nirbheek/pkgconfig-msvc-static
Several fixes to pkg-config dependencies and the pkg-config module (try 3)
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 | 23 |
5 files changed, 58 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 000000000..bf7fbddf3 --- /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 000000000..94d803154 --- /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 000000000..88ef55494 --- /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 000000000..cc4649f71 --- /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 000000000..caeb4aae2 --- /dev/null +++ b/test cases/unit/17 pkgconfig static/meson.build @@ -0,0 +1,23 @@ +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 + +# Escape spaces +prefix_parts = prefix.split(' ') +prefix = '\ '.join(prefix_parts) + +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)) |
