meson: automatically add PSL_STATIC define when building Windows static library
This commit is contained in:
parent
4a10a1698b
commit
ba6f11f751
|
@ -15,11 +15,10 @@ foreach test_case : ['fuzzer', 'load_fuzzer', 'load_dafsa_fuzzer']
|
||||||
endif
|
endif
|
||||||
source_file = 'libpsl_@0@.c'.format(test_case)
|
source_file = 'libpsl_@0@.c'.format(test_case)
|
||||||
exe = executable(test_name, source_file, 'main.c',
|
exe = executable(test_name, source_file, 'main.c',
|
||||||
link_with : libpsl,
|
|
||||||
c_args : fuzzer_cargs,
|
c_args : fuzzer_cargs,
|
||||||
include_directories : [configinc, includedir],
|
include_directories : configinc,
|
||||||
dependencies : libicu_dep,
|
link_language : link_language,
|
||||||
link_language : link_language
|
dependencies : [libpsl_dep, libicu_dep]
|
||||||
)
|
)
|
||||||
test(test_name, exe)
|
test(test_name, exe)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
|
@ -23,6 +23,17 @@ libtool_version_revision = libtool_version_info[1].to_int()
|
||||||
libtool_version_age = libtool_version_info[2].to_int()
|
libtool_version_age = libtool_version_info[2].to_int()
|
||||||
library_version = '@0@.@1@.@2@'.format(libtool_version_current - libtool_version_age, libtool_version_age, libtool_version_revision)
|
library_version = '@0@.@1@.@2@'.format(libtool_version_current - libtool_version_age, libtool_version_age, libtool_version_revision)
|
||||||
|
|
||||||
|
interface_cargs = []
|
||||||
|
if host_machine.system() == 'windows'
|
||||||
|
default_library = get_option('default_library')
|
||||||
|
if default_library == 'static'
|
||||||
|
interface_cargs = ['-DPSL_STATIC']
|
||||||
|
cargs += interface_cargs
|
||||||
|
elif default_library == 'both'
|
||||||
|
warning('Building both static and dynamic libraries. -DPSL_STATIC will not be added to pkg-config metadata')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
libpsl = library('psl', sources, suffixes_dafsa_h,
|
libpsl = library('psl', sources, suffixes_dafsa_h,
|
||||||
include_directories : [configinc, includedir],
|
include_directories : [configinc, includedir],
|
||||||
c_args : cargs,
|
c_args : cargs,
|
||||||
|
@ -34,10 +45,12 @@ libpsl = library('psl', sources, suffixes_dafsa_h,
|
||||||
|
|
||||||
pkgconfig.generate(libpsl,
|
pkgconfig.generate(libpsl,
|
||||||
name : 'libpsl',
|
name : 'libpsl',
|
||||||
description : 'Public Suffix List C library')
|
description : 'Public Suffix List C library',
|
||||||
|
extra_cflags : interface_cargs)
|
||||||
|
|
||||||
libpsl_dep = declare_dependency(link_with : libpsl,
|
libpsl_dep = declare_dependency(link_with : libpsl,
|
||||||
include_directories : includedir)
|
include_directories : includedir,
|
||||||
|
compile_args : interface_cargs)
|
||||||
|
|
||||||
install_data('psl-make-dafsa', install_dir : get_option('bindir'))
|
install_data('psl-make-dafsa', install_dir : get_option('bindir'))
|
||||||
install_man('psl-make-dafsa.1')
|
install_man('psl-make-dafsa.1')
|
||||||
|
|
|
@ -32,7 +32,8 @@ foreach test_name : tests
|
||||||
exe = executable(test_name, source,
|
exe = executable(test_name, source,
|
||||||
c_args : tests_cargs,
|
c_args : tests_cargs,
|
||||||
link_with : libpsl,
|
link_with : libpsl,
|
||||||
include_directories : [configinc, includedir],
|
include_directories : configinc,
|
||||||
link_language : link_language)
|
link_language : link_language,
|
||||||
|
dependencies : [libpsl_dep])
|
||||||
test(test_name, exe, depends : [psl_dafsa, psl_ascii_dafsa])
|
test(test_name, exe, depends : [psl_dafsa, psl_ascii_dafsa])
|
||||||
endforeach
|
endforeach
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
psl = executable('psl', 'psl.c',
|
psl = executable('psl', 'psl.c',
|
||||||
link_with : libpsl,
|
include_directories : configinc,
|
||||||
include_directories : [configinc, includedir],
|
|
||||||
c_args : ['-DHAVE_CONFIG_H'],
|
c_args : ['-DHAVE_CONFIG_H'],
|
||||||
link_language : link_language,
|
link_language : link_language,
|
||||||
|
dependencies : [libpsl_dep],
|
||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue