1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
# Convention:
# - Local variables in lower_case.
# - Global variables in UPPER_CASE.
# See: https://github.com/mesonbuild/meson/issues/2607
project(
'libgedit-gtksourceview', 'c',
meson_version: '>= 0.64',
version: '299.5.0', # Do not forget to update the SOVERSION if needed.
default_options: ['warning_level=2']
)
SOVERSION = 3
GNOME = import('gnome')
PKG_CONFIG = import('pkgconfig')
I18N = import('i18n')
FS = import('fs')
# API version, used for parallel installability.
LIBGEDIT_GTKSOURCEVIEW_API_VERSION = '300'
LIBGEDIT_GTKSOURCEVIEW_PUBLIC_DEPS = [
dependency('gio-2.0', version: '>= 2.74'),
dependency('gtk+-3.0', version: '>= 3.20'),
]
libgedit_gtksourceview_private_deps = [
dependency('libxml-2.0'),
]
LIBGEDIT_GTKSOURCEVIEW_ALL_DEPS = [
LIBGEDIT_GTKSOURCEVIEW_PUBLIC_DEPS,
libgedit_gtksourceview_private_deps,
]
# config.h
config_data = configuration_data()
GETTEXT_PACKAGE_NAME = 'libgedit-gtksourceview-' + LIBGEDIT_GTKSOURCEVIEW_API_VERSION
config_data.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE_NAME)
config_data.set_quoted('DATADIR', get_option('prefix') / get_option('datadir'))
config_data.set_quoted('GSV_API_VERSION', LIBGEDIT_GTKSOURCEVIEW_API_VERSION)
c_compiler = meson.get_compiler('c')
if c_compiler.has_header('unistd.h')
config_data.set('HAVE_UNISTD_H', true)
endif
# TODO: for macOS support.
# the only missing thing for the config.h.
#if false
# config_data.set('OS_OSX', true)
#endif
configure_file(
output: 'config.h',
configuration: config_data
)
# Misc
ROOT_INCLUDE_DIR = include_directories('.')
add_project_arguments(
'-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()),
language: 'c'
)
#####
# CFLAGS
# Some flags are missing when using only the builtin warning_level meson option,
# even at the maximum level.
# The following warning_cflags suppose that warning_level=2.
c_compiler = meson.get_compiler('c')
warning_cflags = []
if c_compiler.get_id() == 'msvc'
# Use GLib's msvc_recommended_pragmas.h to filter out
# the warnings we don't really need to worry about,
# but do make the ones we want to be wary stand out
warning_cflags += [
'-FImsvc_recommended_pragmas.h',
]
else
# Try to mimic the AX_COMPILER_FLAGS Autotools macro.
warning_cflags += [
'-fno-strict-aliasing',
'-Wundef',
'-Wnested-externs',
'-Wwrite-strings',
'-Wpointer-arith',
'-Wmissing-declarations',
'-Wmissing-prototypes',
'-Wstrict-prototypes',
'-Wredundant-decls',
'-Wno-unused-parameter',
'-Wno-missing-field-initializers',
'-Wdeclaration-after-statement',
'-Wformat=2',
'-Wold-style-definition',
'-Wcast-align',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wsign-compare',
'-Wstrict-aliasing',
'-Wshadow',
'-Winline',
'-Wpacked',
'-Wmissing-format-attribute',
'-Wmissing-noreturn',
'-Winit-self',
'-Wredundant-decls',
'-Wmissing-include-dirs',
'-Wunused-but-set-variable',
'-Warray-bounds',
'-Wimplicit-function-declaration',
'-Wreturn-type',
'-Wswitch-enum',
'-Wswitch-default',
'-Wduplicated-cond',
'-Wduplicated-branches',
'-Wlogical-op',
'-Wrestrict',
'-Wnull-dereference',
'-Wjump-misses-init',
'-Wdouble-promotion',
# Deprecated symbols are currently in use, but it's not urgent to port the
# code, so silence the warnings.
'-Wno-deprecated-declarations',
]
endif
supported_warning_cflags = c_compiler.get_supported_arguments(warning_cflags)
add_project_arguments(supported_warning_cflags, language: 'c')
##### end CFLAGS
subdir('data')
subdir('po')
subdir('gtksourceview')
if get_option('tests')
subdir('tests')
endif
subdir('tools/list-langs')
if get_option('gtk_doc')
subdir('docs/reference')
endif
summary('API version', LIBGEDIT_GTKSOURCEVIEW_API_VERSION)
summary('Prefix', get_option('prefix'))
summary('GObject Introspection', get_option('gobject_introspection'))
summary('API documentation', get_option('gtk_doc'))
summary('Build tests', get_option('tests'))
|