[pango/wip/meson: 5/7] meson: Add a few missing things, minor fixes, TODO
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/wip/meson: 5/7] meson: Add a few missing things, minor fixes, TODO
- Date: Fri, 19 May 2017 16:33:12 +0000 (UTC)
commit 09623d50ac8afd9b246e571372972142af5daaa3
Author: Nirbheek Chauhan <nirbheek centricular com>
Date: Fri May 19 11:58:44 2017 +0100
meson: Add a few missing things, minor fixes, TODO
docs/meson.build | 4 +-
examples/meson.build | 6 +++
meson.build | 71 ++++++++++++++++++++++++++--------------
meson_options.txt | 4 +-
pango/meson.build | 6 ++--
pango/mini-fribidi/meson.build | 4 +--
tests/meson.build | 12 +++---
7 files changed, 66 insertions(+), 41 deletions(-)
---
diff --git a/docs/meson.build b/docs/meson.build
index 2349689..336903b 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -35,7 +35,7 @@ private_headers = [
'mini-fribidi',
]
-if not host_system.contains('darwin')
+if host_system != 'darwin'
private_headers += [
'pangocairo-coretextfont.h',
'pangocairo-coretext.h',
@@ -43,7 +43,7 @@ if not host_system.contains('darwin')
]
endif
-if not host_system.contains('windows')
+if host_system != 'windows'
private_headers += [
'pangocairo-win32.h',
'pangowin32.h',
diff --git a/examples/meson.build b/examples/meson.build
index ebcec9b..8c7275f 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -14,6 +14,12 @@ if pango_font_backends.contains('freetype')
examples_deps += libpangoft2_dep
endif
+if host_system == 'windows'
+ # This hasn't been built in years, most likely, but try now
+ examples += [ 'pangowin32tobmp' ]
+ examples_deps += [ libpangowin32_dep ]
+endif
+
foreach e: examples
executable(e, '@0@.c'.format(e),
dependencies: examples_deps + pango_deps,
diff --git a/meson.build b/meson.build
index 58b92e4..2bac3b5 100644
--- a/meson.build
+++ b/meson.build
@@ -1,11 +1,12 @@
-project('pango', 'c', version: '1.40.5',
+project('pango', 'c', 'cpp',
+ version: '1.40.5',
license: 'LGPLv2.1+',
default_options: [
'buildtype=debugoptimized',
'warning_level=1',
'c_std=c99',
],
- meson_version : '>= 0.40.0')
+ meson_version : '>= 0.40.1')
add_project_arguments([ '-D_POSIX_C_SOURCE', '-D_POSIX_THREAD_SAFE_FUNCTIONS', '-D_GNU_SOURCE', ], language:
'c')
@@ -42,6 +43,7 @@ host_system = host_machine.system()
# Compiler and linker flags
common_cflags = []
+common_cppflags = []
common_ldflags = []
# Add more compiler warnings to the default set
@@ -67,19 +69,25 @@ if cc.get_id() == 'msvc'
'-we4071', # no function prototype given
'-we4819', # the file contains a character that cannot be represented in the current code page
]
+ test_c_only_flags = []
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
- test_cflags = [
+ test_c_only_flags = [
+ '-Wimplicit-function-declaration',
+ '-Wstrict-prototypes',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wold-style-definition',
+ '-Wno-int-conversion',
+ '-Wno-discarded-qualifiers',
+ ]
+
+ test_cflags = test_c_only_flags + [
'-fno-strict-aliasing',
'-Wpointer-arith',
'-Wmissing-declarations',
- '-Wimplicit-function-declaration',
'-Wformat=2',
'-Wformat-nonliteral',
'-Wformat-security',
- '-Wstrict-prototypes',
- '-Wmissing-prototypes',
- '-Wnested-externs',
- '-Wold-style-definition',
'-Wunused',
'-Wcast-align',
'-Wmissing-noreturn',
@@ -88,8 +96,6 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
'-Wlogical-op',
'-Wno-uninitialized',
'-Wno-shadow',
- '-Wno-int-conversion',
- '-Wno-discarded-qualifiers',
'-Werror=redundant-decls',
'-Werror=implicit',
'-Werror=nonnull',
@@ -108,32 +114,43 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
'-Werror=write-strings',
'-Werror=undef',
]
+
+ if host_system == 'windows'
+ test_cflags += [ '-mms-bitfields' ]
+ endif
else
test_cflags = []
+ test_c_only_flags = []
endif
-foreach cflag: test_cflags
- if cc.has_argument(cflag)
- common_cflags += [ cflag ]
- endif
-endforeach
-
# Symbol visibility
if get_option('default_library') != 'static'
- if host_machine.system() == 'windows'
+ if host_system == 'windows'
pango_conf.set('DLL_EXPORT', true)
- if cc.get_id() == 'msvc'
- pango_conf.set('_PANGO_EXTERN', '__declspec(dllexport) extern')
- else
- pango_conf.set('_PANGO_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
- common_cflags += ['-fvisibility=hidden']
+ pango_conf.set('_PANGO_EXTERN', '__declspec(dllexport) extern')
+ if cc.get_id() != 'msvc'
+ test_cflags += ['-fvisibility=hidden']
endif
else
pango_conf.set('_PANGO_EXTERN', '__attribute__((visibility("default"))) extern')
- common_cflags += ['-fvisibility=hidden']
+ test_cflags += ['-fvisibility=hidden']
endif
endif
+# Check all compiler flags
+foreach cflag: test_cflags
+ if cc.has_argument(cflag)
+ common_cflags += [ cflag ]
+ endif
+endforeach
+
+# Isolate the C++ compiler flags
+foreach cflag: common_cflags
+ if not test_c_only_flags.contains(cflag)
+ common_cppflags += [ cflag ]
+ endif
+endforeach
+
# Linker flags
if host_machine.system() == 'linux'
foreach ldflag: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ]
@@ -176,10 +193,14 @@ foreach h: checked_headers
endforeach
buildtype = get_option('buildtype')
-if buildtype == 'debug' or buildtype == 'debugoptimized'
+if buildtype.startswith('debug')
pango_debug_cflags = [ '-DPANGO_ENABLE_DEBUG', ]
elif buildtype == 'release'
pango_debug_cflags = [ '-DG_DISABLE_CAST_CHECKS', ]
+ # TODO: We may want a configuration argument to add `G_DISABLE_CHECKS`
+ # and `G_DISABLE_ASSERT` from the build, for specific build environments.
+ # On the other hand, those who need these symbols can inject them in their
+ # build as well.
else
pango_debug_cflags = []
endif
@@ -343,6 +364,6 @@ subdir('pango-view')
subdir('tests')
subdir('tools')
-if get_option('enable-gtk-doc')
+if get_option('enable_docs')
subdir('docs')
endif
diff --git a/meson_options.txt b/meson_options.txt
index 783c1d5..e5f6022 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,4 @@
-option('enable-gtk-doc',
+option('enable_docs',
description: 'Build API reference for Pango using GTK-Doc',
type: 'boolean',
- default: 'false')
+ value: false)
diff --git a/pango/meson.build b/pango/meson.build
index bbc6a57..9e9756b 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -242,7 +242,7 @@ if xft_dep.found()
endif
# Win32
-if host_system.contains('windows')
+if host_system == 'windows'
pangowin32_headers = [
'pangowin32.h',
]
@@ -306,7 +306,7 @@ if cairo_dep.found()
pangocairo_gir_deps += pangoft2_gir_dep
endif
- if host_system.contains('windows') and pango_font_backends.contains('win32')
+ if host_system == 'windows' and pango_font_backends.contains('win32')
pangocairo_sources += [
'pangocairo-win32font.c',
'pangocairo-win32fontmap.c',
@@ -315,7 +315,7 @@ if cairo_dep.found()
pangocairo_deps += libpangowin32_dep
endif
- if host_system.contains('darwin') and pango_font_backends.contains('quartz')
+ if host_system == 'darwin' and pango_font_backends.contains('quartz')
pangocairo_sources += [
'pangocoretext.c',
'pangocoretext-fontmap.c',
diff --git a/pango/mini-fribidi/meson.build b/pango/mini-fribidi/meson.build
index e9dab25..4d87dc2 100644
--- a/pango/mini-fribidi/meson.build
+++ b/pango/mini-fribidi/meson.build
@@ -14,6 +14,4 @@ mini_fribidi_lib = static_library('libmini-fribidi', sources: mini_fribidi_sourc
mini_fribidi_dep = declare_dependency(link_with: mini_fribidi_lib,
dependencies: [ mathlib_dep, gobject_dep ],
- include_directories: [
- include_directories('.'),
- ])
+ include_directories: include_directories('.'))
diff --git a/tests/meson.build b/tests/meson.build
index 1a21101..d69a0d0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -6,11 +6,7 @@ if xft_dep.found()
test_cflags += [ '-DHAVE_X', '-DHAVE_XFT' ]
endif
-if freetype_dep.found()
- test_cflags += '-DHAVE_FREETYPE'
-endif
-
-if host_system.contains('windows')
+if host_system == 'windows'
test_cflags += '-DHAVE_WIN32'
endif
@@ -25,15 +21,18 @@ tests = [
[ 'testboundaries_ucd' ],
[ 'testcolor' ],
[ 'testscript' ],
+ [ 'cxx-test', [ 'cxx-test.cpp' ] ],
]
if freetype_dep.found()
+ test_cflags += '-DHAVE_FREETYPE'
tests += [
[ 'test-ot-tags', [ 'test-ot-tags.c' ], [ libpangoft2_dep ] ],
]
endif
if cairo_dep.found()
+ test_cflags += '-DHAVE_CAIRO'
tests += [
[ 'testiter', [ 'testiter.c' ], [ libpangocairo_dep ] ],
[ 'test-pangocairo-threads', [ 'test-pangocairo-threads.c' ], [ libpangocairo_dep, cairo_dep ] ],
@@ -52,6 +51,7 @@ foreach t: tests
bin = executable(name, src,
dependencies: deps,
include_directories: root_inc,
- c_args: common_cflags + pango_debug_cflags)
+ c_args: common_cflags + pango_debug_cflags + test_cflags,
+ cpp_args: common_cppflags + pango_debug_cflags + test_cflags)
test(name, bin, env: test_env)
endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]