diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
commit | 60e8a3d404f0640fa5a3f834eae54b4f1fb9127d (patch) | |
tree | 1da89a218d0ecf010c67a87cb2f625c4cb18e7d7 /meson.build | |
parent | Adding upstream version 0.37.0. (diff) | |
download | mpv-60e8a3d404f0640fa5a3f834eae54b4f1fb9127d.tar.xz mpv-60e8a3d404f0640fa5a3f834eae54b4f1fb9127d.zip |
Adding upstream version 0.38.0.upstream/0.38.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 293 |
1 files changed, 166 insertions, 127 deletions
diff --git a/meson.build b/meson.build index fdfc526..2c2246b 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,7 @@ project('mpv', 'buildtype=debugoptimized', 'b_lundef=false', 'c_std=c11', - 'warning_level=1', + 'warning_level=2', ] ) @@ -23,7 +23,8 @@ libavutil = dependency('libavutil', version: '>= 56.70.100') libswresample = dependency('libswresample', version: '>= 3.9.100') libswscale = dependency('libswscale', version: '>= 5.9.100') -libplacebo = dependency('libplacebo', version: '>=6.338.0') +libplacebo = dependency('libplacebo', version: '>=6.338.2', + default_options: ['default_library=static', 'demos=false']) libass = dependency('libass', version: '>= 0.12.2') @@ -46,7 +47,6 @@ features = { 'jpegxl': libavformat.version().version_compare('>= 59.27.100'), 'avif-muxer': libavformat.version().version_compare('>= 59.24.100'), 'libass': true, - 'threads': true, 'libplacebo': true, } @@ -133,10 +133,12 @@ sources = files( 'misc/bstr.c', 'misc/charset_conv.c', 'misc/dispatch.c', + 'misc/io_utils.c', 'misc/json.c', 'misc/language.c', 'misc/natural_sort.c', 'misc/node.c', + 'misc/path_utils.c', 'misc/random.c', 'misc/rendezvous.c', 'misc/thread_pool.c', @@ -246,7 +248,7 @@ sources = files( ## osdep 'osdep/io.c', - 'osdep/semaphore_osx.c', + 'osdep/semaphore-mac.c', 'osdep/subprocess.c', 'osdep/timer.c', @@ -260,10 +262,14 @@ sources = files( # compiler stuff cc = meson.get_compiler('c') -flags = ['-D_GNU_SOURCE', '-D_FILE_OFFSET_BITS=64'] +flags = ['-D_FILE_OFFSET_BITS=64'] link_flags = [] test_flags = ['-Werror=implicit-function-declaration', + '-Wno-missing-field-initializers', + '-Wno-sign-compare', + '-Wno-unused-parameter', + '-Wno-cast-function-type', '-Wempty-body', '-Wdisabled-optimization', '-Wstrict-prototypes', @@ -304,30 +310,30 @@ features += {'darwin': darwin} features += {'posix': posix} features += {'dos-paths': win32, 'win32': win32} -mswin_flags = ['-D_WIN32_WINNT=0x0602', '-DUNICODE', '-DCOBJMACROS', - '-DINITGUID', '-U__STRICT_ANSI__'] +mswin_flags = ['-D_WIN32_WINNT=0x0602', '-DWINVER=0x0602', '-DUNICODE', + '-DCOBJMACROS', '-DINITGUID', '-U__STRICT_ANSI__', '-DNOMINMAX', + '-D_USE_MATH_DEFINES', '-DWIN32_LEAN_AND_MEAN'] if host_machine.system() == 'windows' - flags += [mswin_flags, '-D__USE_MINGW_ANSI_STDIO=1'] + flags += [mswin_flags] endif if host_machine.system() == 'cygwin' flags += [mswin_flags, '-mwin32'] endif -noexecstack = false +if posix + flags += ['-D_GNU_SOURCE'] +endif + if cc.has_link_argument('-Wl,-z,noexecstack') link_flags += '-Wl,-z,noexecstack' - noexecstack = true endif if cc.has_link_argument('-Wl,--nxcompat,--no-seh,--dynamicbase') link_flags += '-Wl,--nxcompat,--no-seh,--dynamicbase' - noexecstack = true endif -features += {'noexecstack': noexecstack} - features += {'build-date': get_option('build-date')} if not features['build-date'] flags += '-DNO_BUILD_TIMESTAMPS' @@ -362,6 +368,7 @@ if not features['win32-threads'] features += {'pthread-condattr-setclock': cc.has_header_symbol('pthread.h', 'pthread_condattr_setclock', + args: '-D_GNU_SOURCE', dependencies: pthreads)} dependencies += pthreads endif @@ -373,6 +380,7 @@ pthread_debug = get_option('pthread-debug').require( features += {'pthread-debug': pthread_debug.allowed()} add_project_arguments(flags, language: 'c') +add_project_arguments(['-Wno-unused-parameter'], language: 'objc') add_project_link_arguments(link_flags, language: ['c', 'objc']) @@ -382,18 +390,20 @@ cocoa = dependency('appleframeworks', modules: ['Cocoa', 'IOKit', 'QuartzCore'], features += {'cocoa': cocoa.found()} if features['cocoa'] dependencies += cocoa - sources += files('osdep/apple_utils.c', - 'osdep/language-apple.c', - 'osdep/macosx_application.m', - 'osdep/macosx_events.m', - 'osdep/macosx_menubar.m', - 'osdep/main-fn-cocoa.c', - 'osdep/path-macosx.m') + sources += files('osdep/language-mac.c', + 'osdep/path-mac.m', + 'osdep/utils-mac.c', + 'osdep/mac/app_bridge.m') + main_fn_source = files('osdep/main-fn-mac.c') endif if posix path_source = files('osdep/path-unix.c') - subprocess_source = files('osdep/subprocess-posix.c') + if cc.has_function('fork', prefix : '#include <unistd.h>') + subprocess_source = files('osdep/subprocess-posix.c') + else + subprocess_source = files('osdep/subprocess-dummy.c') + endif sources += files('input/ipc-unix.c', 'osdep/poll_wrapper.c', 'osdep/terminal-unix.c', @@ -401,8 +411,8 @@ if posix endif if posix and not features['cocoa'] - sources += files('osdep/main-fn-unix.c', - 'osdep/language-posix.c') + sources += files('osdep/language-posix.c') + main_fn_source = files('osdep/main-fn-unix.c') endif if darwin @@ -479,21 +489,23 @@ if features['win32-desktop'] win32_desktop_libs = [cc.find_library('avrt'), cc.find_library('dwmapi'), cc.find_library('gdi32'), + cc.find_library('imm32'), + cc.find_library('ntdll'), cc.find_library('ole32'), cc.find_library('uuid'), cc.find_library('uxtheme'), - cc.find_library('version'), - cc.find_library('winmm')] + cc.find_library('version')] dependencies += win32_desktop_libs path_source = files('osdep/path-win.c') subprocess_source = files('osdep/subprocess-win.c') sources += files('input/ipc-win.c', 'osdep/language-win.c', - 'osdep/main-fn-win.c', 'osdep/terminal-win.c', 'video/out/w32_common.c', 'video/out/win32/displayconfig.c', - 'video/out/win32/droptarget.c') + 'video/out/win32/droptarget.c', + 'video/out/win32/menu.c') + main_fn_source = files('osdep/main-fn-win.c') endif if not posix and not features['win32-desktop'] @@ -504,7 +516,7 @@ endif features += {'glob-posix': cc.has_function('glob', prefix: '#include <glob.h>')} -features += {'glob-win32': win32 and not posix} +features += {'glob-win32': win32 and not features['glob-posix']} if features['glob-win32'] sources += files('osdep/glob-win.c') endif @@ -516,16 +528,16 @@ features += {'vt.h': cc.has_header_symbol('sys/vt.h', 'VT_GETMODE')} features += {'consio.h': not features['vt.h'] and cc.has_header_symbol('sys/consio.h', 'VT_GETMODE')} # macOS's pthread_setname_np is a special snowflake and differs from literally every other platform. -features += {'osx-thread-name': darwin} +features += {'mac-thread-name': darwin} features += {'glibc-thread-name': false} -if not features['osx-thread-name'] +if not features['mac-thread-name'] features += {'glibc-thread-name': posix and cc.has_function('pthread_setname_np', args: '-D_GNU_SOURCE', dependencies: pthreads, prefix: '#include <pthread.h>')} endif features += {'bsd-thread-name': false} -if not features['osx-thread-name'] and not features['glibc-thread-name'] +if not features['mac-thread-name'] and not features['glibc-thread-name'] features += {'bsd-thread-name': posix and cc.has_function('pthread_set_name_np', dependencies: pthreads, prefix: '#include <pthread.h>\n#include <pthread_np.h>')} endif @@ -593,11 +605,12 @@ if features['cdda'] sources += files('stream/stream_cdda.c') endif -dvbin = get_option('dvbin').require( +dvbin_opt = get_option('dvbin').require( get_option('gpl'), error_message: 'the build is not GPL!', ) -features += {'dvbin': dvbin.allowed()} +dvbin = cc.has_header('linux/dvb/frontend.h', required: dvbin_opt) +features += {'dvbin': dvbin} if features['dvbin'] sources += files('stream/dvb_tune.c', 'stream/stream_dvb.c') @@ -657,14 +670,12 @@ if features['libbluray'] endif libm = cc.find_library('m', required: false) -features += {'libm': libm.found()} -if features['libm'] +if libm.found() dependencies += libm endif librt = cc.find_library('rt', required: false) -features += {'librt': librt.found()} -if features['librt'] +if librt.found() dependencies += librt endif @@ -701,13 +712,13 @@ if features['lua'] sources += files('player/lua.c') endif if not features['lua'] and lua_opt == 'enabled' - error('lua enabled but no suitable lua version could be found!') + error('Lua enabled but no suitable Lua version could be found!') endif rubberband = dependency('rubberband', version: '>= 1.8.0', required: get_option('rubberband')) features += {'rubberband': rubberband.found()} -features += {'rubberband-3': rubberband.version().version_compare('>= 3.0.0')} if features['rubberband'] + features += {'rubberband-3': rubberband.version().version_compare('>= 3.0.0')} dependencies += rubberband sources += files('audio/filter/af_rubberband.c') endif @@ -775,11 +786,12 @@ if features['alsa'] sources += files('audio/out/ao_alsa.c') endif +audiounit_opt = get_option('audiounit').require(darwin) audiounit = { 'deps': dependency('appleframeworks', modules: ['Foundation', 'AudioToolbox'], - required: get_option('audiounit')), + required: audiounit_opt), 'symbol': cc.has_header_symbol('AudioToolbox/AudioToolbox.h', 'kAudioUnitSubType_RemoteIO', - required: get_option('audiounit')), + required: audiounit_opt), } features += {'audiounit': audiounit['deps'].found() and audiounit['symbol']} if features['audiounit'] @@ -787,6 +799,14 @@ if features['audiounit'] sources += files('audio/out/ao_audiounit.m') endif +avfoundation = dependency('appleframeworks', modules: ['CoreMedia', 'AVFoundation'], + required: get_option('avfoundation')) +features += {'avfoundation': avfoundation.found()} +if features['avfoundation'] + dependencies += avfoundation + sources += files('audio/out/ao_avfoundation.m') +endif + coreaudio = dependency('appleframeworks', modules: ['CoreFoundation', 'CoreAudio', 'AudioUnit', 'AudioToolbox'], required: get_option('coreaudio')) features += {'coreaudio': coreaudio.found()} @@ -797,9 +817,10 @@ if features['coreaudio'] 'audio/out/ao_coreaudio_properties.c') endif -if features['audiounit'] or features['coreaudio'] +if features['audiounit'] or features['coreaudio'] or features['avfoundation'] sources += files('audio/out/ao_coreaudio_chmap.c', - 'audio/out/ao_coreaudio_utils.c') + 'audio/out/ao_coreaudio_utils.c', + 'audio/out/ao_coreaudio_properties.c') endif jack_opt = get_option('jack').require( @@ -868,7 +889,8 @@ if features['sndio'] sources += files('audio/out/ao_sndio.c') endif -wasapi = cc.has_header_symbol('audioclient.h', 'IAudioClient', required: get_option('wasapi')) +wasapi = cc.has_header_symbol('audioclient.h', 'IAudioClient', required: + get_option('wasapi').require(win32)) features += {'wasapi': wasapi} if features['wasapi'] sources += files('audio/out/ao_wasapi.c', @@ -912,7 +934,11 @@ if features['drm'] 'video/out/vo_drm.c') endif -gbm = dependency('gbm', version: '>=17.1.0', required: get_option('gbm')) +gbm_opt = get_option('gbm').require( + features['drm'], + error_message: 'drm was not found!' +) +gbm = dependency('gbm', version: '>= 17.1.0', required: gbm_opt) features += {'gbm': gbm.found()} if features['gbm'] dependencies += gbm @@ -933,7 +959,8 @@ if features['sdl2-video'] sources += files('video/out/vo_sdl.c') endif -shaderc = dependency('shaderc', required: get_option('shaderc')) +shaderc = dependency('shaderc', required: + get_option('shaderc').require(features['win32-desktop'])) features += {'shaderc': shaderc.found()} if features['shaderc'] dependencies += shaderc @@ -952,7 +979,8 @@ if features['posix'] features += {'posix-shm': cc.has_function('shm_open', prefix: '#include <sys/mman.h>')} endif -spirv_cross = dependency('spirv-cross-c-shared', required: get_option('spirv-cross')) +spirv_cross = dependency('spirv-cross-c-shared', required: + get_option('spirv-cross').require(features['win32-desktop'])) features += {'spirv-cross': spirv_cross.found()} if features['spirv-cross'] dependencies += spirv_cross @@ -1049,7 +1077,7 @@ if features['xv'] sources += files('video/out/vo_xv.c') endif -if features['wayland'] or features['x11'] +if features['wayland'] or features['x11'] or features['drm'] sources += ('video/out/present_sync.c') endif @@ -1099,12 +1127,11 @@ if features['gl-x11'] sources += files('video/out/opengl/context_glx.c') endif -gl_dxinterop_d3d = gl_win32.allowed() and \ - cc.has_header_symbol('GL/wglext.h', 'WGL_ACCESS_READ_ONLY_NV', - prefix: '#include <GL/gl.h>') -gl_dxinterop_gl = features['gl-win32'] and cc.has_header_symbol('d3d9.h', 'IDirect3D9Ex') gl_dxinterop = get_option('gl-dxinterop').require( - gl_dxinterop_d3d and gl_dxinterop_gl and gl_win32.allowed(), + features['gl-win32'] and + cc.has_header_symbol('GL/wglext.h', 'WGL_ACCESS_READ_ONLY_NV', + prefix: '#include <GL/gl.h>') and + cc.has_header_symbol('d3d9.h', 'IDirect3D9Ex'), error_message: 'gl-dxinterop could not be found!', ) features += {'gl-dxinterop': gl_dxinterop.allowed()} @@ -1128,9 +1155,10 @@ if features['egl-angle'] sources += files('video/out/opengl/angle_dynamic.c') endif -egl_dep = cc.find_library('EGL', required: get_option('egl-angle-lib')) +egl_dep = cc.find_library('EGL', required: + get_option('egl-angle-lib').require(features['egl-angle'])) egl_angle_lib = get_option('egl-angle-lib').require( - features['egl-angle'] and cc.has_function('eglCreateWindowSurface', + egl_dep.found() and cc.has_function('eglCreateWindowSurface', dependencies: egl_dep, prefix: '#include <EGL/egl.h>'), error_message: 'egl-angle-lib could not be found!', @@ -1153,7 +1181,7 @@ if features['d3d11'] or features['egl-angle-win32'] sources += files('video/out/gpu/d3d11_helpers.c') endif -egl = dependency('egl', version: '> 1.4.0', required: get_option('egl')) +egl = dependency('egl', version: '>= 1.4.0', required: get_option('egl')) features += {'egl': egl.found() and gl_allowed} if features['egl'] dependencies += egl @@ -1172,7 +1200,7 @@ if features['egl-android'] endif egl_drm = get_option('egl-drm').require( - features['drm'] and features['egl'] and gbm.found() and gl_allowed, + features['drm'] and features['egl'] and features['gbm'] and gl_allowed, error_message: 'either drm, egl, or gbm could not be found!', ) features += {'egl-drm': egl_drm.allowed()} @@ -1181,8 +1209,12 @@ if features['egl-drm'] sources += files('video/out/opengl/context_drm_egl.c') endif -egl_wayland = dependency('wayland-egl', version: '>= 9.0.0', required: get_option('egl-wayland')) -features += {'egl-wayland': features['egl'] and egl_wayland.found() and gl_allowed and features['wayland']} +egl_wayland_opt = get_option('egl-wayland').require( + features['egl'] and features['wayland'] and gl_allowed, + error_message: 'either egl or wayland could not be found!', +) +egl_wayland = dependency('wayland-egl', version: '>= 9.0.0', required: egl_wayland_opt) +features += {'egl-wayland': egl_wayland.found()} if features['egl-wayland'] dependencies += egl_wayland features += {'gl': true} @@ -1207,21 +1239,11 @@ if plain_gl.allowed() features += {'gl': true} endif -rpi = dependency('/opt/vc/lib/pkgconfig/brcmegl.pc', 'brcmegl', required: get_option('rpi')) -features += {'rpi': gl_allowed and rpi.found()} -if features['rpi'] - dependencies += rpi - features += {'gl': true} - sources += files('video/out/opengl/context_rpi.c') -endif - -features += {'egl-helpers': features['egl'] or egl_android.found() or - egl_angle_win32.allowed() or features['rpi']} -if features['egl-helpers'] +if features['egl'] or features['egl-android'] or features['egl-angle-win32'] sources += files('video/out/opengl/egl_helpers.c') endif -if features['egl'] and features['egl-helpers'] +if features['gl'] and features['egl'] sources += files('video/filter/vf_gpu.c') endif @@ -1281,15 +1303,6 @@ if features['ffnvcodec'] sources += files('video/cuda.c') endif -android_media_ndk = get_option('android-media-ndk').require( - features['android'] and cc.has_header_symbol('media/NdkImageReader.h', 'AIMAGE_FORMAT_PRIVATE') -) -features += {'android-media-ndk': android_media_ndk.allowed()} -if features['android-media-ndk'] - # header only, library is dynamically loaded - sources += files('video/out/hwdec/hwdec_aimagereader.c') -endif - cuda_hwaccel = get_option('cuda-hwaccel').require( features['ffnvcodec'], error_message: 'ffnvcodec was not found!', @@ -1303,7 +1316,7 @@ cuda_interop = get_option('cuda-interop').require( features['cuda-hwaccel'] and (features['gl'] or features['vulkan']), error_message: 'cuda-hwaccel and either gl or vulkan were not found!', ) -features += {'cuda-interop': cuda_interop.allowed() and (features['gl'] or features['vulkan'])} +features += {'cuda-interop': cuda_interop.allowed()} if features['cuda-interop'] and features['gl'] sources += files('video/out/hwdec/hwdec_cuda_gl.c') endif @@ -1311,13 +1324,22 @@ if features['cuda-interop'] and features['vulkan'] sources += files('video/out/hwdec/hwdec_cuda_vk.c') endif +android_media_ndk = get_option('android-media-ndk').require( + features['android'] and cc.has_header_symbol('media/NdkImageReader.h', 'AIMAGE_FORMAT_PRIVATE') +) +features += {'android-media-ndk': android_media_ndk.allowed()} +if features['android-media-ndk'] + # header only, library is dynamically loaded + sources += files('video/out/hwdec/hwdec_aimagereader.c') +endif + vulkan_interop = get_option('vulkan-interop').require( features['vulkan'] and vulkan.version().version_compare('>=1.3.238') and libavutil.version().version_compare('>=58.11.100'), error_message: 'Vulkan Interop requires vulkan headers >= 1.3.238, and libavutil >= 58.11.100', ) features += {'vulkan-interop': vulkan_interop.allowed()} -if vulkan_interop.allowed() +if features['vulkan-interop'] sources += files('video/out/hwdec/hwdec_vulkan.c') endif @@ -1331,7 +1353,7 @@ if features['d3d-hwaccel'] 'video/filter/vf_d3d11vpp.c') endif -if features['d3d-hwaccel'] and egl_angle.allowed() +if features['d3d-hwaccel'] and features['egl-angle'] sources += files('video/out/opengl/hwdec_d3d11egl.c') endif if features['d3d-hwaccel'] and features['d3d11'] @@ -1359,50 +1381,48 @@ if features['gl-dxinterop-d3d9'] sources += files('video/out/opengl/hwdec_dxva2gldx.c') endif -ios_gl = cc.has_header_symbol('OpenGLES/ES3/glext.h', 'GL_RGB32F', required: get_option('ios-gl')) +# this is an arbitrary GLES 3.x symbol +ios_gl = cc.has_header_symbol('OpenGLES/ES3/glext.h', 'GL_RGB32F', required: + get_option('ios-gl').require(darwin)) features += {'ios-gl': ios_gl} if features['ios-gl'] sources += files('video/out/hwdec/hwdec_ios_gl.m') endif -rpi_mmal_opt = get_option('rpi-mmal').require( - features['rpi'], - error_message: 'rpi was not found!', -) -rpi_mmal = dependency('/opt/vc/lib/pkgconfig/mmal.pc', 'mmal', required: rpi_mmal_opt) -features += {'rpi-mmal': rpi_mmal.found()} -if features['rpi-mmal'] - dependencies += rpi_mmal - sources += files('video/out/opengl/hwdec_rpi.c', - 'video/out/vo_rpi.c') -endif - libva = dependency('libva', version: '>= 1.1.0', required: get_option('vaapi')) -vaapi_drm = dependency('libva-drm', version: '>= 1.1.0', - required: get_option('vaapi-drm').require(libva.found() and features['drm'])) +vaapi_drm = dependency('libva-drm', version: '>= 1.1.0', required: + get_option('vaapi-drm').require(libva.found() and features['drm'])) features += {'vaapi-drm': vaapi_drm.found()} if features['vaapi-drm'] dependencies += vaapi_drm endif -vaapi_wayland = dependency('libva-wayland', version: '>= 1.1.0', - required: get_option('vaapi-wayland').require(libva.found() and features['wayland'])) +vaapi_wayland = dependency('libva-wayland', version: '>= 1.1.0', required: + get_option('vaapi-wayland').require(libva.found() and features['wayland'])) features += {'vaapi-wayland': vaapi_wayland.found()} if features['vaapi-wayland'] dependencies += vaapi_wayland endif -vaapi_x11 = dependency('libva-x11', version: '>= 1.1.0', - required: get_option('vaapi-x11').require(libva.found() and features['x11'])) +vaapi_x11 = dependency('libva-x11', version: '>= 1.1.0', required: + get_option('vaapi-x11').require(libva.found() and features['x11'])) features += {'vaapi-x11': vaapi_x11.found()} if features['vaapi-x11'] dependencies += vaapi_x11 sources += files('video/out/vo_vaapi.c') endif +vaapi_win32 = dependency('libva-win32', required: + get_option('vaapi-win32').require(libva.found() and win32)) +features += {'vaapi-win32': vaapi_win32.found()} +if features['vaapi-win32'] + dependencies += vaapi_win32 +endif + vaapi = get_option('vaapi').require(libva.found() and (features['vaapi-drm'] or - features['vaapi-wayland'] or features['vaapi-x11'])) + features['vaapi-wayland'] or features['vaapi-x11'] or + features['vaapi-win32'])) features += {'vaapi': vaapi.allowed()} if features['vaapi'] @@ -1413,8 +1433,7 @@ if features['vaapi'] 'video/out/hwdec/dmabuf_interop_pl.c') endif -dmabuf_interop_gl = features['egl'] and features['drm'] -features += {'dmabuf-interop-gl': dmabuf_interop_gl} +features += {'dmabuf-interop-gl': features['egl'] and features['drm']} if features['dmabuf-interop-gl'] sources += files('video/out/hwdec/dmabuf_interop_gl.c') endif @@ -1433,7 +1452,7 @@ if features['vdpau'] 'video/vdpau_mixer.c') endif -features += {'vdpau-gl-x11': vdpau.found() and gl_x11.allowed()} +features += {'vdpau-gl-x11': features['vdpau'] and gl_x11.allowed()} if features['vdpau'] and features['vdpau-gl-x11'] sources += files('video/out/opengl/hwdec_vdpau.c') endif @@ -1443,13 +1462,14 @@ videotoolbox_gl = get_option('videotoolbox-gl').require( error_message: 'gl-cocoa nor ios-gl could be found!', ) features += {'videotoolbox-gl': videotoolbox_gl.allowed()} -corevideo = dependency('appleframeworks', modules: ['CoreVideo'], required: get_option('videotoolbox-pl')) +corevideo = dependency('appleframeworks', modules: ['CoreVideo'], required: + get_option('videotoolbox-pl').require(darwin)) videotoolbox_pl = get_option('videotoolbox-pl').require( features['vulkan'] and corevideo.found(), error_message: 'vulkan or CV metal support could be found!', ) features += {'videotoolbox-pl': videotoolbox_pl.allowed()} -if features['videotoolbox-gl'] or features['videotoolbox-pl'] +if features['videotoolbox-gl'] or features['videotoolbox-pl'] or features['ios-gl'] sources += files('video/out/hwdec/hwdec_vt.c') endif if features['videotoolbox-gl'] @@ -1512,12 +1532,19 @@ features += {'swift': swift.allowed()} swift_sources = [] if features['cocoa'] and features['swift'] - swift_sources += files('osdep/macos/libmpv_helper.swift', - 'osdep/macos/log_helper.swift', - 'osdep/macos/mpv_helper.swift', - 'osdep/macos/precise_timer.swift', - 'osdep/macos/swift_compat.swift', - 'osdep/macos/swift_extensions.swift', + swift_sources += files('osdep/mac/application.swift', + 'osdep/mac/app_hub.swift', + 'osdep/mac/event_helper.swift', + 'osdep/mac/input_helper.swift', + 'osdep/mac/libmpv_helper.swift', + 'osdep/mac/log_helper.swift', + 'osdep/mac/menu_bar.swift', + 'osdep/mac/option_helper.swift', + 'osdep/mac/precise_timer.swift', + 'osdep/mac/presentation.swift', + 'osdep/mac/swift_compat.swift', + 'osdep/mac/swift_extensions.swift', + 'osdep/mac/type_helper.swift', 'video/out/mac/common.swift', 'video/out/mac/title_bar.swift', 'video/out/mac/view.swift', @@ -1545,11 +1572,7 @@ macos_media_player = get_option('macos-media-player').require( ) features += {'macos-media-player': macos_media_player.allowed()} if features['macos-media-player'] - swift_sources += files('osdep/macos/remote_command_center.swift') -endif - -if features['swift'] and swift_sources.length() > 0 - subdir('osdep') + swift_sources += files('osdep/mac/remote_command_center.swift') endif macos_touchbar = get_option('macos-touchbar').require( @@ -1558,15 +1581,18 @@ macos_touchbar = get_option('macos-touchbar').require( ) features += {'macos-touchbar': macos_touchbar.allowed()} if features['macos-touchbar'] - sources += files('osdep/macosx_touchbar.m') + swift_sources += files('osdep/mac/touch_bar.swift') +endif + +if features['swift'] and swift_sources.length() > 0 + subdir('osdep/mac') endif # manpages manpage = 'DOCS/man/mpv.rst' rst2man = find_program('rst2man', 'rst2man.py', required: get_option('manpage-build')) -features += {'manpage-build': rst2man.found()} -if features['manpage-build'] +if rst2man.found() mandir = get_option('mandir') custom_target('manpages', input: manpage, @@ -1583,8 +1609,7 @@ if features['manpage-build'] endif rst2html = find_program('rst2html', 'rst2html.py', required: get_option('html-build')) -features += {'html-build': rst2html.found()} -if features['html-build'] +if rst2html.found() datadir = get_option('datadir') custom_target('html-manpages', input: manpage, @@ -1600,8 +1625,7 @@ if features['html-build'] endif rst2pdf = find_program('rst2pdf', required: get_option('pdf-build')) -features += {'pdf-build': rst2pdf.found()} -if features['pdf-build'] +if rst2pdf.found() dependency_file = rst2pdf.version().version_compare('>=0.100') datadir = get_option('datadir') custom_target('pdf-manpages', @@ -1746,8 +1770,23 @@ if get_option('cplayer') rename: 'mpv.svg') install_data('etc/mpv-symbolic.svg', install_dir: join_paths(hicolor_dir, 'symbolic', 'apps')) - mpv = executable('mpv', objects: libmpv.extract_all_objects(recursive: true), dependencies: dependencies, + mpv = executable('mpv', main_fn_source, objects: libmpv.extract_all_objects(recursive: true), dependencies: dependencies, win_subsystem: 'windows,6.0', install: true) + + # Older meson versions generate this in the player subdirectory. + if win32 and meson.version().version_compare('>= 1.3.0') + wrapper_sources= 'osdep/win32-console-wrapper.c' + executable('mpv', wrapper_sources, c_args: '-municode', link_args: '-municode', + name_suffix: 'com', install: true) + endif + + if darwin + osxbundle = find_program(join_paths(tools_directory, 'osxbundle.py'), required: true) + custom_target('macos-bundle', + output: 'mpv.app', + command: [osxbundle, mpv.full_path(), '@SOURCE_ROOT@'], + ) + endif endif if get_option('tests') |