New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new module "sourceset" to match source file lists against configuration data #5028
Conversation
7a43b33
to
e245e10
Compare
227a875
to
098ef9d
Compare
|
@jpakkane I have the impression that you're not convinced. :) If you'd like, I can try and put together an almost-realistic example. You can certainly achieve the same in pure Meson using arrays of dictionaries, not unlike the Foreach with a dictionary example. In this case you'd write something like as a replacement for and then use a
|
761b83e
to
935f082
Compare
|
Now that #5119 is in, I cleaned up |
|
@jpakkane Could you please review at least the concept? It's the only remaining blocker for even considering switching QEMU to Meson. |
|
Sorry, there has been a lot of stuff happening. I'll try to get something done about this tomorrow. |
|
On a general level having a better ("declarative-y") way of getting sources based on external factors like here is something we definitely want. I have gone through this twice now and there are things that need changing but the thing has not yet "clicked" for me to know exactly what it should look like. I'll need to think about this more. In the mean time here are some things that came to mind:
|
It's just a cut-and-paste error in the documentation.
Fair enough. My reasoning is that
It's needed because the configuration data affects both the source files and the dependencies. I'll rename the source files object to "source configuration". |
e7408c6
to
f7f9961
Compare
|
I could not think of things that would obviously break so no point in keeping this blocked. In addition since it is a module, we can just create a new one. There are a few fixes though:
|
|
Since I force pushed, you can use this link to compare the previous version with this one. |
|
The thing that is still sticking out to my eye a bit is the |
|
I'll change it to |
|
Sounds good to me. |
…on 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.
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. However, because there are hundreds of such conditional rules, it's important to keep
meson.buildfiles 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_dataobject, 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 the source set object can be used either directly or via
extract_objects, in order to satisfy both cases—that is, either share object files across targets or keeping them separate. In the real-world case of QEMU we would use two or more source set objects, and then doexecutable(..., sources: ... , objects: ...).