meson: don't add -pthread to static linking flags on Windows
Meson always returns -pthread in dependency('threads') on non-MSVC
compilers. On Windows we use Windows threading primitives, so we don't
need this. Avoid adding -pthread to libzstd's link flags, either as a
Meson subproject or via pkg-config Libs.private, so the application
doesn't inadvertently depend on winpthreads.
Add a Meson MinGW cross-compile CI test that checks for this. It turns
out that pzstd fails to build in that environment, so have the test
skip building contrib for now.
This commit is contained in:
@@ -88,8 +88,13 @@ feature_lz4 = get_option('lz4')
|
||||
# =============================================================================
|
||||
|
||||
libm_dep = cc.find_library('m', required: false)
|
||||
thread_dep = dependency('threads', required: feature_multi_thread)
|
||||
use_multi_thread = thread_dep.found()
|
||||
if host_machine_os == os_windows
|
||||
thread_dep = dependency('', required: false)
|
||||
use_multi_thread = not feature_multi_thread.disabled()
|
||||
else
|
||||
thread_dep = dependency('threads', required: feature_multi_thread)
|
||||
use_multi_thread = thread_dep.found()
|
||||
endif
|
||||
# Arguments in dependency should be equivalent to those passed to pkg-config
|
||||
zlib_dep = dependency('zlib', required: feature_zlib)
|
||||
use_zlib = zlib_dep.found()
|
||||
|
||||
@@ -27,7 +27,7 @@ option('bin_contrib', type: 'boolean', value: false,
|
||||
description: 'Enable contrib build')
|
||||
|
||||
option('multi_thread', type: 'feature', value: 'enabled',
|
||||
description: 'Enable multi-threading when pthread is detected')
|
||||
description: 'Enable multi-threading when pthread or Windows is detected')
|
||||
option('zlib', type: 'feature', value: 'auto',
|
||||
description: 'Enable zlib support')
|
||||
option('lzma', type: 'feature', value: 'auto',
|
||||
|
||||
Reference in New Issue
Block a user