meson: Don't apply -DHB_DLL_EXPORT to all targets

Only have it apply to the libraries when they are not built statically on
Visual Studio
This commit is contained in:
Chun-wei Fan 2020-03-13 12:07:06 +08:00 committed by Ebrahim Byagowi
parent a224f4179f
commit 3341d5346e
2 changed files with 8 additions and 4 deletions

View File

@ -33,7 +33,6 @@ if cpp.get_id() == 'msvc'
'/wd4244', # lossy type conversion (e.g. double -> int)
'/wd4305', # truncating type conversion (e.g. double -> float)
cpp.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
'-DHB_DLL_EXPORT', # FIXME: shouldn't this be set only on the lib targets?
]
add_project_arguments(msvc_args, language : 'c')
add_project_arguments(msvc_args, language : 'cpp')

View File

@ -214,10 +214,15 @@ harfbuzz_def = custom_target('harfbuzz.def',
version = '0.' + '0'.join(meson.project_version().split('.')) + '.0'
extra_hb_cpp_args = []
if get_option('default_library') == 'shared' and cpp.get_id() == 'msvc'
extra_hb_cpp_args += '-DHB_DLL_EXPORT'
endif
libharfbuzz = library('harfbuzz', hb_sources,
include_directories: [incconfig, incucdn],
dependencies: deps,
cpp_args: cpp_args,
cpp_args: cpp_args + extra_hb_cpp_args,
vs_module_defs: harfbuzz_def,
soversion: '0',
version: version,
@ -238,7 +243,7 @@ harfbuzz_subset_def = custom_target('harfbuzz-subset.def',
libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
include_directories: incconfig,
link_with: [libharfbuzz],
cpp_args: cpp_args,
cpp_args: cpp_args + extra_hb_cpp_args,
vs_module_defs: harfbuzz_subset_def,
soversion: '0',
version: version,
@ -322,7 +327,7 @@ if have_gobject
include_directories: incconfig,
dependencies: deps,
link_with: [libharfbuzz],
cpp_args: cpp_args,
cpp_args: cpp_args + extra_hb_cpp_args,
vs_module_defs: harfbuzz_gobject_def,
soversion: '0',
version: version,