[mm-common] skeletonmm Meson build: Improve internal dependencies
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mm-common] skeletonmm Meson build: Improve internal dependencies
- Date: Mon, 13 Jan 2020 17:50:38 +0000 (UTC)
commit d9533d4e5fde228b985ac15764241fb76d231713
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Mon Jan 13 18:48:50 2020 +0100
skeletonmm Meson build: Improve internal dependencies
* skeletonmm/doc/reference/meson.build: Less difference between
maintainer-mode and not maintainer-mode.
* keletonmm/skeleton/skeletonmm/meson.build: Make separate lists of
built .h files and built .cc files.
skeletonmm/doc/reference/meson.build | 54 +++++++++++++-----------------
skeletonmm/skeleton/skeletonmm/meson.build | 24 +++++++------
2 files changed, 38 insertions(+), 40 deletions(-)
---
diff --git a/skeletonmm/doc/reference/meson.build b/skeletonmm/doc/reference/meson.build
index 7344252..1ff7194 100644
--- a/skeletonmm/doc/reference/meson.build
+++ b/skeletonmm/doc/reference/meson.build
@@ -1,7 +1,7 @@
# doc/reference
# Input: built_files_root, project_source_root, skeletonmm_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
@@ -81,40 +81,34 @@ src_h_files += project_source_root / 'skeleton' / 'skeletonmm.h'
doctool_dir = project_source_root / 'untracked' / 'doc' # MMDOCTOOLDIR
doctool_dist_dir = 'untracked' / 'doc' # 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/skeletonmm/skeleton/skeletonmm/meson.build b/skeletonmm/skeleton/skeletonmm/meson.build
index ae36c58..89e9373 100644
--- a/skeletonmm/skeleton/skeletonmm/meson.build
+++ b/skeletonmm/skeleton/skeletonmm/meson.build
@@ -3,7 +3,7 @@
# Input: skeletonmm_build_dep, skeletonmm_pcname, maintainer_mode, project_source_root,
# generate_binding, m4_files, skeletonmm_libversion, install_includedir,
# dist_cmd, python3
-# Output: hg_ccg_basenames, extra_h_files, built_file_targets, built_files_root,
+# Output: hg_ccg_basenames, extra_h_files, built_h_file_targets, built_files_root,
# skeletonmm_dep
defs_basefiles = [
@@ -43,6 +43,11 @@ if maintainer_mode
# doc/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
@@ -50,7 +55,7 @@ if maintainer_mode
endforeach
# Create wrap_init.cc in project_build_root/skeleton/skeletonmm.
- 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: [
@@ -64,17 +69,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/skeleton/skeletonmm.
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,
@@ -87,11 +88,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 = ['..']
skeletonmm_library = library(skeletonmm_pcname,
- wrap_init_target, built_file_targets, extra_cc_files,
+ built_cc_file_targets, built_h_file_targets, extra_cc_files,
version: skeletonmm_libversion,
include_directories: extra_include_dirs,
dependencies: skeletonmm_build_dep,
@@ -106,8 +109,8 @@ else # not maintainer_mode
# project_source_root/untracked/skeleton/skeletonmm.
# doc/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
@@ -166,6 +169,7 @@ endif
# This is useful in the main project when skeletonmm is used as a subproject.
# It's also used when building example programs and test programs.
skeletonmm_dep = declare_dependency(
+ sources: built_h_file_targets,
link_with: skeletonmm_library,
include_directories: extra_include_dirs,
dependencies: skeletonmm_build_dep
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]