-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeson.build
195 lines (168 loc) · 5.31 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
194
195
project(
'bedit', 'c',
version: '0.1.0',
meson_version: '>= 0.49'
)
# Compiler flags and warnings
cc = meson.get_compiler('c')
global_c_args = []
if cc.get_id() == 'msvc'
test_c_args = [
'/FImsvc_recommended_pragmas.h',
]
else
test_c_args = [
'-Wcast-align',
'-Werror=declaration-after-statement',
'-Werror=address',
'-Werror=array-bounds',
'-Werror=empty-body',
'-Werror=implicit',
'-Werror=implicit-function-declaration',
'-Werror=incompatible-pointer-types',
'-Werror=init-self',
'-Werror=int-conversion',
'-Werror=int-to-pointer-cast',
'-Werror=main',
'-Werror=misleading-indentation',
'-Werror=missing-braces',
'-Werror=missing-include-dirs',
'-Werror=nonnull',
'-Werror=overflow',
'-Werror=parenthesis',
'-Werror=pointer-arith',
'-Werror=pointer-to-int-cast',
'-Werror=return-type',
'-Werror=sequence-point',
'-Werror=shadow',
'-Werror=strict-prototypes',
'-Werror=trigraphs',
'-Werror=undef',
'-Werror=write-strings',
'-Wformat-nonliteral',
'-Werror=format-security',
'-Werror=format=2',
'-Wignored-qualifiers',
'-Wimplicit-function-declaration',
'-Wlogical-op',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wnested-externs',
'-Wcast-function-type',
'-Wno-missing-field-initializers',
'-Wno-sign-compare',
'-Wno-unused-parameter',
'-Werror=old-style-definition',
'-Wpointer-arith',
'-Wstrict-prototypes',
'-Wno-switch-default',
'-Wno-switch-enum',
'-Wundef',
'-Werror=uninitialized',
'-Wunused',
'-Wmissing-declarations',
'-Wdiscarded-qualifiers',
'-Wno-overlength-strings',
'-Wall', '-Wextra',
'-fno-strict-aliasing',
]
if get_option('buildtype') != 'plain'
test_c_args += '-fstack-protector-strong'
endif
endif
foreach arg: test_c_args
if cc.has_multi_arguments(arg)
global_c_args += arg
endif
endforeach
add_project_arguments(global_c_args, language: 'c')
gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')
python = import('python')
api_version = '0.1'
package_string = '@0@-@1@'.format(meson.project_name(), api_version)
# Paths
root_include_dir = include_directories('.')
srcdir = meson.current_source_dir()
bindir = join_paths(get_option('prefix'), get_option('bindir'))
libdir = join_paths(get_option('prefix'), get_option('libdir'))
libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
datadir = join_paths(get_option('prefix'), get_option('datadir'))
pkgconfigdir = join_paths(libdir, 'pkgconfig')
pkglibdir = join_paths(libdir, meson.project_name())
pkgdatadir = join_paths(datadir, meson.project_name())
glibdir = join_paths(datadir, 'glib-2.0')
gtkdocdir = join_paths(datadir, 'gtk-doc')
vapidir = join_paths(datadir, 'vala', 'vapi')
# Subprojects
if not get_option('buildtype').contains('plain')
run_command('git', '-C', meson.source_root(), 'submodule', 'update', '--init', '--recursive')
endif
# Dependencies
glib_req = '>= 2.52'
libpeas_req = '>= 1.14.1'
m_dep = cc.find_library('m', required: false)
glib_dep = dependency('glib-2.0', version: glib_req)
gobject_dep = dependency('gobject-2.0', version: glib_req)
gmodule_dep = dependency('gmodule-2.0', version: glib_req)
gio_dep = dependency('gio-2.0', version: glib_req)
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22')
gtksourceview_dep = dependency('gtksourceview-4', version: '>= 4.0.2')
libpeas_dep = dependency('libpeas-1.0', version: libpeas_req)
libpeas_gtk_dep = dependency('libpeas-gtk-1.0', version: libpeas_req)
gspell_dep = dependency('gspell-1', version: '>= 1.0', required: true)
introspection_dep = dependency('gobject-introspection-1.0')
vapigen_dep = dependency('vapigen', version: '>= 0.25.1')
python3 = python.find_installation('python3')
# Configurations
config_h = configuration_data()
config_h.set_quoted('PACKAGE_STRING', package_string)
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_h.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
config_h.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
config_h.set_quoted('VERSION', meson.project_version())
version_array = meson.project_version().split('.')
config_h.set('BEDIT_MAJOR_VERSION', version_array[0])
config_h.set('BEDIT_MINOR_VERSION', version_array[1])
config_h.set('BEDIT_MICRO_VERSION', version_array[2])
configure_file(
output: 'config.h',
configuration: config_h
)
# Options
active_plugins = [
'docinfo',
'modelines',
'filebrowser',
'spell',
'time',
]
subdir('data')
subdir('po')
subdir('bedit')
subdir('plugins')
if get_option('gtk_doc')
subdir('docs/reference')
endif
if get_option('user_documentation')
subdir('help')
endif
meson.add_install_script(
'build-aux/meson/post_install.py',
join_paths(get_option('prefix'), get_option('libdir')),
join_paths(get_option('prefix'), get_option('datadir'))
)
# Summary message
summary = [
'Configuration:',
'',
' bedit version @0@ (API version @1@)'.format(meson.project_version(), api_version),
'',
' Prefix: @0@'.format(get_option('prefix')),
' API documentation: @0@'.format(get_option('gtk_doc')),
' User documentation: @0@'.format(get_option('user_documentation')),
'',
]
message('\n'.join(summary))