[gtk-doc/tests-option] Allow disabling the test suite



commit bfc59c0c7b92fbf3b298bc366f7f584c3429a3f5
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Apr 21 12:54:18 2019 +0100

    Allow disabling the test suite
    
    The GTK-Doc test suite depends on GLib/GObject, which creates a circular
    dependency between GLib and GTK-Doc. By adding an option to build
    GTK-Doc without its test suite, we can break the circular dependency.

 meson.build               |  3 +--
 meson_options.txt         |  5 ++++-
 tests/gobject/meson.build |  2 +-
 tests/meson.build         | 29 +++++++++++++++++------------
 4 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/meson.build b/meson.build
index 46277e7..0cb5047 100644
--- a/meson.build
+++ b/meson.build
@@ -32,8 +32,6 @@ pkgconfigdir = join_paths(datadir, 'pkgconfig')
 glib_req = '>= 2.38.0'
 python3_req = '>= 3.4.0'
 
-glib_dep = dependency('glib-2.0', version: glib_req)
-gobject_dep = dependency('gobject-2.0', version: glib_req)
 python3_dep = dependency('python3', version: python3_req)
 
 python_prg = python.find_python()
@@ -162,6 +160,7 @@ summary = [
   '      CMake support: @0@'.format(get_option('cmake_support')),
   '         PDF output: @0@'.format(generate_pdf_output),
   '        User manual: @0@'.format(get_option('yelp_manual')),
+  '         Test suite: @0@'.format(get_option('tests')),
   '------',
 ]
 
diff --git a/meson_options.txt b/meson_options.txt
index ce44377..f1f54a4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,4 +6,7 @@ option('cmake_support',
        description: 'Install CMake macros')
 option('yelp_manual',
        type: 'boolean', value: true,
-       description: 'Build the user manual (requires yelp-tools)')
\ No newline at end of file
+       description: 'Build the user manual (requires yelp-tools)')
+option('tests',
+       type: 'boolean', value: true,
+       description: 'Build the test suite (requires glib)')
diff --git a/tests/gobject/meson.build b/tests/gobject/meson.build
index dc00692..d7525bd 100644
--- a/tests/gobject/meson.build
+++ b/tests/gobject/meson.build
@@ -1,2 +1,2 @@
 subdir('src')
-subdir('docs')
\ No newline at end of file
+subdir('docs')
diff --git a/tests/meson.build b/tests/meson.build
index b48f978..a60cf46 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,9 +1,3 @@
-glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
-glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
-
-gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix')
-gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html')
-
 gtkdoc_unit_tests = [
   'check',
   'common',
@@ -31,9 +25,20 @@ endforeach
 
 subdir('helpers')
 
-subdir('annotations')
-subdir('bugs')
-subdir('empty')
-subdir('fail')
-subdir('gobject')
-subdir('program')
+if get_option('tests') == true
+  glib_dep = dependency('glib-2.0', version: glib_req)
+  gobject_dep = dependency('gobject-2.0', version: glib_req)
+
+  glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+  glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+
+  gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix')
+  gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html')
+
+  subdir('annotations')
+  subdir('bugs')
+  subdir('empty')
+  subdir('fail')
+  subdir('gobject')
+  subdir('program')
+endif


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