summaryrefslogtreecommitdiffstats
path: root/test cases/unit/18 pkgconfig static
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/unit/18 pkgconfig static
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/unit/18 pkgconfig static')
-rw-r--r--test cases/unit/18 pkgconfig static/foo.c8
-rw-r--r--test cases/unit/18 pkgconfig static/foo.pc.in11
-rw-r--r--test cases/unit/18 pkgconfig static/include/foo.h3
-rw-r--r--test cases/unit/18 pkgconfig static/main.c14
-rw-r--r--test cases/unit/18 pkgconfig static/meson.build37
5 files changed, 73 insertions, 0 deletions
diff --git a/test cases/unit/18 pkgconfig static/foo.c b/test cases/unit/18 pkgconfig static/foo.c
new file mode 100644
index 0000000..bf7fbdd
--- /dev/null
+++ b/test cases/unit/18 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/18 pkgconfig static/foo.pc.in b/test cases/unit/18 pkgconfig static/foo.pc.in
new file mode 100644
index 0000000..b26c0b0
--- /dev/null
+++ b/test cases/unit/18 pkgconfig static/foo.pc.in
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+libdir=${prefix}
+includedir=${prefix}/include
+datadir=${prefix}/data
+
+Name: libfoo
+Description: A foo library.
+Version: 1.0
+Libs: -L${libdir} -lfoo
+Libs.private: -lm
+Cflags: -I${includedir}
diff --git a/test cases/unit/18 pkgconfig static/include/foo.h b/test cases/unit/18 pkgconfig static/include/foo.h
new file mode 100644
index 0000000..88ef554
--- /dev/null
+++ b/test cases/unit/18 pkgconfig static/include/foo.h
@@ -0,0 +1,3 @@
+#pragma once
+
+int power_level (void);
diff --git a/test cases/unit/18 pkgconfig static/main.c b/test cases/unit/18 pkgconfig static/main.c
new file mode 100644
index 0000000..cc4649f
--- /dev/null
+++ b/test cases/unit/18 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/18 pkgconfig static/meson.build b/test cases/unit/18 pkgconfig static/meson.build
new file mode 100644
index 0000000..d1b0fd5
--- /dev/null
+++ b/test cases/unit/18 pkgconfig static/meson.build
@@ -0,0 +1,37 @@
+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('\\')
+ # If the path is C:/foo/bar, convert it to /c/foo/bar so we can test if our
+ # automatic conversion to C:/foo/bar inside PkgConfigDependency is working.
+ if prefix_parts[0][1] == ':'
+ drive = prefix_parts[0][0]
+ else
+ drive = prefix_parts[0]
+ endif
+ new_parts = []
+ foreach part : prefix_parts
+ if part != prefix_parts[0]
+ new_parts += part
+ endif
+ endforeach
+ prefix = '/@0@/@1@'.format(drive, '/'.join(new_parts))
+endif
+message(prefix)
+
+# 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))