[gtk+] Allow building without tests and demos



commit b5e00d36f084b827c48e4c9b8adc8fcedc14f2ff
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 6 08:33:18 2017 -0400

    Allow building without tests and demos
    
    This is meant to cut down build time in flatpak and similar
    situations. Since it produces technically incomplete builds,
    we list these options in the status output at the end of
    the meson run.

 docs/reference/gtk/building.sgml |   24 ++++++++++++++++++------
 meson.build                      |   16 +++++++++++-----
 meson_options.txt                |    4 ++++
 3 files changed, 33 insertions(+), 11 deletions(-)
---
diff --git a/docs/reference/gtk/building.sgml b/docs/reference/gtk/building.sgml
index 2f2dc1b..51e5d8e 100644
--- a/docs/reference/gtk/building.sgml
+++ b/docs/reference/gtk/building.sgml
@@ -462,12 +462,12 @@ How to compile GTK+ itself
       </formalpara>
 
       <formalpara>
-        <title><systemitem>-Denable-x11-backend</systemitem>,
-          <systemitem>-Denable-win32-backend</systemitem>,
-          <systemitem>-Denable-quartz-backend</systemitem>,
-          <systemitem>-Denable-broadway-backend</systemitem>,
-          <systemitem>-Denable-wayland-backend</systemitem>, and
-          <systemitem>-Denable-mir-backend</systemitem></title>
+        <title><systemitem>enable-x11-backend</systemitem>,
+          <systemitem>enable-win32-backend</systemitem>,
+          <systemitem>enable-quartz-backend</systemitem>,
+          <systemitem>enable-broadway-backend</systemitem>,
+          <systemitem>enable-wayland-backend</systemitem>, and
+          <systemitem>enable-mir-backend</systemitem></title>
 
         <para>
           Enable specific backends for GDK.  If none of these options
@@ -480,6 +480,18 @@ How to compile GTK+ itself
         </para>
       </formalpara>
 
+      <formalpara>
+        <title><systemitem>build-tests</systemitem>
+          <systemitem>demos</systemitem></title>
+
+        <para>
+          By default, GTK+ will build quite a few tests and demos.
+          While these are useful on a developer system, they are not
+          needed when GTK+ is built e.g. for a flatpak runtime. These
+          options allow to disable building tests and demos.
+        </para>
+      </formalpara>
+
     </refsect1>
 
 </refentry>
diff --git a/meson.build b/meson.build
index 995680a..85f408c 100644
--- a/meson.build
+++ b/meson.build
@@ -520,11 +520,15 @@ subdir('modules/input')
 subdir('gdk')
 subdir('gsk')
 subdir('gtk')
-subdir('demos')
 subdir('modules')
-subdir('tests')
-subdir('testsuite')
-subdir('examples')
+if get_option('enable-tests')
+  subdir('tests')
+  subdir('testsuite')
+endif
+if get_option('demos')
+  subdir('demos')
+  subdir('examples')
+endif
 
 # config.h
 configure_file(input: 'config.h.meson',
@@ -615,8 +619,10 @@ summary = [
   'GTK+ @0@ (@1@)'.format(gtk_version, gtk_api_version),
   '',
   '  Enabled backends: @0@'.format(pkg_targets.strip()),
-  '  Documentation: @0@'.format(get_option('enable-documentation')),
   '  Vulkan support: @0@'.format(have_vulkan),
+  '  Tests: @0@'.format(get_option('build-tests')),
+  '  Documentation: @0@'.format(get_option('enable-documentation')),
+  '  Demos: @0@'.format(get_option('demos')),
   '------',
   ''
 ]
diff --git a/meson_options.txt b/meson_options.txt
index 586ad3e..f3b587a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -36,3 +36,7 @@ option('enable-man-pages', type: 'boolean', value: 'false',
   description : 'Build man pages for installed tools')
 option('enable-gir', type: 'boolean', value: 'true',
   description : 'Build introspection data (requires gobject-introspection)')
+option('demos', type: 'boolean', value: 'true',
+  description : 'Build demos and example programs')
+option('build-tests', type: 'boolean', value: 'true',
+  description : 'Build tests')


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