[amtk] build: add gobject_introspection option



commit 471a635631981458658beb7bbfd5ab316a8bb6b7
Author: Sébastien Wilmet <sw swilmet be>
Date:   Mon Jan 11 10:19:13 2021 +0100

    build: add gobject_introspection option
    
    Thanks to Chun-wei Fan for an initial patch.
    
    There are occasions where one may not wish to build the introspection
    data, or is unable to do so, such as during a cross-compilation
    scenario.
    
    The option is just a boolean, I prefer to avoid automagic configuration
    (have automatic code to decide whether to enable/disable GI, that would
    be more subject to build system code changes).
    
    Closes https://gitlab.gnome.org/GNOME/amtk/-/merge_requests/6

 amtk/meson.build  | 38 ++++++++++++++++++++------------------
 meson.build       |  1 +
 meson_options.txt |  6 ++++++
 3 files changed, 27 insertions(+), 18 deletions(-)
---
diff --git a/amtk/meson.build b/amtk/meson.build
index d0471a9..281b3ca 100644
--- a/amtk/meson.build
+++ b/amtk/meson.build
@@ -103,21 +103,23 @@ PKG_CONFIG.generate(amtk_lib,
   libraries: AMTK_DEPS,
 )
 
-GNOME.generate_gir(
-  amtk_lib,
-  export_packages: 'amtk-@0@'.format(AMTK_API_VERSION),
-  header: 'amtk/amtk.h',
-  identifier_prefix: 'Amtk',
-  include_directories: ROOT_INCLUDE_DIR,
-  includes: ['Gtk-3.0'],
-  install: true,
-  namespace: 'Amtk',
-  nsversion: AMTK_API_VERSION,
-  sources: [
-    amtk_public_headers,
-    amtk_public_c_files,
-    amtk_enum_types
-  ],
-  # Support for deps being built as subprojects:
-  dependencies: AMTK_DEPS,
-)
+if get_option('gobject_introspection')
+  GNOME.generate_gir(
+    amtk_lib,
+    export_packages: 'amtk-@0@'.format(AMTK_API_VERSION),
+    header: 'amtk/amtk.h',
+    identifier_prefix: 'Amtk',
+    include_directories: ROOT_INCLUDE_DIR,
+    includes: ['Gtk-3.0'],
+    install: true,
+    namespace: 'Amtk',
+    nsversion: AMTK_API_VERSION,
+    sources: [
+      amtk_public_headers,
+      amtk_public_c_files,
+      amtk_enum_types
+    ],
+    # Support for deps being built as subprojects:
+    dependencies: AMTK_DEPS,
+  )
+endif
diff --git a/meson.build b/meson.build
index e1d895c..0d7c418 100644
--- a/meson.build
+++ b/meson.build
@@ -144,4 +144,5 @@ endif
 
 summary('API version', AMTK_API_VERSION)
 summary('Prefix', get_option('prefix'))
+summary('GObject Introspection', get_option('gobject_introspection'))
 summary('API documentation', get_option('gtk_doc'))
diff --git a/meson_options.txt b/meson_options.txt
index cad97dd..bfbe49c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,9 @@
+option(
+  'gobject_introspection',
+  type: 'boolean', value: true,
+  description: 'Build GObject Introspection data (requires gobject-introspection)'
+)
+
 option(
   'gtk_doc',
   type: 'boolean', value: false,


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