summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2021-03-12 16:43:01 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2021-03-12 16:43:01 +0100
commitea94a3bc75c19a15c5a7099ae0dfaacdec19b70b (patch)
tree3cba49a7c34bb9727947845d210c4eb2c8b63c97
parentdc5027bad15153456b0157199e857f7c7f7d0ed9 (diff)
downloadsigc++-ea94a3bc75c19a15c5a7099ae0dfaacdec19b70b.tar.gz
Meson build: Make it possible to use sigc++ as a subproject
mm-common can be a subproject of sigc++.
-rw-r--r--Makefile.am1
-rw-r--r--docs/docs/reference/meson.build8
-rw-r--r--examples/meson.build4
-rw-r--r--meson.build15
-rw-r--r--sigc++/meson.build8
-rw-r--r--subprojects/mm-common.wrap9
-rw-r--r--tests/meson.build6
7 files changed, 37 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index b619dbd..e10fd1b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,6 +54,7 @@ EXTRA_DIST = \
docs/docs/reference/meson.build \
examples/meson.build \
sigc++/meson.build \
+ subprojects/mm-common.wrap \
tests/meson.build \
tools/handle-built-files.py \
tools/tutorial-custom-cmd.py \
diff --git a/docs/docs/reference/meson.build b/docs/docs/reference/meson.build
index 63d2ab8..fb30c79 100644
--- a/docs/docs/reference/meson.build
+++ b/docs/docs/reference/meson.build
@@ -3,7 +3,7 @@
# Input: project_build_root, project_source_root, sigcxx_pcname,
# sigcxx_api_version, build_documentation, source_h_files,
# hg_ccg_basenames, install_datadir, python3, doc_reference
-# Output: install_docdir, install_devhelpdir, book_name
+# Output: install_docdir, install_devhelpdir, book_name, tag_file
# There are no built source files in libsigc++-3.0.
@@ -15,9 +15,9 @@ docinstall_flags = []
foreach module : tag_file_modules
depmod = dependency(module, required: false)
if depmod.found()
- doxytagfile = depmod.get_pkgconfig_variable('doxytagfile')
- htmlrefpub = depmod.get_pkgconfig_variable('htmlrefpub', default: '')
- htmlrefdir = depmod.get_pkgconfig_variable('htmlrefdir', default: '')
+ doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile')
+ htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '')
+ htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '')
if htmlrefpub == ''
htmlrefpub = htmlrefdir
elif htmlrefdir == ''
diff --git a/examples/meson.build b/examples/meson.build
index 501f196..d6efd8b 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -1,6 +1,6 @@
# examples
-# input: sigcxx_dep, build_examples
+# input: sigcxx_own_dep, build_examples
examples = [
# [[dir-name], exe-name, [sources]]
@@ -21,7 +21,7 @@ foreach ex : examples
exe_file = executable(ex_name, ex_sources,
cpp_args: '-DSIGCXX_DISABLE_DEPRECATED',
- dependencies: sigcxx_dep,
+ dependencies: sigcxx_own_dep,
gui_app: false,
build_by_default: build_examples
)
diff --git a/meson.build b/meson.build
index 632cded..14803a4 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,7 @@ project('libsigc++', 'cpp',
'cpp_std=c++17',
'warning_level=0',
],
- meson_version: '>= 0.50.0', # required for python3.path()
+ meson_version: '>= 0.54.0', # required for dep.get_variable(internal:)
)
sigcxx_api_version = '3.0'
@@ -238,6 +238,19 @@ if not meson.is_subproject()
project_source_root,
'untracked' / 'build_scripts',
)
+else
+ # This is a subproject.
+ sigcxx_dep = declare_dependency(
+ dependencies: sigcxx_own_dep,
+ variables: {
+ 'doxytagfile': tag_file.full_path(),
+ 'htmlrefdir': install_prefix / install_docdir / 'reference' / 'html',
+ 'htmlrefpub': 'http://library.gnome.org/devel/libsigc++/unstable/'
+ }
+ )
+
+ # A main project that looks for sigcxx_pcname.pc shall find sigcxx_dep.
+ meson.override_dependency(sigcxx_pcname, sigcxx_dep)
endif
# Print a summary.
diff --git a/sigc++/meson.build b/sigc++/meson.build
index 3e5a523..2b73897 100644
--- a/sigc++/meson.build
+++ b/sigc++/meson.build
@@ -2,7 +2,7 @@
# Input: sigcxx_build_dep, sigcxx_pcname, sigcxx_libversion, sigcxx_api_version,
# darwin_versions, install_includedir, sig_rc
-# Output: source_h_files, sigcxx_dep
+# Output: source_h_files, sigcxx_own_dep
# There are no built source files in libsigc++-3.0.
@@ -96,9 +96,9 @@ sigcxx_library = library('sigc-' + sigcxx_api_version,
install: true,
)
-# This is useful in the main project when libsigc++ is used as a subproject.
-# It's also used when building example programs and test programs.
-sigcxx_dep = declare_dependency(
+# This is used when building example programs and test programs.
+# It's also a part of sigcxx_dep, when libsigc++ is a subproject.
+sigcxx_own_dep = declare_dependency(
link_with: sigcxx_library,
include_directories: extra_include_dirs,
dependencies: sigcxx_build_dep
diff --git a/subprojects/mm-common.wrap b/subprojects/mm-common.wrap
new file mode 100644
index 0000000..296109f
--- /dev/null
+++ b/subprojects/mm-common.wrap
@@ -0,0 +1,9 @@
+[wrap-git]
+directory=mm-common
+url=https://gitlab.gnome.org/GNOME/mm-common.git
+revision=master
+depth=1
+
+[provide]
+dependency_names = mm-common-libstdc++
+program_names = mm-common-get
diff --git a/tests/meson.build b/tests/meson.build
index 04aaa99..eba5937 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,6 +1,6 @@
# tests
-# input: sigcxx_dep, do_benchmark, can_benchmark, benchmark_dep
+# input: sigcxx_own_dep, do_benchmark, can_benchmark, benchmark_dep
benchmark_timeout = 100
@@ -64,7 +64,7 @@ foreach ex : test_programs
endforeach
exe_file = executable(ex_name, ex_sources,
- dependencies: sigcxx_dep,
+ dependencies: sigcxx_own_dep,
gui_app: false,
build_by_default: true
)
@@ -85,7 +85,7 @@ if can_benchmark
endforeach
exe_file = executable(ex_name, ex_sources,
- dependencies: [sigcxx_dep, benchmark_dep],
+ dependencies: [sigcxx_own_dep, benchmark_dep],
gui_app: false,
build_by_default: do_benchmark
)