[pangomm] Meson build: Improve internal dependencies
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm] Meson build: Improve internal dependencies
- Date: Mon, 13 Jan 2020 17:25:27 +0000 (UTC)
commit ca568ec8b6f9e49753fb007c1502cd0f81cc1f30
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Mon Jan 13 18:10:15 2020 +0100
Meson build: Improve internal dependencies
* docs/reference/meson.build: Less difference between maintainer-mode and
not maintainer-mode.
* pango/pangomm/meson.build: Make separate lists of built .h files and
built .cc files.
docs/reference/meson.build | 54 +++++++++++++++++++++-------------------------
pango/pangomm/meson.build | 26 ++++++++++++----------
2 files changed, 39 insertions(+), 41 deletions(-)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index ffd535b..4fbb9b9 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -1,7 +1,7 @@
# docs/reference
# Input: built_files_root, project_source_root, pangomm_pcname, perl,
-# hg_ccg_basenames, extra_h_files, built_file_targets, install_datadir,
+# hg_ccg_basenames, extra_h_files, built_h_file_targets, install_datadir,
# dist_cmd, python3
# Output: install_docdir, install_devhelpdir
@@ -83,40 +83,34 @@ src_h_files += project_source_root / 'pango' / 'pangomm.h'
doctool_dir = project_source_root / 'untracked' / 'docs' # MMDOCTOOLDIR
doctool_dist_dir = 'untracked' / 'docs' # Relative to MESON_DIST_ROOT
-if built_file_targets.length() > 0
+doc_h_files = src_h_files
+if built_h_file_targets.length() > 0
# .h files have been generated from .hg files (maintainer mode).
- tag_file = custom_target('html_and_tag',
- input: src_h_files,
- output: book_name + '.tag',
- command: [
- python3, doc_reference, 'doxygen',
- doctool_dir,
- '@OUTPUT@',
- built_h_files,
- '@INPUT@',
- ],
- build_by_default: build_documentation,
- depends: built_file_targets,
- install: true,
- install_dir: install_reference_docdir,
- )
+ # Use built_h_file_targets instead of built_h_files here, or else Meson won't
+ # know that Doxygen must not be executed until the .h files have been built.
+ doc_h_files += built_h_file_targets
else
# All .h files are stored in the source tree (not maintainer mode).
- tag_file = custom_target('html_and_tag',
- input: src_h_files + built_h_files,
- output: book_name + '.tag',
- command: [
- python3, doc_reference, 'doxygen',
- doctool_dir,
- '@OUTPUT@',
- '@INPUT@',
- ],
- build_by_default: build_documentation,
- install: true,
- install_dir: install_reference_docdir,
- )
+ doc_h_files += built_h_files
endif
+# Can't use @INPUT@ in the command. It requires absolute file paths.
+# Paths in built_h_file_targets are relative to project_build_root.
+tag_file = custom_target('html_and_tag',
+ input: doc_h_files,
+ output: book_name + '.tag',
+ command: [
+ python3, doc_reference, 'doxygen',
+ doctool_dir,
+ '@OUTPUT@',
+ src_h_files,
+ built_h_files,
+ ],
+ build_by_default: build_documentation,
+ install: true,
+ install_dir: install_reference_docdir,
+)
+
devhelp_file = custom_target('devhelp',
input: tag_file,
output: book_name + '.devhelp2',
diff --git a/pango/pangomm/meson.build b/pango/pangomm/meson.build
index 4d9d93b..4ca20cb 100644
--- a/pango/pangomm/meson.build
+++ b/pango/pangomm/meson.build
@@ -2,8 +2,8 @@
# Input: pangomm_build_dep, pangomm_pcname, maintainer_mode, project_source_root,
# generate_binding, m4_files, pangomm_libversion, install_includedir,
-# dist_cmd, python3
-# Output: hg_ccg_basenames, extra_h_files, built_file_targets, built_files_root,
+# dist_cmd, python3, pangomm_rc
+# Output: hg_ccg_basenames, extra_h_files, built_h_file_targets, built_files_root,
# pangomm_dep
defs_basefiles = [
@@ -71,6 +71,11 @@ if maintainer_mode
# docs/reference/meson.build needs this.
built_files_root = project_build_root
+ built_h_file_targets = []
+
+ # Force meson+ninja to generate source files before anything is compiled.
+ # Compilation must depend on these targets.
+ built_cc_file_targets = []
hg_files = []
foreach file : hg_ccg_basenames
@@ -78,7 +83,7 @@ if maintainer_mode
endforeach
# Create wrap_init.cc in project_build_root/pango/pangomm.
- wrap_init_target = custom_target('wrap_init.cc',
+ built_cc_file_targets += custom_target('wrap_init.cc',
input: hg_files,
output: 'wrap_init.cc',
command: [
@@ -92,17 +97,13 @@ if maintainer_mode
install: false,
)
- # Force meson+ninja to generate source files before anything is compiled.
- # Compilation must depend on these targets.
- built_file_targets = []
-
# Create .h/_p.h/.cc files from .hg/.ccg files in project_build_root/pango/pangomm.
foreach file : hg_ccg_basenames
hg_file = '..' / 'src' / file + '.hg'
ccg_file = '..' / 'src' / file + '.ccg'
- built_file_targets += custom_target(file + '.cc',
+ built_file_target = custom_target(file + '.cc',
input: [hg_file, ccg_file],
- output: [file + '.stamp', file + '.cc'],
+ output: [file + '.stamp', file + '.cc', file + '.h'],
command: [
python3, generate_binding, 'gmmproc',
gmmproc_dir,
@@ -115,11 +116,13 @@ if maintainer_mode
build_by_default: maintainer_mode,
install: false,
)
+ built_cc_file_targets += built_file_target[1]
+ built_h_file_targets += built_file_target[2]
endforeach
extra_include_dirs = ['..']
pangomm_library = library(pangomm_pcname,
- wrap_init_target, built_file_targets, extra_cc_files,
+ built_cc_file_targets, built_h_file_targets, extra_cc_files,
version: pangomm_libversion,
include_directories: extra_include_dirs,
dependencies: pangomm_build_dep,
@@ -134,8 +137,8 @@ else # not maintainer_mode
# project_source_root/untracked/pango/pangomm.
# docs/reference/meson.build needs these.
- built_file_targets = []
built_files_root = project_source_root / 'untracked'
+ built_h_file_targets = []
# Two cases:
# 1. The source code comes from a tarball, where the built files
@@ -230,6 +233,7 @@ endif
# This is useful in the main project when pangomm is used as a subproject.
# It can also be used if there are example programs and test programs to build.
pangomm_dep = declare_dependency(
+ sources: built_h_file_targets,
link_with: pangomm_library,
include_directories: extra_include_dirs,
dependencies: pangomm_build_dep
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]