[glibmm/mkolny/meson-build] update config
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/mkolny/meson-build] update config
- Date: Wed, 2 Aug 2017 20:02:57 +0000 (UTC)
commit 444d448a2d18c29dc25bcfd36b45f485b2d3febf
Author: Marcin Kolny <marcin kolny gmail com>
Date: Wed Aug 2 19:20:45 2017 +0100
update config
meson.build | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 1 +
2 files changed, 122 insertions(+), 0 deletions(-)
---
diff --git a/meson.build b/meson.build
index 85c3ead..7f2447e 100644
--- a/meson.build
+++ b/meson.build
@@ -20,8 +20,128 @@ m4 = find_program('m4')
wrap_output = join_paths(meson.source_root(), 'tools', 'wrap_output.py')
+version_arr = meson.project_version().split('.')
+glibmm_version_major = version_arr[0].to_int()
+glibmm_version_minor = version_arr[1].to_int()
+glibmm_version_micro = version_arr[2].to_int()
+
+compiler = meson.get_compiler('cpp')
+
conf = configuration_data()
+conf.set('GLIBMM_MAJOR_VERSION', glibmm_version_major)
+conf.set('GLIBMM_MINOR_VERSION', glibmm_version_minor)
+conf.set('GLIBMM_MICRO_VERSION', glibmm_version_micro)
+conf.set('GIOMM_MAJOR_VERSION', glibmm_version_major)
+conf.set('GIOMM_MINOR_VERSION', glibmm_version_minor)
+conf.set('GIOMM_MICRO_VERSION', glibmm_version_micro)
+
+conf.set('GLIBMM_DISABLE_DEPRECATED', get_option('disable-deprecated-api'))
+conf.set('GIOMM_DISABLE_DEPRECATED', get_option('disable-deprecated-api'))
+
+conf.set('SIZEOF_WCHAR_T', compiler.sizeof('wchar_t'))
+
+tstcompiler = '''struct foo
+{
+ template <class C> inline void doit();
+ void thebug();
+};
+
+template <class C>
+inline void foo::doit()
+{}
+
+struct bar
+{
+ void neitherabug();
+};
+
+void bar::neitherabug()
+{
+ void (foo::*func)();
+ func = &foo::doit<int>;
+ (void)func;
+}
+
+void foo::thebug()
+{
+ void (foo::*func)();
+ func = &foo::doit<int>; // the compiler bugs usually show here
+ (void)func;
+}
+int main() {
+ void (foo::*func)();
+ func = &foo::doit<int>;
+ (void)func;
+ return 0;
+}
+'''
+
+if compiler.compiles(tstcompiler)
+ conf.set('GLIBMM_MEMBER_FUNCTIONS_MEMBER_TEMPLATES', 1)
+endif
+
+compilertest = '''
+template <class T> class Foo {};
+
+template <class T> class Traits
+{
+public:
+ const char* whoami() { return "generic template"; }
+};
+
+template <class T> class Traits< Foo<T> >
+{
+public:
+ const char* whoami() { return "partial specialization for Foo<T>"; }
+};
+
+template <class T> class Traits< Foo<const T> >
+{
+public:
+ const char* whoami() { return "partial specialization for Foo<const T>"; }
+};
+
+int main() {
+ Traits<int> it;
+ Traits< Foo<int> > fit;
+ Traits< Foo<const int> > cfit;
+
+ (void) it.whoami();
+ (void) fit.whoami();
+ (void) cfit.whoami();
+
+ return 0;
+}
+'''
+if compiler.compiles(compilertest)
+ conf.set('GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS', 1)
+endif
+
+compilertest = '''
+class SomeClass;
+
+SomeClass* some_function();
+
+template <class T>
+class SomeTemplate
+{
+ static bool do_something()
+ {
+ // This does not compile with the MipsPro (IRIX) compiler
+ // even if we don't use this template at all.
+ return (dynamic_cast<T*>(some_function()) != 0);
+ }
+};
+'''
+if compiler.compiles(compilertest)
+ conf.set('GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION', 1)
+endif
+
+if compiler.has_type('std::wostringstream', prefix : '#include<sstream>')
+ conf.set('GLIBMM_HAVE_WIDE_STREAM', 1)
+endif
+
conf.set('GLIBMM_API', '')
conf.set('M4', 'm4')
@@ -36,3 +156,4 @@ subdir('tools')
subdir('glib')
subdir('gio')
subdir('examples')
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..5367831
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('disable-deprecated-api', type : 'boolean', value : true)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]