From 0ea374b1c78156f83a7544458dbd058c744deef3 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 5 Oct 2023 13:59:55 -0500 Subject: [PATCH] meson: generate .com in the same place as the .exe if possible Meson was pretty strict about target ids and generating the mpv.com in the same directory as mpv.exe wasn't possible. So as a workaround we tucked it away in a subdirectory, but that's not really intuitive at all. Well as of meson 1.3.0, this is now possible so leverage it since it makes way more sense. We still keep the old workaround for anyone using older meson versions. --- meson.build | 7 +++++++ player/meson.build | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 0ff16b42d9..a47aa54ce2 100644 --- a/meson.build +++ b/meson.build @@ -1686,6 +1686,13 @@ features += {'libmpv-' + get_option('default_library'): get_option('libmpv')} # build targets if win32 + # Older meson versions generate this in the player subdirectory. + if get_option('cplayer') 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 + windows = import('windows') res_flags = ['--codepage=65001'] diff --git a/player/meson.build b/player/meson.build index dc334b8c96..be1e812d3e 100644 --- a/player/meson.build +++ b/player/meson.build @@ -1,10 +1,11 @@ subdir('javascript') subdir('lua') -# Meson doesn't allow having multiple build targets with the same name in the same file. -# Just generate the com in here for windows builds. -if win32 and get_option('cplayer') +# Older versions of meson don't allow multiple build targets with the same name in the same +# file. Generate it here for compatibility reasons for windows. +if win32 and get_option('cplayer') 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) + warning('mpv.com executable will be generated in the player subdirectory.') endif