Merge pull request #4153 from artem/fix-meson-includes

meson: Do not export private headers in libzstd_dep to avoid name clash
This commit is contained in:
Yann Collet 2024-10-02 16:51:44 -07:00 committed by GitHub
commit 75b0f5f4f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 6 deletions

View File

@ -20,6 +20,6 @@ pzstd = executable('pzstd',
pzstd_sources,
cpp_args: pzstd_warning_flags,
include_directories: pzstd_includes,
dependencies: [ libzstd_dep, thread_dep ],
dependencies: [ libzstd_internal_dep, thread_dep ],
override_options: ['b_ndebug=true'],
install: true)

View File

@ -124,7 +124,7 @@ libzstd = library('zstd',
version: zstd_libversion)
libzstd_dep = declare_dependency(link_with: libzstd,
include_directories: libzstd_includes)
include_directories: join_paths(zstd_rootdir,'lib')) # Do not expose private headers
# we link to both:
# - the shared library (for public symbols)
@ -134,7 +134,8 @@ libzstd_dep = declare_dependency(link_with: libzstd,
# -fvisibility=hidden means those cannot be found
if get_option('default_library') == 'static'
libzstd_static = libzstd
libzstd_internal_dep = libzstd_dep
libzstd_internal_dep = declare_dependency(link_with: libzstd,
include_directories: libzstd_includes)
else
if get_option('default_library') == 'shared'
libzstd_static = static_library('zstd_objlib',
@ -147,11 +148,13 @@ else
if cc_id == compiler_msvc
# msvc does not actually support linking to both, but errors out with:
# error LNK2005: ZSTD_<foo> already defined in zstd.lib(zstd-1.dll)
libzstd_internal_dep = declare_dependency(link_with: libzstd_static)
libzstd_internal_dep = declare_dependency(link_with: libzstd_static,
include_directories: libzstd_includes)
else
libzstd_internal_dep = declare_dependency(link_with: libzstd,
# the static library must be linked after the shared one
dependencies: declare_dependency(link_with: libzstd_static))
dependencies: declare_dependency(link_with: libzstd_static),
include_directories: libzstd_includes)
endif
endif

View File

@ -93,7 +93,7 @@ roundTripCrash = executable('roundTripCrash',
longmatch_sources = [join_paths(zstd_rootdir, 'tests/longmatch.c')]
longmatch = executable('longmatch',
longmatch_sources,
dependencies: [ libzstd_dep ],
dependencies: [ libzstd_internal_dep ],
install: false)
invalidDictionaries_sources = [join_paths(zstd_rootdir, 'tests/invalidDictionaries.c')]