From 929dbbcddf780882d9f6b4175a533712379ffeb2 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Wed, 23 Jan 2019 15:40:26 +0700 Subject: [PATCH] meson: Add -DLZ4_DLL_EXPORT=1 to build dynamic lib on Windows Thanks @nacho for pointing it out. --- contrib/meson/lib/meson.build | 7 ++++++- contrib/meson/meson.build | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/meson/lib/meson.build b/contrib/meson/lib/meson.build index f1deb58..e782334 100644 --- a/contrib/meson/lib/meson.build +++ b/contrib/meson/lib/meson.build @@ -27,6 +27,10 @@ if use_debug endif liblz4_c_args += cc.get_supported_arguments(liblz4_debug_cflags) +if host_machine_os == os_windows and default_library != 'static' + liblz4_c_args += '-DLZ4_DLL_EXPORT=1' +endif + liblz4 = library('lz4', liblz4_sources, include_directories: liblz4_includes, @@ -47,6 +51,7 @@ pkgconfig.generate(liblz4, install_headers(join_paths(lz4_root_dir, 'lib/lz4.h'), join_paths(lz4_root_dir, 'lib/lz4hc.h'), join_paths(lz4_root_dir, 'lib/lz4frame.h')) -if get_option('default_library') != 'shared' + +if default_library != 'shared' install_headers(join_paths(lz4_root_dir, 'lib/lz4frame_static.h')) endif diff --git a/contrib/meson/meson.build b/contrib/meson/meson.build index e25e7c0..bf30eae 100644 --- a/contrib/meson/meson.build +++ b/contrib/meson/meson.build @@ -18,6 +18,7 @@ cc = meson.get_compiler('c') pkgconfig = import('pkgconfig') python3 = import('python').find_installation() c_std = get_option('c_std') +default_library = get_option('default_library') host_machine_os = host_machine.system() os_windows = 'windows'