[atkmm] Meson build: Make it possible to use atkmm as a subproject
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atkmm] Meson build: Make it possible to use atkmm as a subproject
- Date: Tue, 16 Mar 2021 13:35:40 +0000 (UTC)
commit c5f3b4ba1190d35e13328b5a53b03ecd84004f33
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Tue Mar 16 14:32:39 2021 +0100
Meson build: Make it possible to use atkmm as a subproject
atk and glibmm can be subprojects of atkmm.
Makefile.am | 2 ++
atk/atkmm/meson.build | 6 +++---
codegen/extradefs/meson.build | 8 +++++++-
doc/reference/meson.build | 8 ++++----
meson.build | 20 +++++++++++++++++---
subprojects/atk.wrap | 8 ++++++++
subprojects/glibmm-2.68.wrap | 8 ++++++++
7 files changed, 49 insertions(+), 11 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6a38ad5..3f8d592 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -60,6 +60,8 @@ EXTRA_DIST = \
atk/atkmmconfig.h.meson \
codegen/dummy-header.py \
codegen/extradefs/meson.build \
+ subprojects/atk.wrap \
+ subprojects/glibmm-2.68.wrap \
untracked/README
# Auto-generate the ChangeLog file from the git log on make dist
diff --git a/atk/atkmm/meson.build b/atk/atkmm/meson.build
index d39fc4a..c210af0 100644
--- a/atk/atkmm/meson.build
+++ b/atk/atkmm/meson.build
@@ -5,7 +5,7 @@
# python3, atkmm_rc, dummy_header_py, gmmproc_dir, msvc14x_toolset_ver,
# macos_darwin_versions
# Output: hg_ccg_basenames, extra_h_files, built_h_file_targets, built_files_root,
-# atkmm_dep
+# atkmm_own_dep
defs_basefiles = [
'atk.defs',
@@ -225,9 +225,9 @@ if not meson.is_subproject()
)
endif
-# This is useful in the main project when atkmm is used as a subproject.
+# This is part of atkmm_dep, when atkmm is a subproject.
# It can also be used if there are example programs and test programs to build.
-atkmm_dep = declare_dependency(
+atkmm_own_dep = declare_dependency(
sources: built_h_file_targets,
link_with: atkmm_library,
include_directories: extra_include_dirs,
diff --git a/codegen/extradefs/meson.build b/codegen/extradefs/meson.build
index edec100..7400a85 100644
--- a/codegen/extradefs/meson.build
+++ b/codegen/extradefs/meson.build
@@ -1,12 +1,18 @@
# codegen/extradefs
# Input: cpp_compiler, atkmm_build_dep, install_libdir, atkmm_pcname,
-# msvc14x_toolset_ver
+# msvc14x_toolset_ver, glibmm_dep
# Output: m4_files, install_m4dir
glibmm_generate_extra_defs_dep = cpp_compiler.find_library(
'glibmm_generate_extra_defs@0@-2.68'.format(msvc14x_toolset_ver),
+ required: glibmm_dep.type_name() != 'internal',
)
+if not glibmm_generate_extra_defs_dep.found()
+ glibmm_generate_extra_defs_dep = dependency(
+ '', fallback: ['glibmm-2.68', 'glibmm_generate_extra_defs_dep'],
+ )
+endif
executable('generate_extra_defs', 'generate_extra_defs_atk.cc',
dependencies: [atkmm_build_dep, glibmm_generate_extra_defs_dep],
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index a7d22f2..95ea53c 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -3,7 +3,7 @@
# Input: built_files_root, project_source_root, atkmm_pcname, hg_ccg_basenames,
# extra_h_files, built_h_file_targets, install_datadir, python3,
# doc_reference_py
-# Output: install_docdir, install_devhelpdir
+# Output: install_docdir, install_devhelpdir, tag_file
tag_file_modules = [
'mm-common-libstdc++',
@@ -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/meson.build b/meson.build
index 7a778a6..82452aa 100644
--- a/meson.build
+++ b/meson.build
@@ -6,7 +6,8 @@ project('atkmm', 'cpp',
default_options: [
'cpp_std=c++17'
],
- meson_version: '>= 0.50.0', # required for python3.path()
+ meson_version: '>= 0.54.0', # required for meson.override_dependency()
+ # and dep.get_variable(internal:)
)
atkmm_api_version = '2.36'
@@ -100,7 +101,6 @@ glibmm_req = '>= 2.68.0'
# Atk supported pkg-config files on MSVC files for a good while, so just use that
atk_req = '>= 1.18.0'
atk_dep = dependency('atk', version: atk_req)
-
# The -mm libraries do not yet have pkg-config files for MSVC builds,
# so check for them manually
glibmm_req_minor_ver = '68'
@@ -127,7 +127,7 @@ dot = find_program('dot', required: build_documentation) # Used by Doxygen
xsltproc = find_program('xsltproc', required: build_documentation)
# Where to find gmmproc and generate_wrap_init.pl.
-gmmproc_dir = glibmm_dep.get_pkgconfig_variable('gmmprocdir')
+gmmproc_dir = glibmm_dep.get_variable(pkgconfig: 'gmmprocdir', internal: 'gmmprocdir')
# Script files copied to 'untracked' by mm-common-get.
script_dir = project_source_root / 'untracked' / 'build_scripts'
@@ -232,6 +232,20 @@ if not meson.is_subproject()
project_source_root,
'untracked' / 'build_scripts',
)
+else
+ # This is a subproject.
+ atkmm_dep = declare_dependency(
+ dependencies: atkmm_own_dep,
+ variables: {
+ 'gmmprocm4dir': project_source_root / 'codegen' / 'm4',
+ 'doxytagfile': tag_file.full_path(),
+ 'htmlrefdir': install_prefix / install_docdir / 'reference' / 'html',
+ 'htmlrefpub': 'http://library.gnome.org/devel/' + pkg_conf_data.get_unquoted('PACKAGE_TARNAME') +
'/unstable/'
+ }
+ )
+
+ # A main project that looks for atkmm_pcname.pc shall find atkmm_dep.
+ meson.override_dependency(atkmm_pcname, atkmm_dep)
endif
# Print a summary.
diff --git a/subprojects/atk.wrap b/subprojects/atk.wrap
new file mode 100644
index 0000000..8ac8659
--- /dev/null
+++ b/subprojects/atk.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+directory=atk
+url=https://gitlab.gnome.org/GNOME/atk.git
+revision=master
+depth=1
+
+[provide]
+atk = libatk_dep
diff --git a/subprojects/glibmm-2.68.wrap b/subprojects/glibmm-2.68.wrap
new file mode 100644
index 0000000..a0fef48
--- /dev/null
+++ b/subprojects/glibmm-2.68.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+directory=glibmm
+url=https://gitlab.gnome.org/GNOME/glibmm.git
+revision=master
+depth=1
+
+[provide]
+dependency_names = glibmm-2.68, giomm-2.68
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]