Debian Codegraph @

test cases/osx/2 library versions/meson.build

raw
1 project('library versions', 'c')
2
3 if run_command(find_program('require_pkgconfig.py'), check: true).stdout().strip() == 'yes'
4 required = true
5 else
6 required = false
7 endif
8
9 zlib_dep = dependency('zlib', required: required)
10 if zlib_dep.found()
11 build_rpath = zlib_dep.type_name() == 'pkgconfig' ? zlib_dep.get_pkgconfig_variable('libdir') : 'lib'
12 some = shared_library('some', 'lib.c',
13 # duplicate the rpath again, in order
14 # to test Meson's RPATH deduplication
15 build_rpath : build_rpath,
16 dependencies : zlib_dep,
17 version : '1.2.3',
18 soversion : '7',
19 install : true)
20 else
21 some = shared_library('some', 'lib.c',
22 version : '1.2.3',
23 soversion : '7',
24 install : true)
25 endif
26
27 noversion = shared_library('noversion', 'lib.c',
28 install : true)
29
30 onlyversion = shared_library('onlyversion', 'lib.c',
31 version : '1.4.5',
32 install : true)
33
34 onlysoversion = shared_library('onlysoversion', 'lib.c',
35 # Also test that int soversion is acceptable
36 soversion : 5,
37 install : true)
38
39 shared_library('intver', 'lib.c',
40 darwin_versions : 2)
41
42 shared_library('stringver', 'lib.c',
43 darwin_versions : '2.3')
44
45 shared_library('stringlistver', 'lib.c',
46 darwin_versions : ['2.4'])
47
48 shared_library('intstringver', 'lib.c',
49 darwin_versions : [1111, '2.5'])
50
51 shared_library('stringlistvers', 'lib.c',
52 darwin_versions : ['2.6', '2.6.1'])
53
54 # Hack to make the executables below depend on the shared libraries above
55 # without actually adding them as `link_with` dependencies since we want to try
56 # linking to them with -lfoo linker arguments.
57 out = custom_target('library-dependency-hack',
58 input : 'exe.orig.c',
59 output : 'exe.c',
60 depends : [some, noversion, onlyversion, onlysoversion],
61 command : ['cp', '@INPUT@', '@OUTPUT@'])
62
63 # Manually test if the linker can find the above libraries
64 # i.e., whether they were generated with the right naming scheme
65 test('manually linked 1', executable('manuallink1', out,
66 link_args : ['-L.', '-lsome'],
67 build_rpath : meson.current_build_dir()))
68
69 test('manually linked 2', executable('manuallink2', out,
70 link_args : ['-L.', '-lnoversion'],
71 build_rpath : meson.current_build_dir()))
72
73 test('manually linked 3', executable('manuallink3', out,
74 link_args : ['-L.', '-lonlyversion'],
75 build_rpath : meson.current_build_dir()))
76
77 test('manually linked 4', executable('manuallink4', out,
78 link_args : ['-L.', '-lonlysoversion'],
79 build_rpath : meson.current_build_dir()))
80
81 shared_module('module', 'lib.c', install : true)