Skip to content

Commit 9ccd518

Browse files
committed
Meson build: Add install_tag keyword argument
Require meson >= 0.60. Remove the can_add_dist_script variable. It's unnecessary when the meson version >= 0.58. Simplify the calls to dependency().get_variable().
1 parent aad4eed commit 9ccd518

File tree

5 files changed

+51
-53
lines changed

5 files changed

+51
-53
lines changed

docs/manual/meson.build

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# docs/manual
22

33
# input: install_datadir, xmlxx_pcname, tutorial_custom_cmd_py, python3,
4-
# build_documentation, book_name, can_add_dist_script, xsltproc
4+
# build_documentation, book_name, xsltproc
55
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
66
# install_tutorialdir, build_manual_opt, build_manual
77

@@ -72,7 +72,8 @@ custom_target('manual_html',
7272
],
7373
build_by_default: true,
7474
install: true,
75-
install_dir: install_tutorialdir
75+
install_dir: install_tutorialdir,
76+
install_tag: 'doc',
7677
)
7778

7879
if can_parse_and_validate
@@ -106,13 +107,11 @@ if can_build_pdf
106107
)
107108
endif
108109

109-
if can_add_dist_script
110-
# Distribute built files.
111-
meson.add_dist_script(
112-
python3, tutorial_custom_cmd_py, 'dist_doc',
113-
doc_dist_dir,
114-
meson.current_build_dir(),
115-
meson.current_build_dir() / 'libxml++.xml',
116-
meson.current_build_dir() / 'libxml++.pdf',
117-
)
118-
endif
110+
# Distribute built files.
111+
meson.add_dist_script(
112+
python3, tutorial_custom_cmd_py, 'dist_doc',
113+
doc_dist_dir,
114+
meson.current_build_dir(),
115+
meson.current_build_dir() / 'libxml++.xml',
116+
meson.current_build_dir() / 'libxml++.pdf',
117+
)

docs/reference/meson.build

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Input: project_build_root, project_source_root, xmlxx_pcname,
44
# xmlxx_api_version, build_documentation, source_h_files,
5-
# install_datadir, python3, doc_reference_py, can_add_dist_script, dot
5+
# install_datadir, python3, doc_reference_py, dot
66
# Output: install_docdir, install_devhelpdir, book_name,
77
# if build_documentation: tag_file
88

@@ -19,7 +19,7 @@ docinstall_flags = []
1919
foreach module : tag_file_modules
2020
depmod = dependency(module, required: false)
2121
if depmod.found()
22-
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile', default_value: '')
22+
doxytagfile = depmod.get_variable('doxytagfile', default_value: '')
2323
if doxytagfile != ''
2424
if depmod.type_name() == 'internal'
2525
# Subprojects must build their tag files before doxygen is called.
@@ -29,8 +29,8 @@ foreach module : tag_file_modules
2929
doxygen_tag_targets += subproject(module).get_variable('global_tag_file_target')
3030
endif
3131
endif
32-
htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '')
33-
htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '')
32+
htmlrefpub = depmod.get_variable('htmlrefpub', default_value: '')
33+
htmlrefdir = depmod.get_variable('htmlrefdir', default_value: '')
3434
if htmlrefpub == ''
3535
htmlrefpub = htmlrefdir
3636
elif htmlrefdir == ''
@@ -104,6 +104,7 @@ tag_file = custom_target('html_and_tag',
104104
build_by_default: build_documentation,
105105
install: true,
106106
install_dir: install_reference_docdir,
107+
install_tag: 'doc',
107108
)
108109

