|
|
@ -59,6 +59,12 @@ exposed_lib = shared_library('libexposed', 'simple.c') |
|
|
|
internal_lib = shared_library('libinternal', 'simple.c') |
|
|
|
internal_lib = shared_library('libinternal', 'simple.c') |
|
|
|
main_lib = shared_library('libmain', link_with : [exposed_lib, internal_lib]) |
|
|
|
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 |
|
|
|
# Declare a few different Dependency objects |
|
|
|
pc_dep = dependency('libfoo', required : false) |
|
|
|
pc_dep = dependency('libfoo', required : false) |
|
|
|
threads_dep = dependency('threads', required : false) |
|
|
|
threads_dep = dependency('threads', required : false) |
|
|
@ -68,6 +74,7 @@ custom2_dep = declare_dependency(link_args : ['-lcustom2'], compile_args : ['-DC |
|
|
|
# Generate a PC file: |
|
|
|
# Generate a PC file: |
|
|
|
# - Having libmain in libraries should pull implicitely libexposed and libinternal in Libs.private |
|
|
|
# - Having libmain in libraries should pull implicitely libexposed and libinternal in Libs.private |
|
|
|
# - Having libexposed in libraries should remove it from 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 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 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 custom2_dep in libraries_private should not add its Cflags |
|
|
@ -83,7 +90,8 @@ pkgg.generate(libraries : [main_lib, exposed_lib, threads_dep , custom_dep], |
|
|
|
msg = 'Generated pc file doesn\'t have expected @0@: @1@' |
|
|
|
msg = 'Generated pc file doesn\'t have expected @0@: @1@' |
|
|
|
|
|
|
|
|
|
|
|
out = run_command(envcmd, '-', pkgconfig_env, pkgconfig, 'dependency-test', '--print-requires').stdout().strip().split() |
|
|
|
out = run_command(envcmd, '-', pkgconfig_env, pkgconfig, 'dependency-test', '--print-requires').stdout().strip().split() |
|
|
|
assert(out.length() == 0, msg.format('requires', out)) |
|
|
|
assert(out.contains('libexposed'), msg.format('requires', out)) |
|
|
|
|
|
|
|
assert(out.length() == 1, msg.format('requires', out)) |
|
|
|
|
|
|
|
|
|
|
|
out = run_command(envcmd, '-', pkgconfig_env, pkgconfig, 'dependency-test', '--print-requires-private').stdout().strip().split() |
|
|
|
out = run_command(envcmd, '-', pkgconfig_env, pkgconfig, 'dependency-test', '--print-requires-private').stdout().strip().split() |
|
|
|
assert(out.contains('libfoo'), msg.format('requires.private', out)) |
|
|
|
assert(out.contains('libfoo'), msg.format('requires.private', out)) |
|
|
@ -95,14 +103,12 @@ assert(out.contains('-DCUSTOM'), msg.format('cflags', out)) |
|
|
|
assert(out.length() == 2, msg.format('cflags', out)) |
|
|
|
assert(out.length() == 2, msg.format('cflags', out)) |
|
|
|
|
|
|
|
|
|
|
|
out = run_command(envcmd, '-', pkgconfig_env, pkgconfig, 'dependency-test', '--libs-only-l', '--libs-only-other').stdout().strip().split() |
|
|
|
out = run_command(envcmd, '-', pkgconfig_env, pkgconfig, 'dependency-test', '--libs-only-l', '--libs-only-other').stdout().strip().split() |
|
|
|
assert(out.contains('-llibexposed'), msg.format('libs', out)) |
|
|
|
|
|
|
|
assert(out.contains('-pthread'), msg.format('libs', out)) |
|
|
|
assert(out.contains('-pthread'), msg.format('libs', out)) |
|
|
|
assert(out.contains('-lcustom'), msg.format('libs', out)) |
|
|
|
assert(out.contains('-lcustom'), msg.format('libs', out)) |
|
|
|
assert(out.contains('-llibmain'), msg.format('libs', out)) |
|
|
|
assert(out.contains('-llibmain'), msg.format('libs', out)) |
|
|
|
assert(out.length() == 4, msg.format('libs', out)) |
|
|
|
assert(out.length() == 4, msg.format('libs', out)) |
|
|
|
|
|
|
|
|
|
|
|
out = run_command(envcmd, '-', pkgconfig_env, pkgconfig, 'dependency-test', '--libs-only-l', '--libs-only-other', '--static').stdout().strip().split() |
|
|
|
out = run_command(envcmd, '-', pkgconfig_env, pkgconfig, 'dependency-test', '--libs-only-l', '--libs-only-other', '--static').stdout().strip().split() |
|
|
|
assert(out.contains('-llibexposed'), msg.format('libs.private', out)) |
|
|
|
|
|
|
|
assert(out.contains('-pthread'), msg.format('libs.private', out)) |
|
|
|
assert(out.contains('-pthread'), msg.format('libs.private', out)) |
|
|
|
assert(out.contains('-lcustom'), msg.format('libs.private', out)) |
|
|
|
assert(out.contains('-lcustom'), msg.format('libs.private', out)) |
|
|
|
assert(out.contains('-llibmain'), msg.format('libs.private', out)) |
|
|
|
assert(out.contains('-llibmain'), msg.format('libs.private', out)) |
|
|
|