diff options
author | Dudemanguy <random342@airmail.cc> | 2021-11-07 13:28:16 -0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2021-11-14 19:13:10 +0000 |
commit | ff322864f2878a35b277111e509da03fe6f888bd (patch) | |
tree | 44a99850fb0adffdd51cb0406ca24ecd5c917b2d /generated | |
parent | f610fe16c0b1cb74d73d02dc55792d4ddc262ad2 (diff) | |
download | mpv-ff322864f2878a35b277111e509da03fe6f888bd.tar.bz2 mpv-ff322864f2878a35b277111e509da03fe6f888bd.tar.xz |
build: add meson build support
Adds support for the meson build system as well as a bit of
documentation. Compatibility with the existing waf build is
maintained.
Diffstat (limited to 'generated')
-rw-r--r-- | generated/TOOLS/osxbundle/mpv.app/Contents/Resources/meson.build | 8 | ||||
-rw-r--r-- | generated/etc/meson.build | 20 | ||||
-rw-r--r-- | generated/meson.build | 27 | ||||
-rw-r--r-- | generated/osdep/meson.build | 57 | ||||
-rw-r--r-- | generated/player/javascript/meson.build | 6 | ||||
-rw-r--r-- | generated/player/lua/meson.build | 10 | ||||
-rw-r--r-- | generated/sub/meson.build | 6 | ||||
-rw-r--r-- | generated/wayland/meson.build | 32 |
8 files changed, 166 insertions, 0 deletions
diff --git a/generated/TOOLS/osxbundle/mpv.app/Contents/Resources/meson.build b/generated/TOOLS/osxbundle/mpv.app/Contents/Resources/meson.build new file mode 100644 index 0000000000..a271b4120f --- /dev/null +++ b/generated/TOOLS/osxbundle/mpv.app/Contents/Resources/meson.build @@ -0,0 +1,8 @@ +input = join_paths(source_root, 'TOOLS', 'osxbundle', + 'mpv.app', 'Contents', 'Resources', 'icon.icns') +osxbundle = custom_target('osxbundle', + input: input, + output: 'icon.icns.inc', + command: [file2string, '@INPUT@', '@OUTPUT@'], +) +sources += osxbundle diff --git a/generated/etc/meson.build b/generated/etc/meson.build new file mode 100644 index 0000000000..12fe732b43 --- /dev/null +++ b/generated/etc/meson.build @@ -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 diff --git a/generated/meson.build b/generated/meson.build new file mode 100644 index 0000000000..ab09d1afa8 --- /dev/null +++ b/generated/meson.build @@ -0,0 +1,27 @@ +ebml_defs = custom_target('ebml_defs', + output: 'ebml_defs.inc', + command: [matroska, '--generate-definitions', '@OUTPUT@'], +) + +ebml_types = custom_target('ebml_types', + 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') + features += 'win32-executable' + wrapper_flags = ['-municode', '-Wl,--subsystem,console'] + wrapper_sources= '../osdep/win32-console-wrapper.c' + executable('mpv', wrapper_sources, c_args: wrapper_flags, link_args: wrapper_flags, + name_suffix: 'com', install: true) +endif diff --git a/generated/osdep/meson.build b/generated/osdep/meson.build new file mode 100644 index 0000000000..a577a039e1 --- /dev/null +++ b/generated/osdep/meson.build @@ -0,0 +1,57 @@ +# custom swift targets +bridge = join_paths(source_root, 'osdep/macOS_swift_bridge.h') +header = join_paths(build_root, 'osdep/macOS_swift.h') +module = join_paths(build_root, 'osdep/macOS_swift.swiftmodule') +target = join_paths(build_root, 'osdep/macOS_swift.o') + +swift_flags = ['-frontend', '-c', '-sdk', macos_sdk_path, + '-enable-objc-interop', '-emit-objc-header', '-parse-as-library'] + +if swift_ver.version_compare('>=6.0') + swift_flags += ['-swift-version', '5'] +endif + +if get_option('debug') + swift_flags += '-g' +endif + +if get_option('optimization') != '0' + swift_flags += '-O' +endif + +if macos_10_11_features.allowed() + swift_flags += ['-D', 'HAVE_MACOS_10_11_FEATURES'] +endif + +if macos_10_14_features.allowed() + swift_flags += ['-D', 'HAVE_MACOS_10_14_FEATURES'] +endif + +extra_flags = get_option('swift-flags').split() +swift_flags += extra_flags + +swift_compile = [swift_prog, swift_flags, '-module-name', 'macOS_swift', + '-emit-module-path', '@OUTPUT0@', '-import-objc-header', bridge, + '-emit-objc-header-path', '@OUTPUT1@', '-o', '@OUTPUT2@', + '@INPUT@', '-I.', '-I' + source_root] + +swift_targets = custom_target('swift_targets', + input: swift_sources, + output: ['macOS_swift.swiftmodule', 'macOS_swift.h', 'macOS_swift.o'], + command: swift_compile, +) +sources += swift_targets + +swift_lib_dir_py = find_program(join_paths(tools_directory, 'macos-swift-lib-directory.py')) +swift_lib_dir = run_command(swift_lib_dir_py, swift_prog.full_path(), check: true).stdout() +message('Detected Swift library directory: ' + swift_lib_dir) + +# linker flags +swift_link_flags = ['-L' + swift_lib_dir, '-Xlinker', '-rpath', + '-Xlinker', swift_lib_dir, '-rdynamic', '-Xlinker', + '-add_ast_path', '-Xlinker', module] +if swift_ver.version_compare('>=5.0') + swift_link_flags += ['-Xlinker', '-rpath', '-Xlinker', + '/usr/lib/swift', '-L/usr/lib/swift'] +endif +add_project_link_arguments(swift_link_flags, language: ['c', 'objc']) diff --git a/generated/player/javascript/meson.build b/generated/player/javascript/meson.build new file mode 100644 index 0000000000..bfff4b4e95 --- /dev/null +++ b/generated/player/javascript/meson.build @@ -0,0 +1,6 @@ +defaults_js = custom_target('defaults.js', + input: join_paths(source_root, 'player', 'javascript', 'defaults.js'), + output: 'defaults.js.inc', + command: [file2string, '@INPUT@', '@OUTPUT@'], +) +sources += defaults_js diff --git a/generated/player/lua/meson.build b/generated/player/lua/meson.build new file mode 100644 index 0000000000..362c87cbb7 --- /dev/null +++ b/generated/player/lua/meson.build @@ -0,0 +1,10 @@ +lua_files = ['defaults.lua', 'assdraw.lua', 'options.lua', 'osc.lua', + 'ytdl_hook.lua', 'stats.lua', 'console.lua', 'auto_profiles.lua'] +foreach file: lua_files + lua_file = custom_target(file, + input: join_paths(source_root, 'player', 'lua', file), + output: file + '.inc', + command: [file2string, '@INPUT@', '@OUTPUT@'], + ) + sources += lua_file +endforeach diff --git a/generated/sub/meson.build b/generated/sub/meson.build new file mode 100644 index 0000000000..867f218614 --- /dev/null +++ b/generated/sub/meson.build @@ -0,0 +1,6 @@ +osd_font = custom_target('osd_font.otf', + input: join_paths(source_root, 'sub', 'osd_font.otf'), + output: 'osd_font.otf.inc', + command: [file2string, '@INPUT@', '@OUTPUT@'], +) +sources += osd_font diff --git a/generated/wayland/meson.build b/generated/wayland/meson.build new file mode 100644 index 0000000000..19ed4bc023 --- /dev/null +++ b/generated/wayland/meson.build @@ -0,0 +1,32 @@ +wl_protocol_dir = wayland['deps'][2].get_variable(pkgconfig: 'pkgdatadir') +protocols = [[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], + [wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'], + [wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'], + [wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml']] +wl_protocols_source = [] +wl_protocols_headers = [] + +foreach p: protocols + xml = join_paths(p) + wl_protocols_source += custom_target(xml.underscorify() + '_c', + input: xml, + output: '@BASENAME@.c', + command: [wayland['scanner'], 'private-code', '@INPUT@', '@OUTPUT@'], + ) + wl_protocols_headers += custom_target(xml.underscorify() + '_h', + input: xml, + output: '@BASENAME@.h', + command: [wayland['scanner'], 'client-header', '@INPUT@', '@OUTPUT@'], + ) +endforeach + +lib_client_protocols = static_library('protocols', + wl_protocols_source + wl_protocols_headers, + dependencies: wayland['deps'][0]) + +client_protocols = declare_dependency(link_with: lib_client_protocols, + sources: wl_protocols_headers) + +dependencies += [client_protocols, wayland['deps']] + +sources += ['video/out/wayland_common.c'] |