mirror of
https://github.com/mesonbuild/meson.git
synced 2026-11-06 05:16:42 +00:00
backends: fix vala object filename for sources in subdirectories
When both_libraries() reuses object files from the shared library for the static library via ExtractedObjects, the object filenames must match those produced for the shared library. For non-built vala source files in subdirectories, object_filename_from_source() was using os.path.basename() which dropped the subdirectory component, while the actual compilation preserved it. Use os.path.relpath() against the target's source directory instead, matching the logic in generate_vala_compile(). Fixes: #6960 Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
1 parent
1695fbc7e8
commit
9f3bf076bb
4 files changed
+21
-1
No files matched your search
@@ -783,7 +783,7 @@ class Backend:
|
||||
rel_src = rel_src[len(build_dir) + 1:]
|
||||
rel_src = os.path.relpath(rel_src, self.get_target_private_dir(target))
|
||||
else:
|
||||
rel_src = os.path.basename(rel_src)
|
||||
rel_src = os.path.relpath(rel_src, os.path.join(self.build_to_src, target.get_subdir()))
|
||||
# A meson- prefixed directory is reserved; hopefully no-one creates a file name with such a weird prefix.
|
||||
gen_source = 'meson-generated_' + rel_src[:-5] + '.c'
|
||||
elif source.is_built:
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
args = []
|
||||
# https://github.com/mesonbuild/meson/issues/1969
|
||||
if get_option('unity') == 'on'
|
||||
vala_args = ['-H', 'mylib.h']
|
||||
endif
|
||||
|
||||
l = both_libraries('valalib', 'subdir/mylib.vala',
|
||||
vala_args : args,
|
||||
dependencies : valadeps,
|
||||
install_dir : [false, get_option('includedir'), false])
|
||||
@@ -0,0 +1,5 @@
|
||||
public class LibraryObject : Object {
|
||||
public void func() {
|
||||
stdout.printf("Method in library called.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
project('shared library', 'vala', 'c')
|
||||
|
||||
valadeps = [dependency('glib-2.0'), dependency('gobject-2.0')]
|
||||
|
||||
subdir('lib')
|
||||
Reference in new issue
Block a user