aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-03-06 14:41:00 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-05-22 12:09:09 +0200
commitd894c48660a573f257f76fe075e512415fdd0f91 (patch)
treeb077999723cc6724c4ab141334af0cb00577ba91 /docs/markdown/snippets
parente9bd7d49bdc8c630cca3bf4cc02c437841b6aaf6 (diff)
downloadmeson-d894c48660a573f257f76fe075e512415fdd0f91.zip
meson-d894c48660a573f257f76fe075e512415fdd0f91.tar.gz
meson-d894c48660a573f257f76fe075e512415fdd0f91.tar.bz2
new module "sourceset" to match source file lists against configuration data
In QEMU a single set of source files is built against many different configurations in order to generate many executable. Each executable includes a different but overlapping subset of the source files; some of the files are compiled separately for each output, others are compiled just once. Using Makefiles, this is achieved with a complicated mechanism involving a combination of non-recursive and recursive make; Meson can do better, but because there are hundreds of such conditional rules, it's important to keep meson.build files brief and easy to follow. Therefore, this commit adds a new module to satisfy this use case while preserving Meson's declarative nature. Configurations are mapped to a configuration_data object, and a new "source set" object is used to store all the rules, and then retrieve the desired set of sources together with their dependencies. The test case shows how extract_objects can be used to satisfy both cases, i.e. when the object files are shared across targets and when they have to be separate. In the real-world case, a project would use two source set objects for the two cases and then do "executable(..., sources: ... , objects: ...)". The next commit adds such an example.
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/sourceset.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/markdown/snippets/sourceset.md b/docs/markdown/snippets/sourceset.md
new file mode 100644
index 0000000..7c09eb5
--- /dev/null
+++ b/docs/markdown/snippets/sourceset.md
@@ -0,0 +1,8 @@
+## New `sourceset` module
+
+A new module, `sourceset`, was added to help building many binaries
+from the same source files. Source sets associate source files and
+dependencies to keys in a `configuration_data` object or a dictionary;
+they then take multiple `configuration_data` objects or dictionaries,
+and compute the set of source files and dependencies for each of those
+configurations.