[amtk/meson-msvc: 20/22] meson: Build introspection files



commit b3755107a82a1ae540902ac807ac1d803d4b9e5d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri May 8 14:22:05 2020 +0800

    meson: Build introspection files
    
    Add rules to build introspection files for amtk

 amtk/meson.build  | 19 ++++++++++++++++++-
 meson.build       |  4 +++-
 meson_options.txt |  4 ++++
 3 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/amtk/meson.build b/amtk/meson.build
index d7f114e..d509fd6 100644
--- a/amtk/meson.build
+++ b/amtk/meson.build
@@ -30,7 +30,7 @@ amtk_sources = files(
   'amtk-utils.c',
 )
 
-amtk_enums = gnome.mkenums_simple(
+amtk_enums = GNOME.mkenums_simple(
   'amtk-enum-types',
   decorator: '_AMTK_EXTERN',
   header_prefix: '#include <amtk/amtk-types.h>',
@@ -66,4 +66,21 @@ libamtk = library('amtk', amtk_sources, amtk_enums,
 amtk_dep = declare_dependency(link_with : libamtk,
   include_directories : amtk_incdir)
 
+if get_option('introspection')
+  GNOME.generate_gir(
+    libamtk,
+    extra_args: cargs,
+    export_packages: 'amtk-@0@'.format(AMTK_API_VERSION),
+    header: 'amtk/amtk.h',
+    include_directories: amtk_incdir,
+    includes: ['Gtk-3.0'],
+    install: true,
+    namespace: 'Amtk',
+    nsversion: AMTK_API_VERSION,
+    sources: [amtk_sources, amtk_enums,],
+    # Support for deps being built as subprojects:
+    dependencies: deps,
+  )
+endif
+
 pkg.generate(libamtk)
diff --git a/meson.build b/meson.build
index cf975c5..f02536b 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,9 @@ project('amtk', 'c',
   ]
 )
 
-gnome = import('gnome')
+AMTK_API_VERSION = '5'
+
+GNOME = import('gnome')
 pkg = import('pkgconfig')
 
 subdir('amtk')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..35e0bd1
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,4 @@
+option('introspection',
+       description: 'Build the GObject introspection data for amtk',
+       type: 'boolean',
+       value: true)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]