summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-02-25 21:50:08 -0600
committerDudemanguy <random342@airmail.cc>2023-03-02 15:45:27 +0000
commit9db818279aa63d071f2bca369235285314444dcd (patch)
tree9aafc5cf73e19ae8ea69751c060cab9766a6b9a4 /meson.build
parent61532421571f972f076b3700d7ae468c0a0438c0 (diff)
downloadmpv-9db818279aa63d071f2bca369235285314444dcd.tar.bz2
mpv-9db818279aa63d071f2bca369235285314444dcd.tar.xz
test: integrate unittests with meson
This reworks all of mpv's unit tests so they are compiled as separate executables (optional) and run via meson test. Because most of the tests are dependant on mpv's internals, existing compiled objects are leveraged to create static libs and used when necessary. As an aside, a function was moved into video/out/gpu/utils for sanity's sake (otherwise most of vo would have been needed). As a plus, meson multithreads running tests automatically and also the output no longer pollutes the source directory. There are tests that can break due to ffmpeg changes, so they require a specific minimum libavutil version to be built.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build30
1 files changed, 16 insertions, 14 deletions
diff --git a/meson.build b/meson.build
index b57ce9d3c0..36bcf19f60 100644
--- a/meson.build
+++ b/meson.build
@@ -393,10 +393,11 @@ if features['cocoa']
endif
if posix
- sources += files('input/ipc-unix.c',
- 'osdep/path-unix.c',
+ path_source = files('osdep/path-unix.c')
+ subprocess_source = files('osdep/subprocess-posix.c')
+ sources += path_source + subprocess_source + \
+ files('input/ipc-unix.c',
'osdep/polldev.c',
- 'osdep/subprocess-posix.c',
'osdep/terminal-unix.c',
'sub/filter_regex.c')
endif
@@ -479,10 +480,11 @@ if features['win32-desktop']
cc.find_library('version'),
cc.find_library('winmm')]
dependencies += win32_desktop_libs
- sources += files('input/ipc-win.c',
+ path_source = files('osdep/path-win.c')
+ subprocess_source = files('osdep/subprocess-win.c')
+ sources += path_source + subprocess_source + \
+ files('input/ipc-win.c',
'osdep/main-fn-win.c',
- 'osdep/path-win.c',
- 'osdep/subprocess-win.c',
'osdep/terminal-win.c',
'video/out/w32_common.c',
'video/out/win32/displayconfig.c',
@@ -490,9 +492,8 @@ if features['win32-desktop']
endif
if not posix and not features['win32-desktop']
- sources += files('input/ipc-dummy.c',
- 'osdep/subprocess-dummy.c',
- 'osdep/terminal-dummy.c')
+ subprocess_source = files('osdep/subprocess-dummy.c')
+ sources += subprocess_source + files('input/ipc-dummy.c')
endif
features += {'glob-posix': cc.has_function('glob', prefix: '#include <glob.h>')}
@@ -1685,9 +1686,6 @@ if get_option('libmpv')
headers = ['libmpv/client.h', 'libmpv/render.h',
'libmpv/render_gl.h', 'libmpv/stream_cb.h']
install_headers(headers, subdir: 'mpv')
-
- libmpv_test = executable('libmpv-test', 'libmpv/test.c', link_with: [libmpv])
- test('libmpv', libmpv_test)
endif
if get_option('cplayer')
@@ -1718,8 +1716,12 @@ if get_option('cplayer')
rename: 'mpv.svg')
install_data('etc/mpv-symbolic.svg', install_dir: join_paths(hicolor_dir, 'symbolic', 'apps'))
- executable('mpv', objects: libmpv.extract_all_objects(recursive: true), dependencies: dependencies,
- win_subsystem: 'windows,6.0', include_directories: includedir, install: true)
+ mpv = executable('mpv', objects: libmpv.extract_all_objects(recursive: true), dependencies: dependencies,
+ win_subsystem: 'windows,6.0', include_directories: includedir, install: true)
+endif
+
+if get_option('tests')
+ subdir('test')
endif
summary({'d3d11': features['d3d11'],