Commit Graph

3 Commits

Author SHA1 Message Date
Marc-André Lureau 8ba1405742 sourceset: add all_dependencies() method
'if_true' sources should be built with their dependencies, as
illustrated by test case change.

Ideally, I think we would want only the files with the dependencies to
be built with the flags, but that would probably change the way
sourceset are used.
2019-08-04 21:44:52 +03:00
Marc-André Lureau 940ebd658b sourceset: fix using FeatureCheck decorators
The feature check facilities need to have access to subproject.
2019-08-04 21:44:52 +03:00
Paolo Bonzini d894c48660 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.
2019-05-22 12:09:09 +02:00