diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/markdown/Vala.md | 25 | ||||
| -rw-r--r-- | docs/markdown/snippets/vala-target-extra-methods.md | 9 | ||||
| -rw-r--r-- | docs/yaml/objects/build_tgt.yaml | 8 |
3 files changed, 41 insertions, 1 deletions
diff --git a/docs/markdown/Vala.md b/docs/markdown/Vala.md index af9426352..ff7a7c736 100644 --- a/docs/markdown/Vala.md +++ b/docs/markdown/Vala.md @@ -318,6 +318,7 @@ foo_h = foo_lib.vala_header() This header can now be used like any other generated header to create an order-only dependency. + ### Depending on VAPI header *(since 1.10.0)* @@ -329,6 +330,15 @@ foo_lib = shared_library(...) foo_vapi = foo_lib.vala_vapi() ``` +### Depending on generated GIR + +*(since 1.10.0)* + +```meson +foo_lib = shared_library(..., vala_gir : 'foo.gir') +foo_gir = foo_lib.vala_gir() +``` + ### GObject Introspection and language bindings A 'binding' allows another programming language to use a library @@ -363,6 +373,21 @@ directory (i.e. `share/gir-1.0` for GIRs). The fourth element in the To then generate a typelib file use a custom target with the `g-ir-compiler` program and a dependency on the library: +*Since Meson 1.10*, use the `.vala_gir()` method to get a handle to the generated `.gir` file: + +```meson +g_ir_compiler = find_program('g-ir-compiler') +custom_target('foo typelib', command: [g_ir_compiler, '--output', '@OUTPUT@', '@INPUT@'], + input: foo_lib.vala_gir(), + output: 'Foo-1.0.typelib', + install: true, + install_dir: get_option('libdir') / 'girepository-1.0') +``` + + +*Before Meson 1.10*, calculating the path to the input is required, as is adding a +manual dependency to the vala target: + ```meson g_ir_compiler = find_program('g-ir-compiler') custom_target('foo typelib', command: [g_ir_compiler, '--output', '@OUTPUT@', '@INPUT@'], diff --git a/docs/markdown/snippets/vala-target-extra-methods.md b/docs/markdown/snippets/vala-target-extra-methods.md index 72d89e56e..526f557a2 100644 --- a/docs/markdown/snippets/vala-target-extra-methods.md +++ b/docs/markdown/snippets/vala-target-extra-methods.md @@ -1,7 +1,7 @@ ## Vala BuildTarget dependency enhancements A BuildTarget that has Vala sources can now get a File dependency for its -generated header and generated vapi. +generated header, vapi, and gir files. ```meson lib = library('foo', 'foo.vala') @@ -9,6 +9,13 @@ lib_h = lib.vala_header() lib_s = static_lib('static', 'static.c', lib_h) lib_vapi = lib.vala_vapi() + +custom_target( + 'foo-typelib', + command : ['g-ir-compiler', '--output', '@OUTPUT@', '@INPUT@'], + input : lib.vala_gir(), + output : 'Foo-1.0.typelib' +) ``` `static.c` will not start compilation until `lib.h` is generated. diff --git a/docs/yaml/objects/build_tgt.yaml b/docs/yaml/objects/build_tgt.yaml index da64a469e..3fed56c43 100644 --- a/docs/yaml/objects/build_tgt.yaml +++ b/docs/yaml/objects/build_tgt.yaml @@ -93,3 +93,11 @@ methods: Returns a [[@file]] object pointing to a VAPI header generated by the vala compiler, if this target does not generate a VAPI file then it is an error to call this method. + +- name: vala_gir + returns: file + since: 1.10.0 + description: | + Returns a [[@file]] object pointing to a GIR file generated by the vala + compiler, if this target does not generate a GIR file then it is an error + to call this method. |
