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.
This commit is contained in:
Matthias Clasen 2017-09-06 08:33:18 -04:00
parent af5d3e3299
commit b5e00d36f0
3 changed files with 33 additions and 11 deletions

View File

@ -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>

View File

@ -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')),
'------',
''
]

View File

@ -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')