mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-22 10:57:08 +00:00
include: move public headers to own directory
This ensures a clear separation between public and private headers. It also makes it clear in Meson and prevents the accidental use of private headers.
This commit is contained in:
@@ -2,14 +2,14 @@ EMBEDDING INTO OTHER PROGRAMS (LIBMPV)
|
||||
======================================
|
||||
|
||||
mpv can be embedded into other programs as video/audio playback backend. The
|
||||
recommended way to do so is using libmpv. See ``mpv/client.h`` in the mpv
|
||||
recommended way to do so is using libmpv. See ``include/mpv/client.h`` in the mpv
|
||||
source code repository. This provides a C API. Bindings for other languages
|
||||
might be available (see wiki).
|
||||
|
||||
Since libmpv merely allows access to underlying mechanisms that can control
|
||||
mpv, further documentation is spread over a few places:
|
||||
|
||||
- https://github.com/mpv-player/mpv/blob/master/mpv/client.h
|
||||
- https://github.com/mpv-player/mpv/blob/master/include/mpv/client.h
|
||||
- https://mpv.io/manual/master/#options
|
||||
- https://mpv.io/manual/master/#list-of-input-commands
|
||||
- https://mpv.io/manual/master/#properties
|
||||
|
||||
@@ -68,12 +68,12 @@ foreach cmd : ['file', '-config-file', '-input-conf']
|
||||
endforeach
|
||||
|
||||
fuzzers += executable('fuzzer_options_parser', 'fuzzer_options_parser.c',
|
||||
link_language: 'cpp', include_directories: incdir,
|
||||
link_language: 'cpp', include_directories: incdir_public,
|
||||
objects: libmpv.extract_all_objects(recursive: true),
|
||||
dependencies: dependencies)
|
||||
|
||||
fuzzers += executable('fuzzer_json', 'fuzzer_json.c',
|
||||
link_language: 'cpp', include_directories: incdir,
|
||||
link_language: 'cpp', include_directories: [incdir, incdir_public],
|
||||
objects: libmpv.extract_all_objects(recursive: true),
|
||||
dependencies: dependencies)
|
||||
|
||||
|
||||
10
meson.build
10
meson.build
@@ -1755,13 +1755,15 @@ if win32
|
||||
endif
|
||||
|
||||
|
||||
incdir_public = include_directories('./include')
|
||||
client_h_define = cc.get_define('MPV_CLIENT_API_VERSION', prefix: '#include "mpv/client.h"',
|
||||
include_directories: include_directories('.'))
|
||||
include_directories: incdir_public)
|
||||
major = client_h_define.split('|')[0].split('<<')[0].strip('() ')
|
||||
minor = client_h_define.split('|')[1].strip('() ')
|
||||
client_api_version = major + '.' + minor + '.0'
|
||||
|
||||
libmpv = library('mpv', sources, dependencies: dependencies, gnu_symbol_visibility: 'hidden',
|
||||
include_directories: incdir_public,
|
||||
link_args: cc.get_supported_link_arguments(['-Wl,-Bsymbolic']),
|
||||
version: client_api_version, install: get_option('libmpv'),
|
||||
build_by_default: get_option('libmpv'))
|
||||
@@ -1772,12 +1774,12 @@ if get_option('libmpv')
|
||||
pkg.generate(libmpv, version: client_api_version,
|
||||
description: 'mpv media player client library')
|
||||
|
||||
headers = ['mpv/client.h', 'mpv/render.h',
|
||||
'mpv/render_gl.h', 'mpv/stream_cb.h']
|
||||
headers = ['include/mpv/client.h', 'include/mpv/render.h',
|
||||
'include/mpv/render_gl.h', 'include/mpv/stream_cb.h']
|
||||
install_headers(headers, subdir: 'mpv')
|
||||
|
||||
# Allow projects to build with libmpv by cloning into ./subprojects/mpv
|
||||
libmpv_dep = declare_dependency(include_directories: '.', link_with: libmpv)
|
||||
libmpv_dep = declare_dependency(include_directories: incdir_public, link_with: libmpv)
|
||||
meson.override_dependency('mpv', libmpv_dep)
|
||||
endif
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ swift_flags += extra_flags
|
||||
swift_compile = [swift_prog, swift_flags, '-module-name', 'swift',
|
||||
'-emit-module-path', '@OUTPUT0@', '-import-objc-header', bridge,
|
||||
'-emit-objc-header-path', '@OUTPUT1@', '-o', '@OUTPUT2@',
|
||||
'@INPUT@', '-I.', '-I' + source_root,
|
||||
'@INPUT@', '-I.', '-I' + source_root, '-I' + source_root / 'include',
|
||||
'-I' + libplacebo.get_variable('includedir',
|
||||
default_value: source_root / 'subprojects' / 'libplacebo' / 'src' / 'include'),
|
||||
'-I' + libavutil.get_variable('includedir')]
|
||||
|
||||
@@ -90,7 +90,7 @@ gl_video = executable('gl-video', 'gl_video.c', objects: gl_video_objects,
|
||||
link_with: [img_utils, test_utils])
|
||||
test('gl-video', gl_video)
|
||||
|
||||
json = executable('json', 'json.c', include_directories: incdir, link_with: test_utils)
|
||||
json = executable('json', 'json.c', include_directories: [incdir, incdir_public], link_with: test_utils)
|
||||
test('json', json)
|
||||
|
||||
linked_list = executable('linked-list', files('linked_list.c'), include_directories: incdir)
|
||||
@@ -150,7 +150,7 @@ if get_option('libmpv')
|
||||
endif
|
||||
if shared
|
||||
exe = executable('libmpv-lifetime', sources: 'libmpv_lifetime.c',
|
||||
include_directories: incdir)
|
||||
include_directories: incdir_public)
|
||||
test('libmpv-lifetime', exe, depends: mpvlib, suite: 'libmpv')
|
||||
endif
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user