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.
This commit is contained in:
Dudemanguy 2023-10-05 13:59:55 -05:00
parent 1b035402a6
commit 0ea374b1c7
2 changed files with 11 additions and 3 deletions

View File

@ -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']

View File

@ -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