Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot generate GIR and GI typelibs from Vala per documentation #5968

Open
mjog opened this issue Sep 27, 2019 · 1 comment
Open

Cannot generate GIR and GI typelibs from Vala per documentation #5968

mjog opened this issue Sep 27, 2019 · 1 comment

Comments

@mjog
Copy link
Contributor

mjog commented Sep 27, 2019

Currently, going to https://mesonbuild.com/Vala.html suggests this is a valid way to generate GIR and GI typelibs:

foo_lib = shared_library('foo', 'foo.vala',
                  vala_gir: 'Foo-1.0.gir',
                  dependencies: [glib_dep, gobject_dep],
                  install: true,
                  install_dir: [true, true, true, true])

g_ir_compiler = find_program('g-ir-compiler')
custom_target('foo typelib', command: [g_ir_compiler, '--output', '@OUTPUT@', '@INPUT@'],
              input: meson.current_build_dir() / 'Foo-1.0.gir',
              output: 'Foo-1.0.typelib',
              depends: foo_lib,
              install: true,
              install_dir: get_option('libdir') / 'girepository-1.0')

However this fails with meson 0.51.2 complaining it can't find the input for the second target. To make this work you need to do the following:

foo_lib = shared_library('foo', 'foo.vala',
                  vala_gir: 'Foo-1.0.gir',
                  dependencies: [glib_dep, gobject_dep],
                  install: true,
                  install_dir: [true, true, true, true])

g_ir_compiler = find_program('g-ir-compiler')
custom_target('foo typelib', command: [g_ir_compiler, '--output', '@OUTPUT@', meson.current_build_dir() / 'Foo-1.0.gir',],
              output: 'Foo-1.0.typelib',
              depends: foo_lib,
              install: true,
              install_dir: get_option('libdir') / 'girepository-1.0')

There used to be a test case that covered this, but it seems to have gone awol.

@esodan
Copy link

esodan commented May 27, 2020

I agree. Also, if your are using this as a subproject you should export the meson.current_build_dir() and use it when creating a new library, also used as a subproject of other program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants