Skip to content

Commit 8787f42

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 920196d commit 8787f42

File tree

7 files changed

+79
-77
lines changed

7 files changed

+79
-77
lines changed

MSVC_NMake/meson.build

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# MSVC_NMake
22

3-
# Input: pkg_conf_data, sigcxxconfig_h_meson, project_build_root, python3,
4-
# can_add_dist_script
3+
# Input: pkg_conf_data, sigcxxconfig_h_meson, project_build_root, python3
54
# Output: sigc_rc
65

76
sigc_rc = configure_file(
@@ -20,13 +19,11 @@ configure_file(
2019
untracked_msvc_nmake = 'untracked' / 'MSVC_NMake'
2120
handle_built_files = project_source_root / 'tools' / 'handle-built-files.py'
2221

23-
if can_add_dist_script
24-
# Distribute built files.
25-
meson.add_dist_script(
26-
python3, handle_built_files, 'dist_gen_msvc_files',
27-
meson.current_build_dir(),
28-
untracked_msvc_nmake,
29-
project_build_root / 'sigc++config.h',
30-
meson.current_build_dir() / 'sigc.rc',
31-
)
32-
endif
22+
# Distribute built files.
23+
meson.add_dist_script(
24+
python3, handle_built_files, 'dist_gen_msvc_files',
25+
meson.current_build_dir(),
26+
untracked_msvc_nmake,
27+
project_build_root / 'sigc++config.h',
28+
meson.current_build_dir() / 'sigc.rc',
29+
)

docs/manual/meson.build

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

33
# input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
4-
# build_documentation, install_docdir, can_add_dist_script, xsltproc
4+
# build_documentation, install_docdir, xsltproc
55
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
66
# install_tutorialdir, build_manual_opt, build_manual
77

@@ -45,10 +45,15 @@ if xmllint.found()
4545
endif
4646
endif
4747

48-
install_data('..' / 'index.html', install_dir: install_docdir)
48+
install_data('..' / 'index.html',
49+
install_dir: install_docdir,
50+
install_tag: 'doc',
51+
)
4952
install_data('..' / 'images' / 'libsigc_logo.gif',
5053
'..' / 'images' / 'top.gif',
51-
install_dir: install_docdir / 'images')
54+
install_dir: install_docdir / 'images',
55+
install_tag: 'doc',
56+
)
5257

5358
doc_dist_dir = 'untracked' / 'docs' / 'manual' # Relative to MESON_DIST_ROOT
5459

@@ -66,7 +71,8 @@ custom_target('manual_html',
6671
],
6772
build_by_default: true,
6873
install: true,
69-
install_dir: install_tutorialdir
74+
install_dir: install_tutorialdir,
75+
install_tag: 'doc',
7076
)
7177

7278
if can_parse_and_validate
@@ -100,13 +106,11 @@ if can_build_pdf
100106
)
101107
endif
102108

103-
if can_add_dist_script
104-
# Distribute built files.
105-
meson.add_dist_script(
106-
python3, tutorial_custom_cmd, 'dist_doc',
107-
doc_dist_dir,
108-
meson.current_build_dir(),
109-
meson.current_source_dir() / sigc_manual_xml,
110-
meson.current_build_dir() / sigc_manual_pdf,
111-
)
112-
endif
109+
# Distribute built files.
110+
meson.add_dist_script(
111+
python3, tutorial_custom_cmd, 'dist_doc',
112+
doc_dist_dir,
113+
meson.current_build_dir(),
114+
meson.current_source_dir() / sigc_manual_xml,
115+
meson.current_build_dir() / sigc_manual_pdf,
116+
)

docs/reference/meson.build

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Input: built_files_root, project_source_root, sigcxx_pcname,
44
# sigcxx_api_version, build_documentation, source_h_files,
55
# built_h_files, install_datadir, python3, doc_reference,
6-
# built_h_file_targets, can_add_dist_script, dot
6+
# built_h_file_targets, dot
77
# Output: install_docdir, install_devhelpdir, if build_documentation: tag_file
88

99
tag_file_modules = [
@@ -15,7 +15,7 @@ docinstall_flags = []
1515
foreach module : tag_file_modules
1616
depmod = dependency(module, required: false)
1717
if depmod.found()
18-
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile', default_value: '')
18+
doxytagfile = depmod.get_variable('doxytagfile', default_value: '')
1919
if doxytagfile != ''
2020
if depmod.type_name() == 'internal'
2121
# Subprojects must build their tag files before doxygen is called.
@@ -25,8 +25,8 @@ foreach module : tag_file_modules
2525
doxygen_tag_targets += subproject(module).get_variable('global_tag_file_target')
2626
endif
2727
endif
28-
htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '')
29-
htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '')
28+
htmlrefpub = depmod.get_variable('htmlrefpub', default_value: '')
29+
htmlrefdir = depmod.get_variable('htmlrefdir', default_value: '')
3030
if htmlrefpub == ''
3131
htmlrefpub = htmlrefdir
3232
elif htmlrefdir == ''
@@ -110,6 +110,7 @@ if built_h_file_targets.length() > 0
110110
build_by_default: build_documentation,
111111
install: true,
112112
install_dir: install_reference_docdir,
113+
install_tag: 'doc',
113114
)
114115
else
115116
# All .h files are stored in the source tree (not maintainer mode).
@@ -127,6 +128,7 @@ else
127128
build_by_default: build_documentation,
128129
install: true,
129130
install_dir: install_reference_docdir,
131+
install_tag: 'doc',
130132
)
131133
endif
132134

@@ -151,17 +153,16 @@ meson.add_install_script(
151153
devhelp_file.full_path(),
152154
install_devhelpdir,
153155
install_reference_docdir / 'html',
154-
docinstall_flags
156+
docinstall_flags,
157+
install_tag: 'doc',
155158
)
156159

157-
if can_add_dist_script
158-
# Distribute built files and files copied by mm-common-get.
159-
meson.add_dist_script(
160-
python3, doc_reference, 'dist_doc',
161-
doctool_dir,
162-
doctool_dist_dir,
163-
meson.current_build_dir(),
164-
tag_file.full_path(),
165-
devhelp_file.full_path(),
166-
)
167-
endif
160+
# Distribute built files and files copied by mm-common-get.
161+
meson.add_dist_script(
162+
python3, doc_reference, 'dist_doc',
163+
doctool_dir,
164+
doctool_dist_dir,
165+
meson.current_build_dir(),
166+
tag_file.full_path(),
167+
devhelp_file.full_path(),
168+
)

examples/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ foreach ex : examples
2323
cpp_args: '-DSIGCXX_DISABLE_DEPRECATED=1',
2424
dependencies: sigcxx_own_dep,
2525
implicit_include_directories: false,
26-
build_by_default: build_examples
26+
build_by_default: build_examples,
27+
install: false,
2728
)
2829
endforeach

