Commit 19050ac1 authored by Niklas Haas's avatar Niklas Haas Committed by Niklas Haas

meson: work-around meson bugs w.r.t subprojects

We can't link the subproejcts as dependencies directly, because meson
incorrectly emits the linker flags (and omits the objects). Solve it
manually instead by directly including the relevant object files.

This commit can and should be reverted as soon as the meson bugs are
fixed upstream, since it's an ugly hack.

cf. https://github.com/mesonbuild/meson/issues/4598
parent 1b041b1b
Pipeline #3442 passed with stages
in 2 minutes and 6 seconds
......@@ -4,8 +4,11 @@ cxx = meson.get_compiler('cpp')
build_deps = [
cc.find_library('m', required: false),
subproject('xtalloc').get_variable('dep'),
subproject('bstr').get_variable('dep'),
]
subprojects = [
subproject('xtalloc'),
subproject('bstr'),
]
vulkan = dependency('vulkan', version: '>=1.0.42', required: get_option('vulkan'))
......@@ -197,12 +200,21 @@ configure_file(
configuration: conf_internal
)
inc = include_directories('./include')
# work around meson bugs
build_deps += dependency('threads')
inc = [ include_directories('./include') ]
obj = []
foreach s : subprojects
inc += s.get_variable('inc')
obj += s.get_variable('lib').extract_all_objects(recursive: false)
endforeach
lib = library('placebo', sources,
install: true,
dependencies: build_deps,
soversion: apiver,
include_directories: inc,
objects: obj,
link_args: link_args,
)
......@@ -220,11 +232,15 @@ pkg.generate(
# Tests
tdep = declare_dependency(
tdep = [ declare_dependency(
link_with: lib,
dependencies: build_deps,
include_directories: inc,
)
) ]
foreach s : subprojects
tdep += s.get_variable('dep')
endforeach
if get_option('tests')
foreach t : tests
......
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