shithub: dav1d

Download patch

ref: afa5479f82a7b833eea2db81ee3ef59458e4700b
parent: 190da6aedad3a43a9fedc88714c124d30d516ab1
author: Marvin Scholz <epirat07@gmail.com>
date: Fri Sep 28 08:52:45 EDT 2018

Build: Add checkasm test

--- a/meson.build
+++ b/meson.build
@@ -173,9 +173,9 @@
 # Generate config headers
 #
 if cdata.has('HAVE_GETOPT_H')
-    dav1d_inc_dirs = include_directories(['include', 'include/dav1d'])
+    dav1d_inc_dirs = include_directories(['.', 'include', 'include/dav1d'])
 else
-    dav1d_inc_dirs = include_directories(['include', 'include/dav1d', 'include/compat'])
+    dav1d_inc_dirs = include_directories(['.', 'include', 'include/dav1d', 'include/compat'])
 endif
 
 config_h_target = configure_file(output: 'config.h', configuration: cdata)
@@ -269,7 +269,7 @@
         depfile: '@BASENAME@.obj.ndep',
         arguments: [
             '-f', nasm_format,
-            '-I', '@CURRENT_SOURCE_DIR@/',
+            '-I', '@SOURCE_DIR@/',
             '-MQ', '@OUTPUT@', '-MF', '@DEPFILE@',
             '@EXTRA_ARGS@',
             '@INPUT@',
@@ -312,7 +312,7 @@
     #entrypoints_objs += rc_source
 endif
 
-libdav1d = library('dav1d',
+libdav1d_private = static_library('dav1d_private',
     libdav1d_sources, nasm_objs,
     version: meson.project_version(),
     objects: [bitdepth_objs, entrypoints_objs],
@@ -319,9 +319,16 @@
     include_directories: dav1d_inc_dirs,
     c_args: [stackalign_flag],
     dependencies: thread_dependency,
-    install: true
+    install: false,
+    build_by_default: false,
 )
 
+libdav1d = library('dav1d',
+    version: '0.0.1',
+    link_whole: libdav1d_private,
+    install: true,
+)
+
 install_subdir('include/dav1d/', install_dir: 'include')
 
 #
@@ -348,6 +355,8 @@
     include_directories: [dav1d_inc_dirs, include_directories('tools')],
     install: true,
 )
+
+subdir('tests')
 
 #
 # pkg-config boilerplate
--- /dev/null
+++ b/tests/meson.build
@@ -1,0 +1,30 @@
+if is_asm_enabled
+    checkasm_sources = files('checkasm/checkasm.c')
+
+    checkasm_tmpl_sources = files('checkasm/mc.c')
+
+    checkasm_bitdepth_objs = []
+    foreach bitdepth : dav1d_bitdepths
+        checkasm_bitdepth_lib = static_library(
+            'checkasm_bitdepth_@0@'.format(bitdepth),
+            checkasm_tmpl_sources,
+            include_directories: dav1d_inc_dirs,
+            c_args: ['-DBITDEPTH=@0@'.format(bitdepth), stackalign_flag],
+            install: false,
+            build_by_default: false,
+        )
+        checkasm_bitdepth_objs += checkasm_bitdepth_lib.extract_all_objects()
+    endforeach
+
+    checkasm_nasm_objs = nasm_gen.process(files('checkasm/x86/checkasm.asm'))
+
+    checkasm = executable('checkasm', checkasm_sources, checkasm_nasm_objs,
+        objects: [checkasm_bitdepth_objs],
+        include_directories: dav1d_inc_dirs,
+        link_with: libdav1d_private,
+        c_args: [stackalign_flag, stackrealign_flag],
+        build_by_default: false,
+        )
+
+    test('checkasm test', checkasm)
+endif