1
- project (' libmypaint' ,
1
+ project (
2
+ ' libmypaint' ,
2
3
' c' ,
3
4
# API version: see https://github.com/mypaint/libmypaint/wiki/Versioning
4
5
# See http://semver.org/ for what this means.
5
6
version : ' 2.0.0-beta' ,
6
- meson_version : ' >=0.49 .0' ,
7
+ meson_version : ' >=0.60 .0' ,
7
8
default_options : [
8
- ' c_std=c99'
9
+ ' c_std=c99' ,
9
10
],
10
11
)
11
12
@@ -20,10 +21,10 @@ pkgconfig = import('pkgconfig')
20
21
21
22
version_full = meson .project_version()
22
23
version_dash_split = version_full.split(' -' )
23
- version = version_dash_split[0 ]
24
+ version_stable = version_dash_split[0 ]
24
25
version_prerelease = version_dash_split.get(1 , '' ) # may be blank
25
26
26
- version_array = version .split(' .' )
27
+ version_array = version_stable .split(' .' )
27
28
version_major = version_array[0 ]
28
29
version_minor = version_array[1 ]
29
30
version_micro = version_array[2 ]
@@ -43,24 +44,26 @@ project_url = 'https://github.com/mypaint/libmypaint'
43
44
conf.set(' PACKAGE_NAME' , meson .project_name())
44
45
conf.set(' PACKAGE_URL' , project_url)
45
46
conf.set(' LIBMYPAINT_API_PLATFORM_VERSION' , api_platform_version)
46
- conf.set(' LIBMYPAINT_VERSION' , version )
47
+ conf.set(' LIBMYPAINT_VERSION' , version_stable )
47
48
conf.set(' LIBMYPAINT_VERSION_FULL' , version_full)
48
49
49
50
gettext_package = api_name
50
- conf.set_quoted(' GETTEXT_PACKAGE' , gettext_package,
51
- description : ' The prefix for our gettext translation domains.'
51
+ conf.set_quoted(
52
+ ' GETTEXT_PACKAGE' ,
53
+ gettext_package,
54
+ description : ' The prefix for our gettext translation domains.' ,
52
55
)
53
56
54
57
###############################################################################
55
- # Libtool versionning
58
+ # Libtool versioning
56
59
57
60
# ABI version see: https://autotools.io/libtool/version.html
58
61
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
59
- abi_revision = 0 # increment on every release
60
- abi_current = 0 # inc when add/remove/change interfaces
61
- abi_age = 0 # inc only if changes backward compat
62
+ abi_revision = 0 # increment on every release
63
+ abi_current = 0 # inc when add/remove/change interfaces
64
+ abi_age = 0 # inc only if changes backward compat
62
65
# FIXME: Not correct.
63
- abi_version_info = ' @0 @.@1 @.@2@ ' .format(abi_current, abi_revision, abi_age)
66
+ abi_version_info = f ' @abi_current @.@abi_revision @.@abi_age@ '
64
67
65
68
###############################################################################
66
69
# System detection, compiler options
@@ -79,44 +82,25 @@ libmath = cc.find_library('m', required: false)
79
82
json = dependency (' json-c' )
80
83
81
84
# glib
82
- use_glib = get_option (' glib' ) or get_option (' introspection' )
83
- if use_glib
84
- glib = dependency (' gobject-2.0' )
85
- endif
85
+ glib = dependency (' gobject-2.0' , required : get_option (' glib' ))
86
+ use_glib = glib.found()
86
87
conf.set10(' MYPAINT_CONFIG_USE_GLIB' , use_glib)
87
88
88
89
# GEGL
89
- if get_option (' gegl' )
90
- gegl = dependency (' gegl-0.4' , version : ' >=0.4' , required : false )
91
- gegl_gir = ' Gegl-0.4'
92
- if not gegl.found()
93
- gegl = dependency (' gegl-0.3' , version : ' >=0.3' )
94
- gegl_gir = ' Gegl-0.3'
95
- endif
96
- else
97
- gegl = dependency ('' , required : false )
90
+ gegl = dependency (' gegl-0.4' , ' gegl-0.3' , required : get_option (' gegl' ))
91
+ use_gegl = gegl.found()
92
+ if use_gegl
93
+ gegl_gir = gegl.version().version_compare(' >=0.4' ) ? ' Gegl-0.4' : ' Gegl-0.3'
98
94
endif
99
95
100
96
introspection_required_version = ' 1.32.0'
101
97
102
98
103
99
# OpenMP
104
- if get_option (' openmp' )
105
- # OpenMP requires meson >= 0.46.
106
- if meson .version().version_compare(' <0.46.0' )
107
- error (' Meson 0.46.0 is required for OpenMP support.' )
108
- endif
109
- openmp = dependency (' openmp' )
110
- else
111
- openmp = declare_dependency ()
112
- endif
100
+ openmp = dependency (' openmp' , required : get_option (' openmp' ))
113
101
114
102
## gperftools ##
115
- if get_option (' gperftools' )
116
- libprofiler = dependency (' libprofiler' )
117
- else
118
- libprofiler = declare_dependency ()
119
- endif
103
+ libprofiler = dependency (' libprofiler' , required : get_option (' gperftools' ))
120
104
121
105
# Profiling
122
106
if get_option (' profiling' )
@@ -143,8 +127,12 @@ conf.set10('HAVE_GETTEXT', have_i18n)
143
127
enable_docs = get_option (' docs' )
144
128
if enable_docs
145
129
doxygen = find_program (' doxygen' )
146
- sphinx_build = find_program (' sphinx-build3' , ' sphinx-build-3' ,
147
- ' sphinx-build2' , ' sphinx-build-2' , ' sphinx-build'
130
+ sphinx_build = find_program (
131
+ ' sphinx-build3' ,
132
+ ' sphinx-build-3' ,
133
+ ' sphinx-build2' ,
134
+ ' sphinx-build-2' ,
135
+ ' sphinx-build' ,
148
136
)
149
137
# todo: the python 'breathe' extension is also a dependency to doc building.
150
138
# the configure script should check for its existence.
@@ -158,24 +146,25 @@ toplevel_inc = include_directories('.')
158
146
159
147
configure_file (
160
148
output : ' config.h' ,
161
- configuration : conf
149
+ configuration : conf,
162
150
)
163
151
164
152
# TODO change generate.py
165
153
166
- configure_file (
167
- input : ' brushsettings.json' ,
168
- output : ' brushsettings.json' ,
169
- copy : true ,
170
- )
171
- brush_settings_headers = custom_target (' brush_settings_headers' ,
154
+ brush_settings_headers = custom_target (
155
+ ' brush_settings_headers' ,
172
156
input : ' brushsettings.json' ,
173
- output : [ ' mypaint-brush-settings-gen.h' , ' brushsettings-gen.h' ],
157
+ output : [
158
+ ' mypaint-brush-settings-gen.h' ,
159
+ ' brushsettings-gen.h' ,
160
+ ],
174
161
command : [
175
- find_program (' generate.py' ), ' @OUTPUT@'
162
+ find_program (' python3' ),
163
+ meson .current_source_dir() / ' generate.py' ,
164
+ ' @OUTPUT@' ,
176
165
],
177
166
install : true ,
178
- install_dir : [ get_option (' includedir' ) / api_name, false ],
167
+ install_dir : [get_option (' includedir' ) / api_name, false ],
179
168
)
180
169
181
170
@@ -217,13 +206,15 @@ libmypaint_public_headers = [
217
206
libmypaint_introspectable_headers,
218
207
]
219
208
220
- install_headers (libmypaint_public_headers,
209
+ install_headers (
210
+ libmypaint_public_headers,
221
211
subdir : api_name,
222
212
)
223
213
224
214
# Install in subdirectory
225
215
if use_glib
226
- install_headers (' glib/mypaint-brush.h' ,
216
+ install_headers (
217
+ ' glib/mypaint-brush.h' ,
227
218
subdir : api_name / ' glib' ,
228
219
)
229
220
libmypaint_introspectable_headers += ' glib/mypaint-brush.h'
@@ -234,8 +225,10 @@ endif
234
225
libmypaint_introspectable_headers += brush_settings_headers[0 ]
235
226
236
227
237
- libmypaint = library (' mypaint-@0@' .format(api_platform_version),
238
- libmypaint_sources, brush_settings_headers,
228
+ libmypaint = library (
229
+ ' mypaint-@0@' .format(api_platform_version),
230
+ libmypaint_sources,
231
+ brush_settings_headers,
239
232
dependencies : [
240
233
glib,
241
234
json,
@@ -249,9 +242,13 @@ libmypaint = library('mypaint-@0@'.format(api_platform_version),
249
242
250
243
251
244
if get_option (' introspection' )
245
+ if not use_glib
246
+ error (' Generating GObject introspection requires building with GLib support' )
247
+ endif
252
248
gnome = import (' gnome' )
253
249
254
- libmypaint_gir = gnome.generate_gir(libmypaint,
250
+ libmypaint_gir = gnome.generate_gir(
251
+ libmypaint,
255
252
nsversion : api_platform_version,
256
253
namespace : ' MyPaint' ,
257
254
@@ -268,7 +265,8 @@ if get_option('introspection')
268
265
endif
269
266
270
267
271
- pkgconfig.generate(libmypaint,
268
+ pkgconfig.generate(
269
+ libmypaint,
272
270
name : meson .project_name() + ' -' + api_platform_version,
273
271
version : version_full,
274
272
description : ' MyPaint\' s brushstroke rendering library' ,
@@ -277,7 +275,7 @@ pkgconfig.generate(libmypaint,
277
275
)
278
276
279
277
280
- if gegl.found()
278
+ if use_gegl
281
279
subdir (' gegl' )
282
280
endif
283
281
0 commit comments