[glibmm/mkolny/meson-build: 2/2] Add meson build for glibmm library
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/mkolny/meson-build: 2/2] Add meson build for glibmm library
- Date: Sun, 30 Jul 2017 14:39:26 +0000 (UTC)
commit 020c0f14e1d25a11ecd90b47bb2b8ee8d5f48d94
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sun Jul 30 14:58:47 2017 +0100
Add meson build for glibmm library
glib/glibmm/meson.build | 142 +++++++++++++++++++++++++++++++++++++++++++++++
glib/meson.build | 4 +
meson.build | 38 +++++++++++++
tools/meson.build | 9 +++
tools/wrap_output.py | 7 ++
5 files changed, 200 insertions(+), 0 deletions(-)
---
diff --git a/glib/glibmm/meson.build b/glib/glibmm/meson.build
new file mode 100644
index 0000000..d6b1ab6
--- /dev/null
+++ b/glib/glibmm/meson.build
@@ -0,0 +1,142 @@
+glibdep = dependency('glib-2.0')
+gmoduledep = dependency('gmodule-2.0')
+gobjectdep = dependency('gobject-2.0')
+sigcppdep = dependency('sigc++-3.0')
+
+python = find_program('python')
+perl = find_program('perl')
+m4 = find_program('m4')
+
+wrap_output = join_paths(meson.source_root(), 'tools', 'wrap_output.py')
+
+glibmm_modules = [
+ 'balancedtree',
+ 'binding',
+ 'bytes',
+ 'bytearray',
+ 'checksum',
+ 'convert',
+ 'date',
+ 'datetime',
+ 'enums',
+ 'fileutils',
+ 'iochannel',
+ 'keyfile',
+ 'markup',
+ 'miscutils',
+ 'module',
+ 'nodetree',
+ 'optioncontext',
+ 'optionentry',
+ 'optiongroup',
+ 'regex',
+ 'shell',
+ 'spawn',
+ 'timezone',
+ 'unicode',
+ 'uriutils',
+ 'variant',
+ 'variantdict',
+ 'variantiter',
+ 'varianttype']
+
+glibmm_handwritten_sources = [
+ 'base64.cc',
+ 'class.cc',
+ 'debug.cc',
+ 'dispatcher.cc',
+ 'error.cc',
+ 'exception.cc',
+ 'exceptionhandler.cc',
+ 'init.cc',
+ 'interface.cc',
+ 'main.cc',
+ 'object.cc',
+ 'objectbase.cc',
+ 'pattern.cc',
+ 'property.cc',
+ 'propertyproxy.cc',
+ 'propertyproxy_base.cc',
+ 'quark.cc',
+ 'random.cc',
+ 'signalproxy.cc',
+ 'signalproxy_connectionnode.cc',
+ 'stringutils.cc',
+ 'timer.cc',
+ 'timeval.cc',
+ 'ustring.cc',
+ 'utility.cc',
+ 'value.cc',
+ 'value_custom.cc',
+ 'vectorutils.cc',
+ 'wrap.cc']
+
+glibmm_m4_files = [
+ 'value_basictypes.cc',
+ 'value_basictypes.h',
+ 'variant_basictypes.cc',
+ 'variant_basictypes.h']
+
+glibmm_targets = []
+
+#TODO ugly hack, has to be implemented in other way in the future
+private_dir = join_paths(meson.build_root(), 'glib', 'glibmm', 'private')
+glibmm_targets += custom_target('generate_priv_dir',
+ output : 'private',
+ command : [python, '-c',
+ 'import os\nos.mkdir("' + private_dir + '")'])
+
+glibmm_targets += custom_target('generate_wrap_init',
+ output : 'wrap_init.cc',
+ command : [python,
+ wrap_output,
+ perl,
+ join_paths(meson.current_build_dir(), 'wrap_init.cc'),
+ '--',
+ join_paths(meson.build_root(), 'tools', 'generate_wrap_init.pl'),
+ '--namespace=Glib', '--parent_dir=glibmm'])
+
+foreach glibmm_module : glibmm_modules
+ glibmm_targets += custom_target('generate_cc_' + glibmm_module,
+ output : [glibmm_module + '.cc', glibmm_module + '.h'],
+ input : '../src/' + glibmm_module + '.hg',
+ command : [perl,
+ '-I../tools/pm', '--', join_paths(meson.build_root(), 'tools', 'gmmproc'),
+ '-I', join_paths(meson.source_root(), 'tools', 'm4'),
+ '--defs', join_paths(meson.current_source_dir(), '..', 'src'),
+ glibmm_module,
+ join_paths(meson.current_source_dir(), '..', 'src'),
+ join_paths('glib', 'glibmm')])
+endforeach
+
+# TODO: foreach above could be replaced with the following code in the future:
+# TODO: we should be able to move generated files to user-specified directory
+#source_gen = generator(perl,
+# output : ['@BASENAME@.cc', '@BASENAME@.h'],
+# input : '@BASENAME@.ccg',
+# arguments : ['-I../tools/pm', '--', 'gmmproc', '-I', '../tools/m4', '--defs',
'../glib/src', '@INPUT@', '../glib/src', '@BUILD_DIR@'])
+#gen_sources = source_gen.process(glibmm_files_any_hg)
+#glibmm = shared_library('glibmm', gen_sources,
+# include_directories : glibmm_inc, dependencies : [glibdep, gmoduledep, sigcppdep])
+
+foreach m4_file : glibmm_m4_files
+ glibmm_targets += custom_target('generate_from_m4' + m4_file,
+ output : m4_file,
+ input : join_paths('..', 'src', m4_file + '.m4'),
+ command : [python,
+ wrap_output,
+ m4,
+ join_paths(meson.build_root(), '@OUTPUT@'),
+ '@INPUT@',
+ '-I' + join_paths(meson.source_root(), 'glib', 'src')])
+endforeach
+
+
+glibmm_includes = include_directories('..', 'glib')
+
+glibmm_library = shared_library(
+ 'glibmm',
+ glibmm_targets, glibmm_handwritten_sources,
+ include_directories : glibmm_includes,
+ dependencies : [glibdep, sigcppdep, gobjectdep, gmoduledep])
+
diff --git a/glib/meson.build b/glib/meson.build
new file mode 100644
index 0000000..45405d8
--- /dev/null
+++ b/glib/meson.build
@@ -0,0 +1,4 @@
+configure_file(output : 'glibmmconfig.h',
+ configuration : conf)
+
+subdir('glibmm')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..57dd37c
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,38 @@
+project('glibmm', 'cpp',
+ license: 'LGPL',
+ version: '2.53.2',
+ meson_version: '>= 0.40.1',
+ default_options: [
+ 'c_std=gnu14',
+ 'cpp_std=c++14',
+ 'warning_level=1',
+ ],
+)
+
+conf = configuration_data()
+conf.set_quoted('PACKAGE_NAME', 'glibmm')
+conf.set('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('PACKAGE_DOCDIR', join_paths(get_option('prefix'), get_option('datadir'), 'doc/glibmm'))
+conf.set_quoted('PACKAGE_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
+conf.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
+conf.set_quoted('PACKAGE_LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir')))
+conf.set_quoted('PACKAGE_URL', 'https://bugzilla.gnome.org/enter_bug.cgi?product=glibmm')
+conf.set('GETTEXT_PACKAGE', 'PACKAGE_NAME')
+conf.set('LOCALEDIR', 'PACKAGE_LOCALE_DIR')
+
+conf.set('GLIBMM_API', '')
+conf.set('M4', 'm4')
+
+configure_file(output : 'config.h',
+ configuration : conf)
+
+config_inc_dir = include_directories('.')
+
+global_cxx_args = [
+ '-Wno-unused-parameter'
+]
+
+add_project_arguments(global_cxx_args, language: 'cpp')
+
+subdir('tools')
+subdir('glib')
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..c985a80
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,9 @@
+configure_file(
+ input : 'gmmproc.in',
+ output : 'gmmproc',
+ configuration : conf)
+
+configure_file(
+ input : 'generate_wrap_init.pl.in',
+ output : 'generate_wrap_init.pl',
+ configuration : conf)
diff --git a/tools/wrap_output.py b/tools/wrap_output.py
new file mode 100644
index 0000000..0256698
--- /dev/null
+++ b/tools/wrap_output.py
@@ -0,0 +1,7 @@
+from subprocess import call
+import sys
+
+f = open(sys.argv[2], "w")
+
+call_args = [sys.argv[1]] + sys.argv[3:]
+call(call_args, stdout = f)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]