meson: Don't use .def files for Visual Studio builds

Instead, when building with Visual Studio-style compilers, define 'FcPublic' as
appropriate so that symbols will be exported without the need to maintain a
.def file.
This commit is contained in:
Chun-wei Fan 2020-09-29 14:04:30 +08:00
parent b2a54dfb8f
commit 89f7bcac08
1 changed files with 7 additions and 6 deletions

View File

@ -57,17 +57,18 @@ fcobjshash_h = custom_target('fcobjshash.h',
command: [gperf, '--pic', '-m', '100', '@INPUT@', '--output-file', '@OUTPUT@'] command: [gperf, '--pic', '-m', '100', '@INPUT@', '--output-file', '@OUTPUT@']
) )
# write def file with exports for windows # Define FcPublic appropriately for exports on windows
cdata_def = configuration_data() fc_extra_c_args = []
cdata_def.set('DEF_VERSION', defversion)
fontconfig_def = configure_file(input: 'fontconfig.def.in', output: 'fontconfig.def', configuration: cdata_def) if cc.get_argument_syntax() == 'msvc'
fc_extra_c_args += '-DFcPublic=__declspec(dllexport)'
endif
libfontconfig = library('fontconfig', libfontconfig = library('fontconfig',
fc_sources, alias_headers, ft_alias_headers, fclang_h, fccase_h, fcobjshash_h, fc_sources, alias_headers, ft_alias_headers, fclang_h, fccase_h, fcobjshash_h,
c_args: c_args, c_args: c_args + fc_extra_c_args,
include_directories: incbase, include_directories: incbase,
dependencies: deps, dependencies: deps,
vs_module_defs: fontconfig_def,
install: true, install: true,
soversion: soversion, soversion: soversion,
version: libversion, version: libversion,