Skip to content

Commit 3feecca

Browse files
committed
Add support for building libsigc++-2.0 with Meson
libsigc++-2.0 can be built with either Autotools or Meson.
1 parent 66590ca commit 3feecca

19 files changed

+1506
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ Makefile.in
2323
/sigc++config.h
2424
/sigc++-*.pc
2525
/stamp-h?
26+
untracked/build_scripts/
27+
untracked/docs/
28+
untracked/sigc++/

MSVC_NMake/meson.build

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# MSVC_NMake
2+
3+
# Input: pkg_conf_data, project_build_root, python3
4+
# Output: -
5+
6+
configure_file(
7+
input: 'sigc.rc.in',
8+
output: '@BASENAME@',
9+
configuration: pkg_conf_data,
10+
)
11+
12+
# Copy the generated configuration header into the MSVC project directory.
13+
cmd_py = '''
14+
import shutil
15+
shutil.copy2("@0@", "@1@")
16+
'''.format(project_build_root / 'sigc++config.h', meson.current_build_dir())
17+
meson.add_postconf_script(python3.path(), '-c', cmd_py)

Makefile.am

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,25 @@ dist_noinst_DATA = $(addprefix MSVC_NMake/,$(msvc_nmake_data))
3939

4040
DISTCLEANFILES = MSVC_NMake/sigc++config.h
4141

42+
# Distribute files needed when building libsigc++ with meson.
43+
EXTRA_DIST = \
44+
meson.build \
45+
meson_options.txt \
46+
sigc++config.h.meson \
47+
MSVC_NMake/meson.build \
48+
docs/manual/meson.build \
49+
docs/reference/meson.build \
50+
examples/meson.build \
51+
sigc++/meson.build \
52+
tests/meson.build \
53+
tools/dist-cmd.py \
54+
tools/handle-built-files.py \
55+
tools/tutorial-custom-cmd.py \
56+
tools/gcc_template_specialization_operator_overload.cc \
57+
tools/have_sun_reverse_iterator.cc \
58+
tools/msvc_template_specialization_operator_overload.cc \
59+
tools/pragma_push_pop_macro.cc \
60+
untracked/README
61+
4262
# Optional: auto-generate the ChangeLog file from the git log on make dist
4363
include $(top_srcdir)/build/dist-changelog.am

docs/manual/meson.build

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# docs/manual
2+
3+
# input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
4+
# build_documentation, dist_cmd, install_docdir
5+
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
6+
# install_tutorialdir
7+
8+
# xsltproc is required by tutorial_custom_cmd html.
9+
xsltproc = find_program('xsltproc', required: build_documentation)
10+
xmllint = find_program('xmllint', required: false)
11+
12+
can_parse_and_validate = xmllint.found()
13+
14+
validate = get_option('validation') ? 'true' : 'false'
15+
16+
dblatex = find_program('dblatex', required: false)
17+
can_build_pdf = dblatex.found() or (xmllint.found() and \
18+
find_program('docbook2pdf', required: false).found())
19+
build_pdf_by_default = get_option('build-pdf')
20+
21+
# Installation directories are relative to {prefix}.
22+
install_tutorialdir = install_docdir / 'tutorial'
23+
24+
if not build_documentation
25+
# Documentation shall not be built or installed.
26+
# Return to the calling meson.build file.
27+
subdir_done()
28+
endif
29+
30+
install_data('..' / 'index.html', install_dir: install_docdir)
31+
install_data('..' / 'images' / 'libsigc_logo.gif',
32+
'..' / 'images' / 'top.gif',
33+
install_dir: install_docdir / 'images')
34+
35+
doc_dist_dir = 'untracked' / 'docs' / 'manual' # Relative to MESON_DIST_ROOT
36+
37+
sigc_manual_xml = 'libsigc_manual.xml'
38+
sigc_manual_pdf = 'libsigc_manual.pdf'
39+
40+
# Create an html version of the DocBook.
41+
custom_target('manual_html',
42+
input: sigc_manual_xml,
43+
output: 'html',
44+
command: [
45+
python3, tutorial_custom_cmd, 'html',
46+
'@INPUT@',
47+
'@OUTPUT@',
48+
],
49+
build_by_default: true,
50+
install: true,
51+
install_dir: install_tutorialdir
52+
)
53+
54+
if can_parse_and_validate
55+
# Parse and possibly validate the DocBook.
56+
custom_target('manual_xmllint',
57+
input: sigc_manual_xml,
58+
output: 'manual_xmllint.stamp',
59+
command: [
60+
python3, tutorial_custom_cmd, 'xmllint',
61+
validate,
62+
'@INPUT@',
63+
'@OUTPUT@'
64+
],
65+
build_by_default: true,
66+
)
67+
endif
68+
69+
if can_build_pdf
70+
# Create a PDF file of the DocBook.
71+
# Prefer dblatex, if both dblatex and docbook2pdf are available.
72+
custom_target('manual_pdf',
73+
input: sigc_manual_xml,
74+
output: sigc_manual_pdf,
75+
command: [
76+
python3, tutorial_custom_cmd,
77+
dblatex.found() ? 'dblatex' : 'docbook2pdf',
78+
'@INPUT@',
79+
'@OUTPUT@'
80+
],
81+
build_by_default: build_pdf_by_default,
82+
)
83+
endif
84+
85+
if not meson.is_subproject()
86+
# Distribute built files.
87+
# (add_dist_script() is not allowed in a subproject)
88+
meson.add_dist_script(
89+
python3.path(), dist_cmd,
90+
python3.path(), tutorial_custom_cmd, 'dist_doc',
91+
doc_dist_dir,
92+
meson.current_build_dir(),
93+
meson.current_source_dir() / sigc_manual_xml,
94+
meson.current_build_dir() / sigc_manual_pdf,
95+
)
96+
endif

docs/reference/meson.build

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# docs/reference
2+
3+
# Input: built_files_root, project_source_root, sigcxx_pcname,
4+
# sigcxx_api_version, perl, build_documentation, source_h_files,
5+
# built_h_files, install_datadir, dist_cmd, python3,
6+
# built_h_file_targets
7+
# Output: install_docdir, install_devhelpdir
8+
9+
tag_file_modules = [
10+
'mm-common-libstdc++',
11+
]
12+
doxygen_tagfiles = ''
13+
docinstall_flags = []
14+
foreach module : tag_file_modules
15+
depmod = dependency(module, required: false)
16+
if depmod.found()
17+
doxytagfile = depmod.get_pkgconfig_variable('doxytagfile')
18+
htmlrefpub = depmod.get_pkgconfig_variable('htmlrefpub', default: '')
19+
htmlrefdir = depmod.get_pkgconfig_variable('htmlrefdir', default: '')
20+
if htmlrefpub == ''
21+
htmlrefpub = htmlrefdir
22+
elif htmlrefdir == ''
23+
htmlrefdir = htmlrefpub
24+
endif
25+
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
26+
if not htmlrefdir.endswith('/')
27+
htmlrefdir += '/'
28+
endif
29+
docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
30+
endif
31+
endforeach
32+
33+
book_name = 'lib' + sigcxx_pcname
34+
book_title = meson.project_name() + ' Reference Manual'
35+
36+
# Configuration data for Doxyfile.
37+
doc_conf_data = configuration_data()
38+
doc_conf_data.set('configure_input',
39+
'docs/docs/reference/Doxyfile. Generated from Doxyfile.in by meson.configure_file().')
40+
doc_conf_data.set('PACKAGE_NAME', meson.project_name())
41+
doc_conf_data.set('PACKAGE_VERSION', meson.project_version())
42+
doc_conf_data.set('abs_top_builddir', built_files_root)
43+
doc_conf_data.set('abs_top_srcdir', project_source_root)
44+
doc_conf_data.set('SIGCXX_API_VERSION', sigcxx_api_version)
45+
doc_conf_data.set('DOXYGEN_TAGFILES', doxygen_tagfiles)
46+
doc_conf_data.set('PERL', perl.path())
47+
48+
configure_file(
49+
input: 'Doxyfile.in',
50+
output: '@BASENAME@',
51+
configuration: doc_conf_data,
52+
)
53+
54+
# Installation directories relative to {prefix}.
55+
install_docdir = install_datadir / 'doc' / book_name
56+
install_reference_docdir = install_docdir / 'reference'
57+
install_devhelpdir = install_datadir / 'devhelp' / 'books' / book_name
58+
59+
if not build_documentation
60+
# Documentation shall not be built or installed.
61+
# Return to the calling meson.build file.
62+
subdir_done()
63+
endif
64+
65+
66+
# Built input .h files to Doxygen.
67+
blt_h_files = []
68+
foreach file : built_h_files
69+
blt_h_files += built_files_root / 'sigc++' / file
70+
endforeach
71+
72+
# Hand-coded input .h files to Doxygen.
73+
src_h_files = []
74+
foreach file : source_h_files
75+
src_h_files += project_source_root / 'sigc++' / file
76+
endforeach
77+
src_h_files += project_source_root / 'sigc++' / 'sigc++.h'
78+
79+
doctool_dir = project_source_root / 'untracked' / 'docs' # MMDOCTOOLDIR
80+
doctool_dist_dir = 'untracked' / 'docs' # Relative to MESON_DIST_ROOT
81+
82+
if built_h_file_targets.length() > 0
83+
# .h files have been generated from .hg files (maintainer mode).
84+
tag_file = custom_target('html_and_tag',
85+
input: src_h_files,
86+
output: book_name + '.tag',
87+
command: [
88+
python3, doc_reference, 'doxygen',
89+
doctool_dir,
90+
'@OUTPUT@',
91+
blt_h_files,
92+
'@INPUT@',
93+
],
94+
build_by_default: build_documentation,
95+
depends: built_h_file_targets,
96+
install: true,
97+
install_dir: install_reference_docdir,
98+
)
99+
else
100+
# All .h files are stored in the source tree (not maintainer mode).
101+
tag_file = custom_target('html_and_tag',
102+
input: src_h_files + blt_h_files,
103+
output: book_name + '.tag',
104+
command: [
105+
python3, doc_reference, 'doxygen',
106+
doctool_dir,
107+
'@OUTPUT@',
108+
'@INPUT@',
109+
],
110+
build_by_default: build_documentation,
111+
install: true,
112+
install_dir: install_reference_docdir,
113+
)
114+
endif
115+
116+
devhelp_file = custom_target('devhelp',
117+
input: tag_file,
118+
output: book_name + '.devhelp2',
119+
command: [
120+
python3, doc_reference, 'devhelp',
121+
doctool_dir,
122+
'@INPUT@',
123+
'@OUTPUT@',
124+
book_name,
125+
book_title,
126+
],
127+
build_by_default: build_documentation,
128+
)
129+
130+
# Install Devhelp file and html files.
131+
meson.add_install_script(
132+
python3.path(), doc_reference, 'install_doc',
133+
doctool_dir,
134+
devhelp_file.full_path(),
135+
install_devhelpdir,
136+
install_reference_docdir / 'html',
137+
docinstall_flags
138+
)
139+
140+
if not meson.is_subproject()
141+
# Distribute built files and files copied by mm-common-get.
142+
# (add_dist_script() is not allowed in a subproject)
143+
meson.add_dist_script(
144+
python3.path(), dist_cmd,
145+
python3.path(), doc_reference, 'dist_doc',
146+
doctool_dir,
147+
doctool_dist_dir,
148+
meson.current_build_dir(),
149+
tag_file.full_path(),
150+
devhelp_file.full_path(),
151+
)
152+
endif

examples/meson.build

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# examples
2+
3+
# input: sigcxx_dep, build_examples
4+
5+
examples = [
6+
# [[dir-name], exe-name, [sources]]
7+
[[], 'hello_world', ['hello_world.cc']],
8+
[[], 'member_method', ['member_method.cc']],
9+
]
10+
11+
foreach ex : examples
12+
dir = ''
13+
foreach dir_part : ex[0]
14+
dir = dir / dir_part
15+
endforeach
16+
ex_name = (dir / ex[1]).underscorify()
17+
ex_sources = []
18+
foreach src : ex[2]
19+
ex_sources += dir / src
20+
endforeach
21+
22+
exe_file = executable(ex_name, ex_sources,
23+
dependencies: sigcxx_dep,
24+
gui_app: false,
25+
build_by_default: build_examples
26+
)
27+
endforeach

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy