@@ -7,8 +7,7 @@ project('libxml++', 'cpp',
7
7
' cpp_std=c++17' ,
8
8
' warning_level=1' ,
9
9
],
10
- meson_version : ' >= 0.55.0' , # required for meson.add_dist_script(python3, ...)
11
- # and meson.add_install_script(python3, ...)
10
+ meson_version : ' >= 0.62.0' , # required for variables in pkgconfig.generate()
12
11
)
13
12
14
13
xmlxx_api_version = ' 4.0'
@@ -38,10 +37,9 @@ macos_darwin_versions = [
38
37
' @0@.@1@' .format(libtool_soversion[0 ] + 1 , libtool_soversion[1 ])
39
38
]
40
39
41
- # Use these instead of meson.source_root() and meson.build_root() in subdirectories.
42
- # source_root() and build_root() are not useful, if this is a subproject.
43
- project_source_root = meson .current_source_dir()
44
- project_build_root = meson .current_build_dir()
40
+ # Source and build root directories of the current (sub)project.
41
+ project_source_root = meson .project_source_root()
42
+ project_build_root = meson .project_build_root()
45
43
46
44
cpp_compiler = meson .get_compiler(' cpp' )
47
45
is_msvc = cpp_compiler.get_id() == ' msvc'
@@ -114,22 +112,12 @@ glibmm_req_minor_ver = '68'
114
112
115
113
xml2_min_ver = ' 2.7.7'
116
114
xml2_req = ' >= @0@' .format(xml2_min_ver)
117
-
118
- # Sadly, this is not Meson 0.60.x or later...
119
115
xml2_dep = dependency (
120
- ' libxml-2.0' ,
116
+ [ ' libxml-2.0' , ' LibXml2 ' ] ,
121
117
version : xml2_req,
122
118
required : host_machine .system() != ' windows'
123
119
)
124
120
125
- if not xml2_dep.found()
126
- xml2_dep = dependency (
127
- ' LibXml2' ,
128
- version : xml2_req,
129
- required : host_machine .system() != ' windows'
130
- )
131
- endif
132
-
133
121
# Setup CMake subproject for use, if needed
134
122
if not xml2_dep.found()
135
123
cmake = import (' cmake' )
@@ -192,24 +180,22 @@ endif
192
180
193
181
glibmm_dep = dependency (' glibmm-2.@0@' .format(glibmm_req_minor_ver), version : glibmm_req)
194
182
195
- xmlxx_requires = []
196
- libxml2_lib_pkgconfig = ''
183
+ xmlxx_pc_requires = []
184
+ libxml2_lib_pkgconfig = []
197
185
198
186
# Put libxml-2.0 in the 'Requires:' section in the generated pkg-config file if
199
187
# we found it by pkg-config
200
188
if xml2_dep.type_name() == ' pkgconfig'
201
- xmlxx_requires += [' libxml-2.0' , xml2_req]
189
+ xmlxx_pc_requires += [' libxml-2.0' + xml2_req]
202
190
else
203
- libxml2_lib_pkgconfig = xml2_dep.get_variable (
191
+ libxml2_lib_pkgconfig += [ xml2_dep.get_variable (
204
192
cmake : ' LIBXML2_LIBRARIES' ,
205
193
default_value : ' LibXml2.lib' ,
206
- )
194
+ )]
207
195
endif
208
196
209
197
# ...Then put glibmm-2.x in the 'Requires:' section in the generated pkg-config file
210
- xmlxx_requires += [' glibmm-2.@0@' .format(glibmm_req_minor_ver), glibmm_req]
211
-
212
- xmlxx_requires = ' ' .join(xmlxx_requires)
198
+ xmlxx_pc_requires += [' glibmm-2.@0@' .format(glibmm_req_minor_ver) + glibmm_req]
213
199
214
200
# Make sure we link to libxml-2.0 and glibmm
215
201
xmlxx_build_dep = [xml2_dep, glibmm_dep]
@@ -348,20 +334,8 @@ endif
348
334
349
335
# Configure files
350
336
pkg_conf_data = configuration_data ()
351
- pkg_conf_data.set(' prefix' , install_prefix)
352
- pkg_conf_data.set(' exec_prefix' , ' ${prefix}' )
353
- pkg_conf_data.set(' libdir' , ' ${exec_prefix}' / install_libdir)
354
- pkg_conf_data.set(' datarootdir' , ' ${prefix}' / install_datadir)
355
- pkg_conf_data.set(' datadir' , ' ${datarootdir}' )
356
- pkg_conf_data.set(' includedir' , ' ${prefix}' / install_includedir)
357
337
pkg_conf_data.set(' PACKAGE_NAME' , meson .project_name()) # MSVC_NMake/libxml++/libxml++.rc
358
- pkg_conf_data.set(' PACKAGE_TARNAME' , meson .project_name())
359
338
pkg_conf_data.set(' PACKAGE_VERSION' , meson .project_version())
360
- pkg_conf_data.set(' LIBXMLXX_MODULE_NAME' , xmlxx_pcname)
361
- pkg_conf_data.set(' LIBXMLXX_API_VERSION' , xmlxx_api_version)
362
- pkg_conf_data.set(' LIBXMLXX_MODULES' , xmlxx_requires)
363
- pkg_conf_data.set(' LIBXML2_LIB_NO_PKGCONFIG' , libxml2_lib_pkgconfig)
364
- pkg_conf_data.set(' MSVC_TOOLSET_VER' , msvc14x_toolset_ver)
365
339
366
340
if not build_deprecated_api
367
341
pkg_conf_data.set(' LIBXMLXX_DISABLE_DEPRECATED' , 1 )
@@ -384,13 +358,6 @@ if cpp_compiler.get_argument_syntax() == 'msvc'
384
358
endif
385
359
endif
386
360
387
- configure_file (
388
- input : ' libxml++.pc.in' ,
389
- output : xmlxx_pcname + ' .pc' ,
390
- configuration : pkg_conf_data,
391
- install_dir : install_pkgconfigdir,
392
- )
393
-
394
361
xmlxxconfig_h_meson = files (' libxml++config.h.meson' )
395
362
install_includeconfigdir = install_libdir / xmlxx_pcname / ' include'
396
363
configure_file (
@@ -400,30 +367,25 @@ configure_file(
400
367
install_dir : install_includeconfigdir,
401
368
)
402
369
403
- # add_dist_script() is not allowed in a subproject if meson.version() < 0.58.0.
404
- can_add_dist_script = not meson .is_subproject() or meson .version().version_compare(' >= 0.58.0' )
405
-
406
370
subdir (' MSVC_NMake/libxml++' )
407
371
subdir (' libxml++' )
408
372
subdir (' examples' )
409
373
subdir (' tests' )
410
374
subdir (' docs/reference' )
411
375
subdir (' docs/manual' )
412
376
413
- if can_add_dist_script
414
- # Add a ChangeLog file to the distribution directory.
415
- meson .add_dist_script(
416
- python3, dist_changelog_py,
417
- project_source_root,
418
- )
419
- # Add build scripts to the distribution directory, and delete .gitignore
420
- # files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
421
- meson .add_dist_script(
422
- python3, dist_build_scripts_py,
423
- project_source_root,
424
- ' untracked' / ' build_scripts' ,
425
- )
426
- endif
377
+ # Add a ChangeLog file to the distribution directory.
378
+ meson .add_dist_script(
379
+ python3, dist_changelog_py,
380
+ project_source_root,
381
+ )
382
+ # Add build scripts to the distribution directory, and delete .gitignore
383
+ # files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
384
+ meson .add_dist_script(
385
+ python3, dist_build_scripts_py,
386
+ project_source_root,
387
+ ' untracked' / ' build_scripts' ,
388
+ )
427
389
428
390
if meson .is_subproject()
429
391
pkgconfig_vars = {
0 commit comments