[file-roller/wip/jtojnar/api_docs: 2/4] build: Switch introspection to a feature




commit 596a6d133194cfee733e522669b074a5bdf14ce1
Author: Jan Tojnar <jtojnar gmail com>
Date:   Sat May 7 04:23:34 2022 +0200

    build: Switch introspection to a feature
    
    This results in a slightly nicer code.
    Also rename the variable to something more sensible.

 meson.build       | 9 ++++-----
 meson_options.txt | 4 ++--
 src/meson.build   | 6 +++---
 3 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/meson.build b/meson.build
index 1304bbd9..89db09f4 100644
--- a/meson.build
+++ b/meson.build
@@ -34,10 +34,7 @@ libportal_dep = dependency('libportal', version: '>= 0.5', required: use_native_
 libportal_gtk3_dep = dependency('libportal-gtk3', version: '>= 0.5', required: use_native_appchooser)
 
 # Optional dependencies
-use_gobject_introspection = get_option('introspection')
-if use_gobject_introspection
-  gobject_introspection_dep = dependency('gobject-introspection-1.0')
-endif
+gobject_introspection_dep = dependency('gobject-introspection-1.0', required: get_option('introspection'))
 
 libnautilus_extension_dep = dependency('libnautilus-extension', version : nautilus_version, required : 
get_option('nautilus-actions'))
 build_nautilus_actions = libnautilus_extension_dep.found()
@@ -58,6 +55,8 @@ if get_option('cpio') == 'auto'
   endif
 endif
 
+build_introspection = gobject_introspection_dep.found()
+
 # config.h
 
 config_data = configuration_data()
@@ -77,7 +76,7 @@ else
   config_data.set_quoted('UIDIR', join_paths(datadir, meson.project_name(), 'ui'))
   config_data.set_quoted('SHDIR', join_paths(prefix, get_option('libexecdir'), meson.project_name()))  
 endif
-if use_gobject_introspection
+if build_introspection
   config_data.set('ENABLE_INTROSPECTION', 1)
 endif
 if use_json_glib
diff --git a/meson_options.txt b/meson_options.txt
index 4bd69b6d..8b5746a9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -43,7 +43,7 @@ option('cpio',
 )
 
 option('introspection',
-  type : 'boolean',
-  value : false,
+  type : 'feature',
+  value : 'disabled',
   description : 'Generate introspection data for the executable (e.g. for static analysis)'
 )
diff --git a/src/meson.build b/src/meson.build
index 1bf3f873..ac6e2b3e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -132,20 +132,20 @@ fr_exe = executable('file-roller',
     hdy_dep,
     use_native_appchooser ? libportal_dep : [],
     use_native_appchooser ? libportal_gtk3_dep : [],
-    use_gobject_introspection ? gobject_introspection_dep : [],
+    build_introspection ? gobject_introspection_dep : [],
     use_json_glib ? libjson_glib_dep : [],
     use_libarchive ? libarchive_dep : []
   ],
   link_args: [
     # Required for GIRepository to be able to dump symbols.
-    use_gobject_introspection ? '-Wl,--export-dynamic' : [],
+    build_introspection ? '-Wl,--export-dynamic' : [],
   ],
   include_directories : config_inc,
   c_args : c_args,
   install : true
 )
 
-if use_gobject_introspection
+if build_introspection
   fr_gir = gnome.generate_gir(
     fr_exe,
     sources: [


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