-
Notifications
You must be signed in to change notification settings - Fork 6
/
meson.build
193 lines (159 loc) · 5.82 KB
/
meson.build
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
project('dballe', 'cpp', 'fortran', version: '9.7', license : 'GPL-2.0-or-later', default_options: ['warning_level=3', 'cpp_std=c++17'])
# TODO: use warning_level=everything in meson from 1.0
cpp = meson.get_compiler('cpp')
warning_control = [
# Turn some warning classes to errors
'-Werror=format',
'-Werror=suggest-override',
'-Werror=deprecated-copy-dtor',
'-Werror=missing-declarations',
'-Werror=overloaded-virtual',
'-Werror=cast-qual',
'-Werror=duplicated-branches',
'-Werror=logical-op',
'-Werror=catch-value',
'-Werror=conditionally-supported',
'-Werror=c++23-extensions',
'-Werror=dangling-else',
'-Werror=suggest-attribute=format',
'-Werror=deprecated-declarations',
# '-Werror=noexcept',
# '-Werror=cast-align',
'-Wno-padded',
'-Wno-abi-tag',
'-Wswitch',
'-Wno-switch-enum',
'-Wno-effc++',
# TODO: remove the following ones over time
'-Wno-shadow',
'-Wno-zero-as-null-pointer-constant',
'-Wno-mismatched-tags',
'-Wno-unused-const-variable',
'-Wno-redundant-tags',
'-Wno-useless-cast',
'-Wno-switch-default',
'-Wno-old-style-cast',
'-Wno-unused-parameter',
# These ones can be activated from time to time
'-Wno-float-equal',
'-Wno-suggest-attribute=noreturn',
'-Wno-format-truncation',
'-Wno-arith-conversion',
'-Wno-conversion',
]
add_project_arguments(
cpp.get_supported_arguments(warning_control),
language : 'cpp')
libdballe_so_version = '9.7.0'
libdballef_so_version = '5.0.0'
table_dir = get_option('datadir') / 'wreport'
conf_data = configuration_data()
conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
conf_data.set_quoted('TABLE_DIR', get_option('prefix') / table_dir)
toplevel_inc = include_directories('.')
# Dependencies
libwreport_dep = dependency('libwreport', version: '>= 3.38')
sqlite3_dep = dependency('sqlite3')
libpq_dep = dependency('libpq', required: false)
conf_data.set('HAVE_LIBPQ', libpq_dep.found())
mariadb_dep = dependency('mariadb', required: false)
conf_data.set('HAVE_MYSQL', mariadb_dep.found())
xapian_dep = dependency('xapian-core', version: '>= 1.4', required: false)
conf_data.set('HAVE_XAPIAN', xapian_dep.found())
popt_dep = dependency('popt')
gperf = find_program('gperf')
pymod = import('python')
python3 = pymod.find_installation('python3', required: false)
#if test x$enable_dballe_python = xyes
#then
# PYTHON_CFLAGS=`unset CFLAGS; $PYTHON-config --cflags`
# AC_SUBST(PYTHON_CFLAGS)
# AX_PYTHON_MODULE_VERSION(wreport, 3.22)
# AX_PYTHON_MODULE(numpy, yes)
#fi
if python3.found()
# FIXME: python3.path() is only available from meson 0.50: this is a workaround
python3_path = python3.get_variable('BINDIR') / python3.get_variable('PYTHON') + python3.language_version()
sphinx = find_program('sphinx-build', 'sphinx-build-3', 'sphinx-build-' + python3.language_version(), required: false)
# TODO: check if breathe is installed
# TODO AX_PYTHON_MODULE(breathe)
# See https://gitlab.freedesktop.org/wayland/weston/-/blob/master/doc/sphinx/meson.build
doxygen = find_program('doxygen', required : false)
build_docs = sphinx.found() and doxygen.found()
docdir = get_option('datadir') / 'doc' / meson.project_name()
else
warning('Documentation disabled, requires doxygen, sphinx, and the breathe python module')
build_docs = false
endif
compiler = meson.get_compiler('cpp')
if not compiler.has_function('bswap_32', prefix : '#include <byteswap.h>')
conf_data.set('USE_OWN_BSWAP', true)
endif
if not compiler.has_function('vasprintf', prefix : '#include <cstdio>')
conf_data.set('USE_OWN_VASPRINTF', true)
endif
# Generate config.h
configure_file(output: 'config.h', configuration: conf_data)
# Generate the builddir's version of run-local
run_local_cfg = configure_file(output: 'run-local', input: 'run-local.in', configuration: {
'top_srcdir': meson.source_root(),
'top_builddir': meson.build_root(),
})
# Just using the configure_file object in a custom_target command gives:
# 'AttributeError: 'File' object has no attribute 'replace'
# Using find_program on the resulting file works around that
# See https://github.com/mesonbuild/meson/issues/8039
run_local = find_program(run_local_cfg)
subdir('dballe')
subdir('fortran')
subdir('src')
if python3.found()
subdir('python')
endif
if build_docs
subdir('doc')
endif
subdir('tables')
# Generate pkg-config metadata
pkg = import('pkgconfig')
pkg.generate(libdballe,
description: 'Database for point-based meteorological data (C++ library)',
filebase: 'libdballe',
requires: [libwreport_dep],
)
pkg.generate(libdballef,
description: 'Database for point-based meteorological data (Fortran library)',
filebase: 'libdballef',
requires: [libwreport_dep],
)
# Install old m4 macro files
m4_dir = get_option('datadir') / 'aclocal'
install_data('libdballe.m4', 'libdballef.m4', install_dir: m4_dir)
# AC_MSG_CHECKING([for wreport documentation dir $WREPORT_DOXYGEN_DIR])
# AC_MSG_RESULT([$wreport_doxygen_dir_result])
# AC_MSG_CHECKING([for wreport doxytag file $WREPORT_DOXYGEN_TAGFILE])
# AC_MSG_RESULT([$wreport_doxygen_tagfile_result])
# if test x$wreport_doxygen_dir_result = xno
# then
# AC_MSG_WARN([WREPORT_DOXYGEN_DIR not found, documentation will not be built.])
# enable_docs=no
# fi
# if test x$wreport_doxygen_tagfile_result = xno
# then
# AC_MSG_WARN([WREPORT_DOXYGEN_TAGFILE not found, documentation will not be built.])
# enable_docs=no
# fi
#
# AX_PYTHON_MODULE(breathe)
# if test x$HAVE_PYMOD_BREATHE != xyes
# then
# enable_docs=no
# fi
#AC_PROG_FC([gfortran pgf90 ifort g95 xlf90 f90])
#
#dnl Enable extra compiler warnings
#AX_CHECK_COMPILE_FLAG([-Wredundant-move], [has_redundant_move=yes], [has_redundant_move=no])
#if test $has_redundant_move = yes
#then
# AX_APPEND_FLAG([-Wno-error=redundant-move])
#fi