[pangomm/pangomm-2-46] Meson build: Make it possible to use pangomm as a subproject
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/pangomm-2-46] Meson build: Make it possible to use pangomm as a subproject
- Date: Fri, 26 Mar 2021 15:04:50 +0000 (UTC)
commit 54387c35f61f39de7db8f03bff1f36170f268406
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Mar 26 16:02:57 2021 +0100
Meson build: Make it possible to use pangomm as a subproject
pango, cairomm and glibmm can be subprojects of pangomm.
Makefile.am | 3 +++
docs/reference/meson.build | 8 ++++----
meson.build | 19 +++++++++++++++++--
pango/pangomm/meson.build | 9 ++++++---
subprojects/cairomm-1.0.wrap | 8 ++++++++
subprojects/glibmm-2.4.wrap | 8 ++++++++
subprojects/pango.wrap | 8 ++++++++
tools/extra_defs_gen/meson.build | 8 +++++++-
8 files changed, 61 insertions(+), 10 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index f6b6551..de78fa5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,6 +57,9 @@ EXTRA_DIST = \
pango/meson.build \
pango/pangomm/meson.build \
pango/pangommconfig.h.meson \
+ subprojects/cairomm-1.0.wrap \
+ subprojects/glibmm-2.4.wrap \
+ subprojects/pango.wrap \
tools/dummy-header.py \
tools/extra_defs_gen/meson.build \
untracked/README
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index f62bb5b..7f7cc5f 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -3,7 +3,7 @@
# Input: built_files_root, project_source_root, pangomm_pcname, python3,
# hg_ccg_basenames, extra_h_files, built_h_file_targets, install_datadir,
# doc_reference_py
-# Output: install_docdir, install_devhelpdir
+# Output: install_docdir, install_devhelpdir, tag_file
tag_file_modules = [
'mm-common-libstdc++',
@@ -16,9 +16,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 8ad4c6d..4d1d330 100644
--- a/meson.build
+++ b/meson.build
@@ -6,7 +6,8 @@ project('pangomm', 'cpp',
default_options: [
'cpp_std=c++11'
],
- meson_version: '>= 0.50.0', # required for python3.path()
+ meson_version: '>= 0.54.0', # required for meson.override_dependency()
+ # and dep.get_variable(internal:)
)
pangomm_api_version = '1.4'
@@ -110,7 +111,7 @@ cairomm_dep = dependency('cairomm-1.@0@'.format(cairomm_req_minor_ver), version:
glibmm_dep = dependency('glibmm-2.@0@'.format(glibmm_req_minor_ver), version: glibmm_req)
# 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')
if is_msvc
# Check later whether we compile pangomm without using gendef
@@ -271,6 +272,20 @@ if not meson.is_subproject()
project_source_root,
'untracked' / 'build_scripts',
)
+else
+ # This is a subproject.
+ pangomm_dep = declare_dependency(
+ dependencies: pangomm_own_dep,
+ variables: {
+ 'gmmprocm4dir': project_source_root / 'tools' / '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 pangomm_pcname.pc shall find pangomm_dep.
+ meson.override_dependency(pangomm_pcname, pangomm_dep)
endif
# Print a summary.
diff --git a/pango/pangomm/meson.build b/pango/pangomm/meson.build
index 521ef69..299748c 100644
--- a/pango/pangomm/meson.build
+++ b/pango/pangomm/meson.build
@@ -5,7 +5,7 @@
# python3, pangomm_rc, dummy_header_py, gmmproc_dir, build_shared_libs_directly,
# msvc14x_toolset_ver, macos_darwin_versions
# Output: hg_ccg_basenames, extra_h_files, built_h_file_targets, built_files_root,
-# pangomm_dep
+# pangomm_own_dep
defs_basefiles = [
'pango.defs',
@@ -205,6 +205,7 @@ pangomm_libname = meson.project_name() + msvc14x_toolset_ver + '-' + pangomm_api
if build_shared_libs_directly
pangomm_library = library(pangomm_libname, extra_pangomm_objects,
pango_gen_sources, built_dummy_h_file_target, extra_cc_files,
+ implicit_include_directories: false,
include_directories: extra_include_dirs,
cpp_args: pangomm_cpp_args,
version: pangomm_libversion,
@@ -219,6 +220,7 @@ else
# needed for obtaining the .lib file for the pangomm DLL
pango_int_lib = static_library('pangomm-int',
pango_gen_sources, built_dummy_h_file_target, extra_cc_files,
+ implicit_include_directories: false,
include_directories: extra_include_dirs,
cpp_args: pangomm_cpp_args,
dependencies: pangomm_build_dep,
@@ -242,6 +244,7 @@ else
objects: pango_int_lib.extract_all_objects(),
version: pangomm_libversion,
darwin_versions: macos_darwin_versions,
+ implicit_include_directories: false,
dependencies: pangomm_build_dep,
link_depends: pangomm_def,
link_args: pangomm_extra_link_args,
@@ -268,9 +271,9 @@ if not meson.is_subproject()
)
endif
-# This is useful in the main project when pangomm is used as a subproject.
+# This is part of pangomm_dep, when pangomm is a subproject.
# It can also be used if there are example programs and test programs to build.
-pangomm_dep = declare_dependency(
+pangomm_own_dep = declare_dependency(
sources: built_h_file_targets,
link_with: pangomm_library,
include_directories: extra_include_dirs,
diff --git a/subprojects/cairomm-1.0.wrap b/subprojects/cairomm-1.0.wrap
new file mode 100644
index 0000000..7210ecf
--- /dev/null
+++ b/subprojects/cairomm-1.0.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+directory=cairomm-1.0
+url=https://gitlab.freedesktop.org/cairo/cairomm.git
+revision=cairomm-1-14
+depth=1
+
+[provide]
+dependency_names = cairomm-1.0
diff --git a/subprojects/glibmm-2.4.wrap b/subprojects/glibmm-2.4.wrap
new file mode 100644
index 0000000..a7f7855
--- /dev/null
+++ b/subprojects/glibmm-2.4.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+directory=glibmm-2.4
+url=https://gitlab.gnome.org/GNOME/glibmm.git
+revision=glibmm-2-66
+depth=1
+
+[provide]
+dependency_names = glibmm-2.4, giomm-2.4
diff --git a/subprojects/pango.wrap b/subprojects/pango.wrap
new file mode 100644
index 0000000..d90d791
--- /dev/null
+++ b/subprojects/pango.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+directory=pango
+url=https://gitlab.gnome.org/GNOME/pango.git
+revision=master
+depth=1
+
+[provide]
+dependency_names = pango, pangocairo
diff --git a/tools/extra_defs_gen/meson.build b/tools/extra_defs_gen/meson.build
index 57b0349..60bf547 100644
--- a/tools/extra_defs_gen/meson.build
+++ b/tools/extra_defs_gen/meson.build
@@ -1,12 +1,18 @@
# tools/extra_defs_gen
# Input: cpp_compiler, pangomm_build_dep, install_libdir, pangomm_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.4'.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.4', 'glibmm_generate_extra_defs_dep'],
+ )
+endif
executable('generate_extra_defs', 'generate_defs_pango.cc',
dependencies: [pangomm_build_dep, glibmm_generate_extra_defs_dep],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]