build: remove outdated generated directory

This only existed as essentially a workaround for meson's behavior and
to maintain compatibility with the waf build. Since waf put everything
in a generated subdirectory, we had to put make a subdirectory called
"generated" in the source for meson so stuff could go to the right
place. Well now we don't need to do that anymore. Move the meson.build
files around so they go in the appropriate place in the subdirectory of
the source tree and change the paths of the headers accordingly. A
couple of important things to note.

1. mpv.com now gets made in build/player/mpv.com (necessary because of
   a meson limitation)
2. The macos icon generation path is shortened to
   TOOLS/osxbundle/icon.icns.inc.
This commit is contained in:
Dudemanguy 2023-07-23 17:54:35 -05:00
parent b3b7ee8f4c
commit 0bed2a2263
25 changed files with 89 additions and 69 deletions

View File

@ -16,7 +16,7 @@
*/ */
#include "common.h" #include "common.h"
#include "generated/version.h" #include "version.h"
#ifdef NO_BUILD_TIMESTAMPS #ifdef NO_BUILD_TIMESTAMPS
#undef BUILDDATE #undef BUILDDATE
#define BUILDDATE "UNKNOWN" #define BUILDDATE "UNKNOWN"

View File

@ -222,7 +222,7 @@ int ebml_resync_cluster(struct mp_log *log, stream_t *s)
#define E_S(str, count) EVALARGS(E_SN, str, count, N) #define E_S(str, count) EVALARGS(E_SN, str, count, N)
#define FN(id, name, multiple, N) { id, multiple, offsetof(struct ebml_ ## N, name), offsetof(struct ebml_ ## N, n_ ## name), &ebml_##name##_desc}, #define FN(id, name, multiple, N) { id, multiple, offsetof(struct ebml_ ## N, name), offsetof(struct ebml_ ## N, n_ ## name), &ebml_##name##_desc},
#define F(id, name, multiple) EVALARGS(FN, id, name, multiple, N) #define F(id, name, multiple) EVALARGS(FN, id, name, multiple, N)
#include "generated/ebml_defs.inc" #include "ebml_defs.inc"
#undef EVALARGS #undef EVALARGS
#undef SN #undef SN
#undef S #undef S

View File

@ -63,7 +63,7 @@ struct ebml_parse_ctx {
bool no_error_messages; bool no_error_messages;
}; };
#include "generated/ebml_types.h" #include "ebml_types.h"
#define EBML_ID_INVALID 0xffffffff #define EBML_ID_INVALID 0xffffffff

View File

@ -1,25 +0,0 @@
ebml_defs = custom_target('ebml_defs.inc',
output: 'ebml_defs.inc',
command: [matroska, '--generate-definitions', '@OUTPUT@'],
)
ebml_types = custom_target('ebml_types.h',
output: 'ebml_types.h',
command: [matroska, '--generate-header', '@OUTPUT@'],
)
version_h = custom_target('version.h',
output: 'version.h',
command: [version_py, '@OUTPUT@'],
build_always_stale: true,
)
sources += [ebml_defs, ebml_types, version_h]
# 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')
wrapper_sources= '../osdep/win32-console-wrapper.c'
executable('mpv', wrapper_sources, c_args: '-municode', link_args: '-municode',
name_suffix: 'com', install: true)
endif

View File

@ -227,7 +227,7 @@ const struct m_sub_options input_config = {
}; };
static const char builtin_input_conf[] = static const char builtin_input_conf[] =
#include "generated/etc/input.conf.inc" #include "etc/input.conf.inc"
; ;
static bool test_rect(struct mp_rect *rc, int x, int y) static bool test_rect(struct mp_rect *rc, int x, int y)

20
input/meson.build Normal file
View File

@ -0,0 +1,20 @@
icons = ['16', '32', '64', '128']
foreach size: icons
name = 'mpv-icon-8bit-'+size+'x'+size+'.png'
icon = custom_target(name,
input: join_paths(source_root, 'etc', name),
output: name + '.inc',
command: [file2string, '@INPUT@', '@OUTPUT@'],
)
sources += icon
endforeach
etc_files = ['input.conf', 'builtin.conf']
foreach file: etc_files
etc_file = custom_target(file,
input: join_paths(source_root, 'etc', file),
output: file + '.inc',
command: [file2string, '@INPUT@', '@OUTPUT@'],
)
sources += etc_file
endforeach

View File

