1- project (' libmypaint' ,
1+ project (
2+ ' libmypaint' ,
23 ' c' ,
34 # API version: see https://github.com/mypaint/libmypaint/wiki/Versioning
45 # See http://semver.org/ for what this means.
56 version : ' 2.0.0-beta' ,
6- meson_version : ' >=0.49 .0' ,
7+ meson_version : ' >=0.60 .0' ,
78 default_options : [
8- ' c_std=c99'
9+ ' c_std=c99' ,
910 ],
1011)
1112
@@ -20,10 +21,10 @@ pkgconfig = import('pkgconfig')
2021
2122version_full = meson .project_version()
2223version_dash_split = version_full.split(' -' )
23- version = version_dash_split[0 ]
24+ version_stable = version_dash_split[0 ]
2425version_prerelease = version_dash_split.get(1 , '' ) # may be blank
2526
26- version_array = version .split(' .' )
27+ version_array = version_stable .split(' .' )
2728version_major = version_array[0 ]
2829version_minor = version_array[1 ]
2930version_micro = version_array[2 ]
@@ -43,24 +44,26 @@ project_url = 'https://github.com/mypaint/libmypaint'
4344conf.set(' PACKAGE_NAME' , meson .project_name())
4445conf.set(' PACKAGE_URL' , project_url)
4546conf.set(' LIBMYPAINT_API_PLATFORM_VERSION' , api_platform_version)
46- conf.set(' LIBMYPAINT_VERSION' , version )
47+ conf.set(' LIBMYPAINT_VERSION' , version_stable )
4748conf.set(' LIBMYPAINT_VERSION_FULL' , version_full)
4849
4950gettext_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.' ,
5255)
5356
5457###############################################################################
55- # Libtool versionning
58+ # Libtool versioning
5659
5760# ABI version see: https://autotools.io/libtool/version.html
5861# 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
6265# 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@ '
6467
6568###############################################################################
6669# System detection, compiler options
@@ -79,44 +82,25 @@ libmath = cc.find_library('m', required: false)
7982json = dependency (' json-c' )
8083
8184# glib
82- use_glib = get_option (' glib' ) or get_option (' introspection' )
83- if use_glib
84- glib = dependency (' gobject-2.0' )
85- endif
85+ gobject = dependency (' gobject-2.0' , required : get_option (' glib' ))
86+ use_glib = gobject.found()
8687conf.set10(' MYPAINT_CONFIG_USE_GLIB' , use_glib)
8788
8889# 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'
9894endif
9995
10096introspection_required_version = ' 1.32.0'
10197
10298
10399# 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' ))
113101
114102## 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' ))
120104
121105# Profiling
122106if get_option (' profiling' )
@@ -143,8 +127,12 @@ conf.set10('HAVE_GETTEXT', have_i18n)
143127enable_docs = get_option (' docs' )
144128if enable_docs
145129 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' ,
148136 )
149137 # todo: the python 'breathe' extension is also a dependency to doc building.
150138 # the configure script should check for its existence.
@@ -158,24 +146,25 @@ toplevel_inc = include_directories('.')
158146
159147configure_file (
160148 output : ' config.h' ,
161- configuration : conf
149+ configuration : conf,
162150)
163151
164152# TODO change generate.py
165153
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' ,
172156 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+ ],
174161 command : [
175- find_program (' generate.py' ), ' @OUTPUT@'
162+ find_program (' python3' ),
163+ meson .current_source_dir() / ' generate.py' ,
164+ ' @OUTPUT@' ,
176165 ],
177166 install : true ,
178- install_dir : [ get_option (' includedir' ) / api_name, false ],
167+ install_dir : [get_option (' includedir' ) / api_name, false ],
179168)
180169
181170
@@ -217,13 +206,15 @@ libmypaint_public_headers = [
217206 libmypaint_introspectable_headers,
218207]
219208
220- install_headers (libmypaint_public_headers,
209+ install_headers (
210+ libmypaint_public_headers,
221211 subdir : api_name,
222212)
223213
224214# Install in subdirectory
225215if use_glib
226- install_headers (' glib/mypaint-brush.h' ,
216+ install_headers (
217+ ' glib/mypaint-brush.h' ,
227218 subdir : api_name / ' glib' ,
228219 )
229220 libmypaint_introspectable_headers += ' glib/mypaint-brush.h'
@@ -234,10 +225,12 @@ endif
234225libmypaint_introspectable_headers += brush_settings_headers[0 ]
235226
236227
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,
239232 dependencies : [
240- glib ,
233+ gobject ,
241234 json,
242235 libintl,
243236 libmath,
@@ -249,9 +242,13 @@ libmypaint = library('mypaint-@0@'.format(api_platform_version),
249242
250243
251244if get_option (' introspection' )
245+ if not use_glib
246+ error (' Generating GObject introspection requires building with GLib support' )
247+ endif
252248 gnome = import (' gnome' )
253249
254- libmypaint_gir = gnome.generate_gir(libmypaint,
250+ libmypaint_gir = gnome.generate_gir(
251+ libmypaint,
255252 nsversion : api_platform_version,
256253 namespace : ' MyPaint' ,
257254
@@ -268,7 +265,8 @@ if get_option('introspection')
268265endif
269266
270267
271- pkgconfig.generate(libmypaint,
268+ pkgconfig.generate(
269+ libmypaint,
272270 name : meson .project_name() + ' -' + api_platform_version,
273271 version : version_full,
274272 description : ' MyPaint\' s brushstroke rendering library' ,
@@ -277,7 +275,7 @@ pkgconfig.generate(libmypaint,
277275)
278276
279277
280- if gegl.found()
278+ if use_gegl
281279 subdir (' gegl' )
282280endif
283281
0 commit comments