[libgnome-volume-control/wip/inigomartinez/meson: 6/8] build: Make use of assert function
- From: Iñigo Martínez <inigomartinez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgnome-volume-control/wip/inigomartinez/meson: 6/8] build: Make use of assert function
- Date: Mon, 29 Jan 2018 13:47:48 +0000 (UTC)
commit 7a83f0caa6bbac71ceaf2bba8e0565dedfeca037
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Sat Jan 27 09:45:58 2018 +0100
build: Make use of assert function
meson has support for `assert` function, which halts meson's
execution showing a given message when a given condition is false.
This patch takes advantage of this function to slightly improve
meson's build file readibility.
It also removes a duplicated check for `pkglibdir` being set when
introspection is also set, because this check is already done when
a shared library is being created, that is a precondition for
introspection generation.
https://bugzilla.gnome.org/show_bug.cgi?id=792948
meson.build | 19 ++++---------------
1 files changed, 4 insertions(+), 15 deletions(-)
---
diff --git a/meson.build b/meson.build
index a9b223a..0d16eea 100644
--- a/meson.build
+++ b/meson.build
@@ -3,9 +3,7 @@ project('gvc', 'c',
default_options: 'default_library=static'
)
-if not meson.is_subproject()
- error('This project is only intended to be used as a subproject!')
-endif
+assert(meson.is_subproject(), 'This project is only intended to be used as a subproject!')
gnome = import('gnome')
@@ -68,13 +66,7 @@ cdata.set('HAVE_ALSA', enable_alsa)
static = get_option('default_library') == 'static'
enable_introspection = get_option('introspection')
-if not static and pkglibdir == ''
- error('Installing shared library, but pkglibdir is unset!')
-endif
-
-if static and enable_introspection
- error('Currently meson requires a shared library for building girs.')
-endif
+assert(static or pkglibdir != '', 'Installing shared library, but pkglibdir is unset!')
c_args = ['-DG_LOG_DOMAIN="Gvc"']
@@ -93,11 +85,8 @@ libgvc = library('gvc',
)
if enable_introspection
- if pkgdatadir == ''
- error('Installing introspection, but pkgdatadir is unset!')
- elif (pkglibdir == '')
- error('Installing introspection, but pkglibdir is unset!')
- endif
+ assert(not static, 'Currently meson requires a shared library for building girs.')
+ assert(pkgdatadir != '', 'Installing introspection, but pkgdatadir is unset!')
libgvc_gir = gnome.generate_gir(libgvc,
sources: libgvc_gir_sources + libgvc_gir_headers,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]