From 3341d5346e530cd67d23f93cbc85e21bba7e8d0e Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 13 Mar 2020 12:07:06 +0800 Subject: [PATCH] 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 --- meson.build | 1 - src/meson.build | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index b4cc69a48..bc1f146b4 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/src/meson.build b/src/meson.build index 63bcf182d..bd4f49722 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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,