src/meson.build: Some cleanups for Visual Studio builds

We don't actually need the .def files (vs_module_defs) entry when we are
building DLLs with Visual Studio as long as we have HB_DLL_EXPORT defined.

Plus, to maintain compatibility with the CMake builds, for Visual Studio builds
we do not prefix the libraries with 'lib', nor have a '-0' suffix for the DLL
file name.
This commit is contained in:
Chun-wei Fan 2020-03-13 16:00:09 +08:00 committed by Ebrahim Byagowi
parent da95a8c239
commit 4b4d5c295d
1 changed files with 15 additions and 11 deletions

View File

@ -215,19 +215,25 @@ harfbuzz_def = custom_target('harfbuzz.def',
version = '0.' + '0'.join(meson.project_version().split('.')) + '.0' version = '0.' + '0'.join(meson.project_version().split('.')) + '.0'
extra_hb_cpp_args = [] extra_hb_cpp_args = []
if get_option('default_library') == 'shared' and cpp.get_id() == 'msvc' if cpp.get_id() == 'msvc'
if get_option('default_library') == 'shared'
extra_hb_cpp_args += '-DHB_DLL_EXPORT' extra_hb_cpp_args += '-DHB_DLL_EXPORT'
endif endif
hb_so_version = ''
hb_lib_prefix = ''
else
hb_so_version = '0'
hb_lib_prefix = 'lib'
endif
libharfbuzz = library('harfbuzz', hb_sources, libharfbuzz = library('harfbuzz', hb_sources,
include_directories: [incconfig, incucdn], include_directories: [incconfig, incucdn],
dependencies: deps, dependencies: deps,
cpp_args: cpp_args + extra_hb_cpp_args, cpp_args: cpp_args + extra_hb_cpp_args,
vs_module_defs: harfbuzz_def, soversion: hb_so_version,
soversion: '0',
version: version, version: version,
install: true, install: true,
name_prefix: 'lib') name_prefix: hb_lib_prefix)
libharfbuzz_dep = declare_dependency( libharfbuzz_dep = declare_dependency(
link_with: libharfbuzz, link_with: libharfbuzz,
@ -244,11 +250,10 @@ libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
include_directories: incconfig, include_directories: incconfig,
link_with: [libharfbuzz], link_with: [libharfbuzz],
cpp_args: cpp_args + extra_hb_cpp_args, cpp_args: cpp_args + extra_hb_cpp_args,
vs_module_defs: harfbuzz_subset_def, soversion: hb_so_version,
soversion: '0',
version: version, version: version,
install: true, install: true,
name_prefix: 'lib') name_prefix: hb_lib_prefix)
libharfbuzz_subset_dep = declare_dependency( libharfbuzz_subset_dep = declare_dependency(
link_with: libharfbuzz_subset, link_with: libharfbuzz_subset,
@ -328,11 +333,10 @@ if have_gobject
dependencies: deps, dependencies: deps,
link_with: [libharfbuzz], link_with: [libharfbuzz],
cpp_args: cpp_args + extra_hb_cpp_args, cpp_args: cpp_args + extra_hb_cpp_args,
vs_module_defs: harfbuzz_gobject_def, soversion: hb_so_version,
soversion: '0',
version: version, version: version,
install: true, install: true,
name_prefix: 'lib') name_prefix: hb_lib_prefix)
gir = find_program('g-ir-scanner', required: get_option('introspection')) gir = find_program('g-ir-scanner', required: get_option('introspection'))
build_gir = gir.found() and not meson.is_cross_build() build_gir = gir.found() and not meson.is_cross_build()