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 ...@@ -86,9 +86,11 @@ endif
# On Windows, we use a compatibility layer to emulate pthread # On Windows, we use a compatibility layer to emulate pthread
if host_machine.system() == 'windows' 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 else
thread_dependency = dependency('threads') thread_dependency = dependency('threads')
thread_compat_dep = []
endif endif
......
...@@ -171,10 +171,14 @@ foreach bitdepth : dav1d_bitdepths ...@@ -171,10 +171,14 @@ foreach bitdepth : dav1d_bitdepths
).extract_all_objects() ).extract_all_objects()
endforeach endforeach
# Static private helper library # The final dav1d library
# This is primarily needed to link with tests so that if host_machine.system() == 'windows'
# the tests can use all symbols, even the non-exported. dav1d_soversion = ''
libdav1d_private = static_library('dav1d_private', else
dav1d_soversion = dav1d_version_major
endif
libdav1d = library('dav1d',
libdav1d_sources, libdav1d_sources,
libdav1d_nasm_objs, libdav1d_nasm_objs,
libdav1d_rc_obj, libdav1d_rc_obj,
...@@ -185,24 +189,13 @@ libdav1d_private = static_library('dav1d_private', ...@@ -185,24 +189,13 @@ libdav1d_private = static_library('dav1d_private',
], ],
include_directories : dav1d_inc_dirs, include_directories : dav1d_inc_dirs,
dependencies : [stdatomic_dependency], dependencies : [
stdatomic_dependency,
thread_dependency,
thread_compat_dep,
],
c_args : [stackalign_flag], 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(), version : meson.project_version(),
link_whole : libdav1d_private,
dependencies : thread_dependency,
include_directories : dav1d_inc_dirs,
soversion : dav1d_soversion, soversion : dav1d_soversion,
install : true, install : true,
) )
...@@ -58,12 +58,20 @@ if is_asm_enabled ...@@ -58,12 +58,20 @@ if is_asm_enabled
checkasm_nasm_objs = nasm_gen.process(files('checkasm/x86/checkasm.asm')) checkasm_nasm_objs = nasm_gen.process(files('checkasm/x86/checkasm.asm'))
endif endif
checkasm = executable('checkasm', checkasm_sources, checkasm_nasm_objs, checkasm = executable('checkasm',
objects: [checkasm_bitdepth_objs], checkasm_sources,
checkasm_nasm_objs,
libdav1d_nasm_objs,
objects: [
checkasm_bitdepth_objs,
libdav1d.extract_all_objects(recursive: true),
],
include_directories: dav1d_inc_dirs, include_directories: dav1d_inc_dirs,
link_with: libdav1d_private,
c_args: [stackalign_flag, stackrealign_flag], c_args: [stackalign_flag, stackrealign_flag],
build_by_default: false, build_by_default: false,
dependencies : [thread_dependency],
) )
test('checkasm test', checkasm) test('checkasm test', checkasm)
......
...@@ -43,17 +43,11 @@ dav1d_sources = files( ...@@ -43,17 +43,11 @@ dav1d_sources = files(
'output/yuv.c', '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 = executable('dav1d',
dav1d_sources, dav1d_sources,
rev_target, rev_target,
link_with : dav1d_link_with_lib, link_with : libdav1d,
include_directories : [dav1d_inc_dirs], include_directories : [dav1d_inc_dirs],
dependencies : [getopt_dependency, thread_dependency], dependencies : [getopt_dependency, thread_dependency],
install : true, 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