@ -558,12 +558,29 @@ file2string = find_program(join_paths(tools_directory, 'file2string.py'))
matroska = find_program(join_paths(tools_directory, 'matroska.py')) matroska = find_program(join_paths(tools_directory, 'matroska.py'))
version_py = find_program(join_paths(source_root, 'version.py')) version_py = find_program(join_paths(source_root, 'version.py'))
subdir('generated') ebml_defs = custom_target('ebml_defs.inc',
subdir(join_paths('generated', 'etc')) output: 'ebml_defs.inc',
subdir(join_paths('generated', 'sub')) command: [matroska, '--generate-definitions', '@OUTPUT@'],
)
ebml_types = custom_target('ebml_types.h',
output: 'ebml_types.h',
command: [matroska, '--generate-header', '@OUTPUT@'],
)
version_h = custom_target('version.h',
output: 'version.h',
command: [version_py, '@OUTPUT@'],
build_always_stale: true,
)
sources += [ebml_defs, ebml_types, version_h]
subdir('etc')
subdir('player')
subdir('sub')
if darwin if darwin
subdir(join_paths('generated', 'TOOLS', 'osxbundle', 'mpv.app', 'Contents', 'Resources')) subdir(join_paths('TOOLS', 'osxbundle'))
endif endif
@ -618,7 +635,6 @@ if features['javascript']
dependencies += javascript dependencies += javascript
sources += files('player/javascript.c', sources += files('player/javascript.c',
'sub/filter_jsre.c') 'sub/filter_jsre.c')
subdir(join_paths('generated', 'player', 'javascript'))
endif endif
lcms2 = dependency('lcms2', version: '>= 2.6', required: get_option('lcms2')) lcms2 = dependency('lcms2', version: '>= 2.6', required: get_option('lcms2'))
@ -691,7 +707,6 @@ lua_version = lua.name()
if features['lua'] if features['lua']
dependencies += lua dependencies += lua
sources += files('player/lua.c') sources += files('player/lua.c')
subdir(join_paths('generated', 'player', 'lua'))
endif endif
if not features['lua'] and lua_opt == 'enabled' 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!')
@ -1004,7 +1019,7 @@ endforeach
features += {'wayland': wayland_deps and wayland['header'] and wayland['scanner'].found()} features += {'wayland': wayland_deps and wayland['header'] and wayland['scanner'].found()}
if features['wayland'] if features['wayland']
subdir(join_paths('generated', 'wayland')) subdir(join_paths('video', 'out'))
endif endif
features += {'memfd_create': false} features += {'memfd_create': false}
@ -1571,7 +1586,7 @@ if features['macos-media-player']
endif endif
if swift.allowed() if swift.allowed()
subdir(join_paths('generated', 'osdep')) subdir('osdep')
endif endif
macos_touchbar = get_option('macos-touchbar').require( macos_touchbar = get_option('macos-touchbar').require(

View File

@ -147,7 +147,7 @@ static void terminate_cocoa_application(void)
} }
static const char macosx_icon[] = static const char macosx_icon[] =
#include "generated/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns.inc" #include "TOOLS/osxbundle/icon.icns.inc"
; ;
- (NSImage *)getMPVIcon - (NSImage *)getMPVIcon

View File

@ -16,7 +16,7 @@
*/ */
#include <winver.h> #include <winver.h>
#include "generated/version.h" #include "version.h"
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2, 0, 0, 0 FILEVERSION 2, 0, 0, 0

View File

@ -51,7 +51,7 @@
// All these are generated from player/javascript/*.js // All these are generated from player/javascript/*.js
static const char *const builtin_files[][3] = { static const char *const builtin_files[][3] = {
{"@/defaults.js", {"@/defaults.js",
# include "generated/player/javascript/defaults.js.inc" # include "player/javascript/defaults.js.inc"
}, },
{0} {0}
}; };

View File

@ -56,28 +56,28 @@
// All these are generated from player/lua/*.lua // All these are generated from player/lua/*.lua
static const char * const builtin_lua_scripts[][2] = { static const char * const builtin_lua_scripts[][2] = {
{"mp.defaults", {"mp.defaults",
# include "generated/player/lua/defaults.lua.inc" # include "player/lua/defaults.lua.inc"
}, },
{"mp.assdraw", {"mp.assdraw",
# include "generated/player/lua/assdraw.lua.inc" # include "player/lua/assdraw.lua.inc"
}, },
{"mp.options", {"mp.options",
# include "generated/player/lua/options.lua.inc" # include "player/lua/options.lua.inc"
}, },
{"@osc.lua", {"@osc.lua",
# include "generated/player/lua/osc.lua.inc" # include "player/lua/osc.lua.inc"
}, },
{"@ytdl_hook.lua", {"@ytdl_hook.lua",
# include "generated/player/lua/ytdl_hook.lua.inc" # include "player/lua/ytdl_hook.lua.inc"
}, },
{"@stats.lua", {"@stats.lua",
# include "generated/player/lua/stats.lua.inc" # include "player/lua/stats.lua.inc"
}, },
{"@console.lua", {"@console.lua",
# include "generated/player/lua/console.lua.inc" # include "player/lua/console.lua.inc"
}, },
{"@auto_profiles.lua", {"@auto_profiles.lua",
# include "generated/player/lua/auto_profiles.lua.inc" # include "player/lua/auto_profiles.lua.inc"
}, },
{0} {0}
}; };

View File

@ -69,7 +69,7 @@
#include "screenshot.h" #include "screenshot.h"
static const char def_config[] = static const char def_config[] =
#include "generated/etc/builtin.conf.inc" #include "etc/builtin.conf.inc"
; ;
#if HAVE_COCOA #if HAVE_COCOA

10
player/meson.build Normal file
View File

@ -0,0 +1,10 @@
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')
wrapper_sources= '../osdep/win32-console-wrapper.c'
executable('mpv', wrapper_sources, c_args: '-municode', link_args: '-municode',
name_suffix: 'com', install: true)
endif

View File

@ -29,7 +29,7 @@
#include "osd_state.h" #include "osd_state.h"
static const char osd_font_pfb[] = static const char osd_font_pfb[] =
#include "generated/sub/osd_font.otf.inc" #include "sub/osd_font.otf.inc"
; ;
#include "sub/ass_mp.h" #include "sub/ass_mp.h"

View File

@ -161,7 +161,7 @@ static void disable_power_management(struct vo_cocoa_state *s)
} }
static const char macosx_icon[] = static const char macosx_icon[] =
#include "generated/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns.inc" #include "TOOLS/osxbundle/icon.icns.inc"
; ;
static void set_application_icon(NSApplication *app) static void set_application_icon(NSApplication *app)

View File

@ -48,4 +48,4 @@ client_protocols = declare_dependency(link_with: lib_client_protocols,
dependencies += [client_protocols, wayland['deps']] dependencies += [client_protocols, wayland['deps']]
sources += ['video/out/wayland_common.c'] sources += files('wayland_common.c')

View File

@ -41,11 +41,11 @@
#endif #endif
// Generated from wayland-protocols // Generated from wayland-protocols
#include "generated/wayland/linux-dmabuf-unstable-v1.h" #include "linux-dmabuf-unstable-v1.h"
#include "generated/wayland/viewporter.h" #include "viewporter.h"
#if HAVE_WAYLAND_PROTOCOLS_1_27 #if HAVE_WAYLAND_PROTOCOLS_1_27
#include "generated/wayland/single-pixel-buffer-v1.h" #include "single-pixel-buffer-v1.h"
#endif #endif
// We need at least enough buffers to avoid a // We need at least enough buffers to avoid a

View File

@ -35,24 +35,24 @@
#include "win_state.h" #include "win_state.h"
// Generated from wayland-protocols // Generated from wayland-protocols
#include "generated/wayland/idle-inhibit-unstable-v1.h" #include "idle-inhibit-unstable-v1.h"
#include "generated/wayland/linux-dmabuf-unstable-v1.h" #include "linux-dmabuf-unstable-v1.h"
#include "generated/wayland/presentation-time.h" #include "presentation-time.h"
#include "generated/wayland/xdg-decoration-unstable-v1.h" #include "xdg-decoration-unstable-v1.h"
#include "generated/wayland/xdg-shell.h" #include "xdg-shell.h"
#include "generated/wayland/viewporter.h" #include "viewporter.h"
#if HAVE_WAYLAND_PROTOCOLS_1_27 #if HAVE_WAYLAND_PROTOCOLS_1_27
#include "generated/wayland/content-type-v1.h" #include "content-type-v1.h"
#include "generated/wayland/single-pixel-buffer-v1.h" #include "single-pixel-buffer-v1.h"
#endif #endif
#if HAVE_WAYLAND_PROTOCOLS_1_31 #if HAVE_WAYLAND_PROTOCOLS_1_31
#include "generated/wayland/fractional-scale-v1.h" #include "fractional-scale-v1.h"
#endif #endif
#if HAVE_WAYLAND_PROTOCOLS_1_32 #if HAVE_WAYLAND_PROTOCOLS_1_32
#include "generated/wayland/cursor-shape-v1.h" #include "cursor-shape-v1.h"
#endif #endif
#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 22 #if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 22

View File

@ -110,19 +110,19 @@ typedef struct
} MotifWmHints; } MotifWmHints;
static const char x11_icon_16[] = static const char x11_icon_16[] =
#include "generated/etc/mpv-icon-8bit-16x16.png.inc" #include "etc/mpv-icon-8bit-16x16.png.inc"
; ;
static const char x11_icon_32[] = static const char x11_icon_32[] =
#include "generated/etc/mpv-icon-8bit-32x32.png.inc" #include "etc/mpv-icon-8bit-32x32.png.inc"
; ;
static const char x11_icon_64[] = static const char x11_icon_64[] =
#include "generated/etc/mpv-icon-8bit-64x64.png.inc" #include "etc/mpv-icon-8bit-64x64.png.inc"
; ;
static const char x11_icon_128[] = static const char x11_icon_128[] =
#include "generated/etc/mpv-icon-8bit-128x128.png.inc" #include "etc/mpv-icon-8bit-128x128.png.inc"
; ;
#define ICON_ENTRY(var) { (char *)var, sizeof(var) } #define ICON_ENTRY(var) { (char *)var, sizeof(var) }