Commit 9684908d authored by Marvin Scholz's avatar Marvin Scholz Committed by Jean-Baptiste Kempf

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
parent ac743837
......@@ -86,9 +86,11 @@ endif
# 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
......
......@@ -171,10 +171,14 @@ foreach bitdepth : dav1d_bitdepths
).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 @@ libdav1d_private = static_library('dav1d_private',
],
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,
)
......@@ -58,12 +58,20 @@ if is_asm_enabled
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)
......
......@@ -43,17 +43,11 @@ dav1d_sources = files(
'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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment