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




commit 0c87cfbac5eabb9a3b414ff3b101ace1f3edb905
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 4bb09ab9..faf2d7dd 100644
--- a/meson.build
+++ b/meson.build
@@ -30,10 +30,7 @@ gtk_dep = dependency('gtk+-3.0', version : gtk_version)
 hdy_dep = dependency('libhandy-1', version: hdy_version)
 
 # 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()
@@ -54,6 +51,8 @@ if get_option('cpio') == 'auto'
   endif
 endif
 
+build_introspection = gobject_introspection_dep.found()
+
 # config.h
 
 config_data = configuration_data()
@@ -73,7 +72,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 6040c516..2f3ec62b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -35,7 +35,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 7e75ae6c..0acc6273 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -130,20 +130,20 @@ fr_exe = executable('file-roller',
     gthread_dep, 
     gtk_dep, 
     hdy_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]