diff --git a/DOCS/man/libmpv.rst b/DOCS/man/libmpv.rst index 37f12798db..107aae5d67 100644 --- a/DOCS/man/libmpv.rst +++ b/DOCS/man/libmpv.rst @@ -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 diff --git a/fuzzers/meson.build b/fuzzers/meson.build index 3a2b3631eb..4f7c374e53 100644 --- a/fuzzers/meson.build +++ b/fuzzers/meson.build @@ -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) diff --git a/mpv/client.h b/include/mpv/client.h similarity index 100% rename from mpv/client.h rename to include/mpv/client.h diff --git a/mpv/render.h b/include/mpv/render.h similarity index 100% rename from mpv/render.h rename to include/mpv/render.h diff --git a/mpv/render_gl.h b/include/mpv/render_gl.h similarity index 100% rename from mpv/render_gl.h rename to include/mpv/render_gl.h diff --git a/mpv/stream_cb.h b/include/mpv/stream_cb.h similarity index 100% rename from mpv/stream_cb.h rename to include/mpv/stream_cb.h diff --git a/meson.build b/meson.build index 57b9c5bccf..57d8bde65b 100644 --- a/meson.build +++ b/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 diff --git a/osdep/mac/meson.build b/osdep/mac/meson.build index 908bd1121d..d886e5406a 100644 --- a/osdep/mac/meson.build +++ b/osdep/mac/meson.build @@ -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')] diff --git a/test/meson.build b/test/meson.build index 3eeaaa0b6f..e8f995cf81 100644 --- a/test/meson.build +++ b/test/meson.build @@ -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