[polari/wip/fmuellner/ci-snapshots: 3/9] build: Add config header
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/ci-snapshots: 3/9] build: Add config header
- Date: Fri, 3 Aug 2018 20:06:27 +0000 (UTC)
commit a55f734f4733f1ae3da9a436a7c43f659e93e06d
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Jul 25 19:02:40 2018 +0200
build: Add config header
So far we've just passed the defines we need directly to the compiler,
but as we'll soon add some more configuration, it makes senses to start
adding a config.h.
https://gitlab.gnome.org/GNOME/polari/issues/61
meson.build | 20 +++++++++++++++++---
src/meson.build | 10 +---------
src/polari.c | 2 ++
3 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/meson.build b/meson.build
index 6089d55..d969d95 100644
--- a/meson.build
+++ b/meson.build
@@ -39,10 +39,24 @@ telepathy_glib = dependency('telepathy-glib')
girepository = dependency('gobject-introspection-1.0')
gjs = dependency('gjs-1.0')
+conf = configuration_data()
+
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('PREFIX', prefix)
+conf.set_quoted('LIBDIR', libdir)
+conf.set_quoted('PKGLIBDIR', pkglibdir)
+
cc = meson.get_compiler('c')
-if (cc.has_function('strcasestr'))
- add_project_arguments('-DHAVE_STRCASECSTR', language: 'c')
-endif
+conf.set10('HAVE_STRCASESTR', cc.has_function('strcasestr'))
+
+config_h = declare_dependency(
+ sources: configure_file(
+ configuration: conf,
+ output: 'config.h'
+ ),
+ include_directories: include_directories('.')
+)
subdir('src')
subdir('data')
diff --git a/src/meson.build b/src/meson.build
index 45e95f2..32df375 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -59,16 +59,8 @@ src_resources = gnome.compile_resources(
c_name: 'src_resources'
)
-exeargs = [
- '-DPACKAGE_NAME="polari"',
- '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
- '-DPREFIX="@0@"'.format(prefix),
- '-DLIBDIR="@0@"'.format(libdir),
- '-DPKGLIBDIR="@0@"'.format(pkglibdir)
-]
polari = executable('polari', ['polari.c', src_resources, data_resources],
- dependencies: [gio, girepository, gjs],
- c_args: exeargs,
+ dependencies: [config_h, gio, girepository, gjs],
install: true
)
diff --git a/src/polari.c b/src/polari.c
index 30f4367..eedf0a4 100644
--- a/src/polari.c
+++ b/src/polari.c
@@ -1,6 +1,8 @@
#include <girepository.h>
#include <gjs/gjs.h>
+#include "config.h"
+
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GjsContext, g_object_unref)
const char *src =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]