meson: don't link pthreads when internal impl is used

This commit is contained in:
Kacper Michajłow 2023-09-15 16:51:44 +02:00 committed by Dudemanguy
parent d0e4eabb4e
commit d263087713
2 changed files with 11 additions and 4 deletions

View File

@ -24,7 +24,6 @@ libswresample = dependency('libswresample', version: '>= 3.9.100')
libswscale = dependency('libswscale', version: '>= 5.9.100') libswscale = dependency('libswscale', version: '>= 5.9.100')
libass = dependency('libass', version: '>= 0.12.2') libass = dependency('libass', version: '>= 0.12.2')
pthreads = dependency('threads')
# the dependency order of libass -> ffmpeg is necessary due to # the dependency order of libass -> ffmpeg is necessary due to
# static linking symbol resolution between fontconfig and MinGW # static linking symbol resolution between fontconfig and MinGW
@ -34,8 +33,7 @@ dependencies = [libass,
libavformat, libavformat,
libavutil, libavutil,
libswresample, libswresample,
libswscale, libswscale]
pthreads]
# Keeps track of all enabled/disabled features # Keeps track of all enabled/disabled features
features = { features = {
@ -364,6 +362,11 @@ if features['win32-internal-pthreads']
# Hack around it by using HAVE_WIN32_INTERNAL_PTHREADS. # Hack around it by using HAVE_WIN32_INTERNAL_PTHREADS.
includedir += include_directories('osdep/win32/include') includedir += include_directories('osdep/win32/include')
sources += files('osdep/win32/pthread.c') sources += files('osdep/win32/pthread.c')
else
# pthreads is intentionally left undefined in win32 branch to find incorrect
# uses of it immediately
pthreads = dependency('threads')
dependencies += pthreads
endif endif
pthread_debug = get_option('pthread-debug').require( pthread_debug = get_option('pthread-debug').require(

View File

@ -31,6 +31,9 @@ test_utils_files = [
'ta/ta_talloc.c', 'ta/ta_talloc.c',
'ta/ta_utils.c' 'ta/ta_utils.c'
] ]
test_utils_deps = [libavutil, libm]
# The zimg code requires using threads. On windows, threads # The zimg code requires using threads. On windows, threads
# also requires timer code so this is added. # also requires timer code so this is added.
if features['win32-internal-pthreads'] if features['win32-internal-pthreads']
@ -39,9 +42,10 @@ if features['win32-internal-pthreads']
'osdep/timer-win2.c', 'osdep/timer-win2.c',
'osdep/win32/pthread.c', 'osdep/win32/pthread.c',
'osdep/windows_utils.c'] 'osdep/windows_utils.c']
else
test_utils_deps += pthreads
endif endif
test_utils_deps = [libavutil, libm, pthreads]
if features['win32-desktop'] if features['win32-desktop']
test_utils_deps += cc.find_library('winmm') test_utils_deps += cc.find_library('winmm')
endif endif