aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-12-31 19:11:57 +0200
committerGitHub <noreply@github.com>2017-12-31 19:11:57 +0200
commitdd3f49af0d8c94033e6db68b25c23ea9e63e9c5c (patch)
treecfae667dcb4b0ad3266d47134354636a1f3ba059 /test cases
parent500c39cb07d21aa6857e204f6689d324afd758c4 (diff)
parent68eedc8b7157190a010d31bea81f13f91144ea75 (diff)
downloadmeson-dd3f49af0d8c94033e6db68b25c23ea9e63e9c5c.zip
meson-dd3f49af0d8c94033e6db68b25c23ea9e63e9c5c.tar.gz
meson-dd3f49af0d8c94033e6db68b25c23ea9e63e9c5c.tar.bz2
Merge pull request #2757 from xclaesse/pkgconfig
pkgconfig: Allow passing Dependency objects to library(_private)
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/51 pkgconfig-gen/meson.build61
1 files changed, 48 insertions, 13 deletions
diff --git a/test cases/common/51 pkgconfig-gen/meson.build b/test cases/common/51 pkgconfig-gen/meson.build
index 68ee812..a8dd092 100644
--- a/test cases/common/51 pkgconfig-gen/meson.build
+++ b/test cases/common/51 pkgconfig-gen/meson.build
@@ -1,5 +1,17 @@
project('pkgconfig-gen', 'c')
+# First check we have pkg-config >= 0.29
+
+pkgconfig = find_program('pkg-config', required: false)
+if not pkgconfig.found()
+ error('MESON_SKIP_TEST: pkg-config not found')
+endif
+
+v = run_command(pkgconfig, '--version').stdout().strip()
+if v.version_compare('<0.29')
+ error('MESON_SKIP_TEST: pkg-config version \'' + v + '\' too old')
+endif
+
pkgg = import('pkgconfig')
lib = shared_library('simple', 'simple.c')
@@ -18,19 +30,9 @@ pkgg.generate(
libraries_private : [lib, '-lz'],
)
-pkgconfig = find_program('pkg-config', required: false)
-if pkgconfig.found()
- v = run_command(pkgconfig, '--version').stdout().strip()
- if v.version_compare('>=0.29')
- test('pkgconfig-validation', pkgconfig,
- args: ['--validate', 'simple'],
- env: ['PKG_CONFIG_PATH=' + meson.current_build_dir() + '/meson-private' ])
- else
- message('pkg-config version \'' + v + '\' too old, skipping validate test')
- endif
-else
- message('pkg-config not found, skipping validate test')
-endif
+test('pkgconfig-validation', pkgconfig,
+ args: ['--validate', 'simple'],
+ env: [ 'PKG_CONFIG_PATH=' + meson.current_build_dir() + '/meson-private' ])
# Test that name_prefix='' and name='libfoo' results in '-lfoo'
lib2 = shared_library('libfoo', 'simple.c',
@@ -44,3 +46,36 @@ pkgg.generate(
description : 'A foo library.',
variables : ['foo=bar', 'datadir=${prefix}/data']
)
+
+# libmain internally use libinternal and expose libexpose in its API
+exposed_lib = shared_library('libexposed', 'simple.c')
+internal_lib = shared_library('libinternal', 'simple.c')
+main_lib = shared_library('libmain', link_with : [exposed_lib, internal_lib])
+
+pkgg.generate(libraries : exposed_lib,
+ version : libver,
+ name : 'libexposed',
+ description : 'An exposed library in dependency test.'
+)
+
+# Declare a few different Dependency objects
+pc_dep = dependency('libfoo', required : false)
+threads_dep = dependency('threads', required : false)
+custom_dep = declare_dependency(link_args : ['-lcustom'], compile_args : ['-DCUSTOM'])
+custom2_dep = declare_dependency(link_args : ['-lcustom2'], compile_args : ['-DCUSTOM2'])
+
+# Generate a PC file:
+# - Having libmain in libraries should pull implicitely libexposed and libinternal in Libs.private
+# - Having libexposed in libraries should remove it from Libs.private
+# - We generated a pc file for libexposed so it should be in Requires instead of Libs
+# - Having threads_dep in libraries should add '-pthread' in both Libs and Cflags
+# - Having custom_dep in libraries and libraries_private should only add it in Libs
+# - Having custom2_dep in libraries_private should not add its Cflags
+# - Having pc_dep in libraries_private should add it in Requires.private
+pkgg.generate(libraries : [main_lib, exposed_lib, threads_dep , custom_dep],
+ libraries_private : [custom_dep, custom2_dep, pc_dep],
+ version : libver,
+ name : 'dependency-test',
+ filebase : 'dependency-test',
+ description : 'A dependency test.'
+)