fix static builds on Windows with Meson

Fixes #222
pull/231/head
Ariadne Conill 2021-07-24 19:45:07 -06:00
parent ed86f2dda3
commit 76968a4f8d
1 changed files with 11 additions and 1 deletions

View File

@ -44,6 +44,13 @@ cdata.set('abs_top_builddir', meson.build_root())
subdir('libpkgconf') subdir('libpkgconf')
libtype = get_option('default_library')
if libtype == 'static'
build_static = '-DPKGCONFIG_IS_STATIC'
else
build_static = ''
endif
libpkgconf = library('pkgconf', libpkgconf = library('pkgconf',
'libpkgconf/argvsplit.c', 'libpkgconf/argvsplit.c',
'libpkgconf/audit.c', 'libpkgconf/audit.c',
@ -59,7 +66,7 @@ libpkgconf = library('pkgconf',
'libpkgconf/pkg.c', 'libpkgconf/pkg.c',
'libpkgconf/queue.c', 'libpkgconf/queue.c',
'libpkgconf/tuple.c', 'libpkgconf/tuple.c',
c_args: '-DLIBPKGCONF_EXPORT', c_args: ['-DLIBPKGCONF_EXPORT', build_static],
install : true, install : true,
version : '3.0.0', version : '3.0.0',
soversion : '3', soversion : '3',
@ -72,13 +79,16 @@ pkg.generate(libpkgconf,
url: 'http://github.com/pkgconf/pkgconf', url: 'http://github.com/pkgconf/pkgconf',
filebase : 'libpkgconf', filebase : 'libpkgconf',
subdirs: ['pkgconf'], subdirs: ['pkgconf'],
extra_cflags : build_static
) )
pkgconf_exe = executable('pkgconf', pkgconf_exe = executable('pkgconf',
'cli/main.c', 'cli/main.c',
'cli/getopt_long.c', 'cli/getopt_long.c',
'cli/renderer-msvc.c', 'cli/renderer-msvc.c',
link_with : libpkgconf, link_with : libpkgconf,
c_args: build_static,
install : true) install : true)
if get_option('tests') if get_option('tests')