meson.build

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ project('libsigc++', '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
sigcxx_api_version = '2.0'
@@ -34,10 +33,9 @@ sigcxx_libversion = '@0@.@1@.@2@'.format(
3433
libtool_soversion[1])
3534
darwin_versions = [libtool_soversion[0] + 1, '@0@.@1@'.format(libtool_soversion[0] + 1, libtool_soversion[1])]
3635

37-
# Use these instead of meson.source_root() and meson.build_root() in subdirectories.
38-
# source_root() and build_root() are not useful, if this is a subproject.
39-
project_source_root = meson.current_source_dir()
40-
project_build_root = meson.current_build_dir()
36+
# Source and build root directories of the current (sub)project.
37+
project_source_root = meson.project_source_root()
38+
project_build_root = meson.project_build_root()
4139

4240
cpp_compiler = meson.get_compiler('cpp')
4341
is_msvc = cpp_compiler.get_id() == 'msvc'
@@ -260,13 +258,16 @@ configure_file(
260258
input: 'sigc++.pc.in',
261259
output: sigcxx_pcname + '.pc',
262260
configuration: pkg_conf_data,
261+
install: true,
263262
install_dir: install_pkgconfigdir,
263+
install_tag: 'devel',
264264
)
265265

266266
configure_file(
267267
input: 'sigc++-uninstalled.pc.in',
268268
output: sigcxx_pcname + '-uninstalled.pc',
269269
configuration: pkg_conf_data,
270+
install: false,
270271
)
271272

272273
sigcxxconfig_h_meson = files('sigc++config.h.meson')
@@ -275,33 +276,30 @@ configure_file(
275276
input: sigcxxconfig_h_meson,
276277
output: 'sigc++config.h',
277278
configuration: pkg_conf_data,
279+
install: true,
278280
install_dir: install_includeconfigdir,
281+
install_tag: 'devel',
279282
)
280283

281-
# add_dist_script() is not allowed in a subproject if meson.version() < 0.58.0.
282-
can_add_dist_script = not meson.is_subproject() or meson.version().version_compare('>= 0.58.0')
283-
284284
subdir('MSVC_NMake')
285285
subdir('sigc++')
286286
subdir('examples')
287287
subdir('tests')
288288
subdir('docs/reference')
289289
subdir('docs/manual')
290290

291-
if can_add_dist_script
292-
# Add a ChangeLog file to the distribution directory.
293-
meson.add_dist_script(
294-
python3, dist_changelog,
295-
project_source_root,
296-
)
297-
# Add build scripts to the distribution directory, and delete .gitignore
298-
# files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
299-
meson.add_dist_script(
300-
python3, dist_build_scripts,
301-
project_source_root,
302-
'untracked' / 'build_scripts',
303-
)
304-
endif
291+
# Add a ChangeLog file to the distribution directory.
292+
meson.add_dist_script(
293+
python3, dist_changelog,
294+
project_source_root,
295+
)
296+
# Add build scripts to the distribution directory, and delete .gitignore
297+
# files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
298+
meson.add_dist_script(
299+
python3, dist_build_scripts,
300+
project_source_root,
301+
'untracked' / 'build_scripts',
302+
)
305303

306304
if meson.is_subproject()
307305
pkgconfig_vars = {

sigc++/meson.build

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

33
# Input: sigcxx_build_dep, sigcxx_pcname, sigcxx_libversion, sigcxx_api_version,
44
# install_includedir, project_source_root, sigc_res, python3,
5-
# handle_built_files, maintainer_mode, can_add_dist_script
5+
# handle_built_files, maintainer_mode
66
# Output: source_h_files, built_h_files, sigcxx_own_dep, built_files_root,
77
# built_h_file_targets
88

@@ -174,17 +174,16 @@ meson.add_install_script(
174174
built_h_cc_dir,
175175
install_includedir / sigcxx_pcname / 'sigc++', # subdir below {prefix}
176176
built_h_files,
177+
install_tag: 'devel',
177178
)
178179

179-
if can_add_dist_script
180-
# Distribute built files.
181-
meson.add_dist_script(
182-
python3, handle_built_files, 'dist_built_files',
183-
built_h_cc_dir,
184-
untracked_sigcxx,
185-
built_h_files + built_cc_files,
186-
)
187-
endif
180+
# Distribute built files.
181+
meson.add_dist_script(
182+
python3, handle_built_files, 'dist_built_files',
183+
built_h_cc_dir,
184+
untracked_sigcxx,
185+
built_h_files + built_cc_files,
186+
)
188187

189188
# This is used when building example programs and test programs.
190189
# It's also a part of sigcxx_dep, when libsigc++ is a subproject.

tests/meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ foreach ex : test_programs
6060
dependencies: sigcxx_own_dep,
6161
implicit_include_directories: false,
6262
build_by_default: build_tests,
63+
install: false,
6364
)
6465

6566
# If exe_file is a test program, it is built by default unconditionally.
@@ -83,7 +84,8 @@ if can_benchmark
8384
exe_file = executable(ex_name, ex_sources,
8485
dependencies: [sigcxx_own_dep, benchmark_dep],
8586
implicit_include_directories: false,
86-
build_by_default: do_benchmark
87+
build_by_default: do_benchmark,
88+
install: false,
8789
)
8890

8991
if do_benchmark

0 commit comments

Comments
 (0)