ref: 9684908d2ffa1dc0a80a02c335d7a4302eecb13f
parent: ac7438371e525f5b40bca700e5c0913ceed261fb
author: Marvin Scholz <epirat07@gmail.com>
date: Mon Oct 1 06:23:18 EDT 2018
Build: Fix static library building Due to bugs in meson the approach with the intermediate static library for tests does not work very well, see #44. Therefore this commits removes that helper library and instead uses extract_all_objects for the tests. Due to the removal of the static helper library, it means we can no longer force static linking for dav1d tool on windows which means that when building a shared library the dav1d.exe will not be runnable in the build directory again. Fix #44
--- a/meson.build
+++ b/meson.build
@@ -86,9 +86,11 @@
# On Windows, we use a compatibility layer to emulate pthread
if host_machine.system() == 'windows'
- thread_dependency = declare_dependency(sources : files('src/win32/thread.c'))
+ thread_dependency = []
+ thread_compat_dep = declare_dependency(sources : files('src/win32/thread.c'))
else
thread_dependency = dependency('threads')
+ thread_compat_dep = []
endif
--- a/src/meson.build
+++ b/src/meson.build
@@ -171,10 +171,14 @@
).extract_all_objects()
endforeach
-# Static private helper library
-# This is primarily needed to link with tests so that
-# the tests can use all symbols, even the non-exported.
-libdav1d_private = static_library('dav1d_private',
+# The final dav1d library
+if host_machine.system() == 'windows'
+ dav1d_soversion = ''
+else
+ dav1d_soversion = dav1d_version_major
+endif
+
+libdav1d = library('dav1d',
libdav1d_sources,
libdav1d_nasm_objs,
libdav1d_rc_obj,
@@ -185,24 +189,13 @@
],
include_directories : dav1d_inc_dirs,
- dependencies : [stdatomic_dependency],
+ dependencies : [
+ stdatomic_dependency,
+ thread_dependency,
+ thread_compat_dep,
+ ],
c_args : [stackalign_flag],
- install : false,
- build_by_default : false,
-)
-
-# The final dav1d library
-if host_machine.system() == 'windows'
- dav1d_soversion = ''
-else
- dav1d_soversion = dav1d_version_major
-endif
-
-libdav1d = library('dav1d',
version : meson.project_version(),
- link_whole : libdav1d_private,
- dependencies : thread_dependency,
- include_directories : dav1d_inc_dirs,
soversion : dav1d_soversion,
install : true,
)
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -58,12 +58,20 @@
checkasm_nasm_objs = nasm_gen.process(files('checkasm/x86/checkasm.asm'))
endif
- checkasm = executable('checkasm', checkasm_sources, checkasm_nasm_objs,
- objects: [checkasm_bitdepth_objs],
+ checkasm = executable('checkasm',
+ checkasm_sources,
+ checkasm_nasm_objs,
+ libdav1d_nasm_objs,
+
+ objects: [
+ checkasm_bitdepth_objs,
+ libdav1d.extract_all_objects(recursive: true),
+ ],
+
include_directories: dav1d_inc_dirs,
- link_with: libdav1d_private,
c_args: [stackalign_flag, stackrealign_flag],
build_by_default: false,
+ dependencies : [thread_dependency],
)
test('checkasm test', checkasm)
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -43,17 +43,11 @@
'output/yuv.c',
)
-if host_machine.system() == 'windows'
- dav1d_link_with_lib = libdav1d_private
-else
- dav1d_link_with_lib = libdav1d
-endif
-
dav1d = executable('dav1d',
dav1d_sources,
rev_target,
- link_with : dav1d_link_with_lib,
+ link_with : libdav1d,
include_directories : [dav1d_inc_dirs],
dependencies : [getopt_dependency, thread_dependency],
install : true,