109110
devhelp_file = custom_target('devhelp',
@@ -127,17 +128,16 @@ meson.add_install_script(
127128
devhelp_file.full_path(),
128129
install_devhelpdir,
129130
install_reference_docdir / 'html',
130-
docinstall_flags
131+
docinstall_flags,
132+
install_tag: 'doc',
131133
)
132134

133-
if can_add_dist_script
134-
# Distribute built files and files copied by mm-common-get.
135-
meson.add_dist_script(
136-
python3, doc_reference_py, 'dist_doc',
137-
doctool_dir,
138-
doctool_dist_dir,
139-
meson.current_build_dir(),
140-
tag_file.full_path(),
141-
devhelp_file.full_path(),
142-
)
143-
endif
135+
# Distribute built files and files copied by mm-common-get.
136+
meson.add_dist_script(
137+
python3, doc_reference_py, 'dist_doc',
138+
doctool_dir,
139+
doctool_dist_dir,
140+
meson.current_build_dir(),
141+
tag_file.full_path(),
142+
devhelp_file.full_path(),
143+
)

examples/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ foreach ex : example_programs
3939
exe_file = executable(ex_name, ex_sources,
4040
dependencies: xmlxx_own_dep,
4141
implicit_include_directories: false,
42-
build_by_default: build_examples
42+
build_by_default: build_examples,
43+
install: false,
4344
)
4445

4546
if build_examples

meson.build

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ project('libxml++', 'cpp',
77
'cpp_std=c++11',
88
'warning_level=1',
99
],
10-
meson_version: '>= 0.55.0', # required for meson.add_dist_script(python3, ...)
11-
# and meson.add_install_script(python3, ...)
10+
meson_version: '>= 0.60.0', # required for install_tag keyword argument.
1211
)
1312

1413
xmlxx_api_version = '2.6'
@@ -38,10 +37,9 @@ macos_darwin_versions = [
3837
'@0@.@1@'.format(libtool_soversion[0] + 1, libtool_soversion[1])
3938
]
4039

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()
4543

4644
cpp_compiler = meson.get_compiler('cpp')
4745
is_msvc = cpp_compiler.get_id() == 'msvc'
@@ -392,7 +390,9 @@ configure_file(
392390
input: 'libxml++-2.6.pc.in',
393391
output: '@BASENAME@',
394392
configuration: pkg_conf_data,
393+
install: true,
395394
install_dir: install_pkgconfigdir,
395+
install_tag: 'devel',
396396
)
397397

398398
xmlxxconfig_h_meson = files('libxml++config.h.meson')
@@ -401,33 +401,30 @@ configure_file(
401401
input: xmlxxconfig_h_meson,
402402
output: 'libxml++config.h',
403403
configuration: pkg_conf_data,
404+
install: true,
404405
install_dir: install_includeconfigdir,
406+
install_tag: 'devel',
405407
)
406408

407-
# add_dist_script() is not allowed in a subproject if meson.version() < 0.58.0.
408-
can_add_dist_script = not meson.is_subproject() or meson.version().version_compare('>= 0.58.0')
409-
410409
subdir('MSVC_NMake/libxml++')
411410
subdir('libxml++')
412411
subdir('examples')
413412
subdir('tests')
414413
subdir('docs/reference')
415414
subdir('docs/manual')
416415

417-
if can_add_dist_script
418-
# Add a ChangeLog file to the distribution directory.
419-
meson.add_dist_script(
420-
python3, dist_changelog_py,
421-
project_source_root,
422-
)
423-
# Add build scripts to the distribution directory, and delete .gitignore
424-
# files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
425-
meson.add_dist_script(
426-
python3, dist_build_scripts_py,
427-
project_source_root,
428-
'untracked' / 'build_scripts',
429-
)
430-
endif
416+
# Add a ChangeLog file to the distribution directory.
417+
meson.add_dist_script(
418+
python3, dist_changelog_py,
419+
project_source_root,
420+
)
421+
# Add build scripts to the distribution directory, and delete .gitignore
422+
# files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
423+
meson.add_dist_script(
424+
python3, dist_build_scripts_py,
425+
project_source_root,
426+
'untracked' / 'build_scripts',
427+
)
431428

432429
if meson.is_subproject()
433430
pkgconfig_vars = {

tests/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ foreach ex : test_programs
2424
exe_file = executable(ex_name, ex_sources,
2525
dependencies: xmlxx_own_dep,
2626
implicit_include_directories: false,
27-
build_by_default: build_tests
27+
build_by_default: build_tests,
28+
install: false,
2829
)
2930

3031
if build_tests

0 commit comments

Comments
 (0)