-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow link_depends to take strings, Files or generated objects. Close… #1651
Conversation
This doesn't seem to work for custom targets. I'm using this as my test: aaronp24/libglvnd@809c011 The rules in question are these:
I added some tracing to process_link_depends to print out the entries here, and this thing is a CustomTargetHolder with a CustomTarget that apparently has a get_generated_sources, but where s.get_generated_sources() returns []. So it doesn't complain, but it also doesn't create a dependency on the linker script. |
You're right. |
cca6c94
to
b6d180a
Compare
Still doesn't work. This sticks g_opengl_exports.sym into the dependency list, which somehow turns into /home/aaron/git/libglvnd/src/OpenGL/g_opengl_exports.sym in build.ninja. But the generated file is /tmp/b/src/generate/g_opengl_exports.sym |
yup. I just noticed that. unclean build working, clean build not so much. I think what I really want to do is add a link_script keyword argument, like the |
b6d180a
to
8ee972d
Compare
@aaronp24 I think this version should work for you. I'll see about adding an extra kwarg to make this even easier. |
f1a544d
to
e648ead
Compare
Nope. That creates a dependency on src/OpenGL/g_opengl_exports.sym, but the generated file is in src/generate/g_opengl_exports.sym:
I could probably work around that somehow, by moving files around, I guess, but it seems confusing. |
No, this should happen transparently. I'll poke at it some more after lunch. |
e648ead
to
cadcff3
Compare
Okay, it was a really trivial bug on my part. I've tested glvnd with this version of the patch, and it works (I do have a very small glvnd patch. |
Thanks, that seems to work! The libglvnd thing is just an experiment in progress, so I'm definitely open to suggestions. |
I figured. I'm trying to port mesa ATM, so having GLVND ported to meson too would be pretty nifty. |
This message is posted to every outstanding merge request. We have transitioned from Github wiki to our new documentation system that generates all documentation directly from the Git repo. This means that from now on every merge request must come with corresponding documentation changes. If your MR requires documentation changes, do the necessary changes to files in If your MR adds a new feature, add a description to the release notes in If this commit is just a bugfix with no functional changes, you don't need to do anything. Thank you |
Traditionally Meson's implementation has been a mix of File objects and strings. We are trying to move closer to the case where all entries that are files (whether source or generated) are only stored in File objects. This means converting strings to Files as soon as possible and only going back to strings when serializing in the backend. See for example #1706. Having dependencies as strings rather than objects makes many things needlessly complicated (a fair amount of the terribleness of
|
cadcff3
to
72fb966
Compare
mesonbuild/build.py
Outdated
elif isinstance(s, str): | ||
self.link_depends.append( | ||
File.from_source_file(environment.source_dir, self.subdir, s)) | ||
# os.path.join(environment.source_dir, self.subdir, s)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8]
- [E116] unexpected indentation (comment)
mesonbuild/build.py
Outdated
elif hasattr(s, 'get_outputs'): | ||
self.link_depends.extend( | ||
[File.from_built_file(s.subdir, p) for p in s.get_outputs()]) | ||
# [os.path.join(s.subdir, p) for p in s.get_outputs()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8]
- [E116] unexpected indentation (comment)
72fb966
to
6309ffb
Compare
Updated |
No VS backend changes appear to be necessary. Anything else I should change, or is this ready to merge? |
return t.relative_name() | ||
else: | ||
return t.absolute_path(self.environment.get_source_dir(), | ||
self.environment.get_build_dir()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an else that throws unreachable code exception here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to the if t.isbuilt
if, or the outer one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The outer one. If there is an item that is neither of the tested things, it is silently discarded. That is not good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gets passed to self.get_target_filename()
if it isn't handled in that if block, which is what it did before my patch. Is that not correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, got cross-eyed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, happens to me all the time.
mesonbuild/build.py
Outdated
|
||
This is designed to handle strings, Files, and the output of Custom | ||
Targets. Notably it doesn't handle generator() returned objects. Since | ||
adding them as a link depends would inherently cuase them to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cuase -> cause
2d4484f
to
fb251bf
Compare
…mesonbuild#1172 Currently only strings can be passed to the link_depends argument of executable and *library, which solves many cases, but not every one. This patch allows generated sources and Files to be passed as well. On the implementation side, it uses a helper method to keep the more complex logic separated from the __init__ method. This also requires that Targets set their link_depends paths as Files, and the backend is responsible for converting to strings when it wants them. This adds tests for the following cases: - Using a file in a subdir - Using a configure_file as an input - Using a custom_target as an input It does not support using a generator as an input, since currently that would require calling the generator twice, once for the -Wl argument, and once for the link_depends. Also updates the docs.
fb251bf
to
dd648d4
Compare
Is there anything missing for this to land? |
This seems to be because VS backend has always been ignoring link_depends. Of course, now that may contain generated files, this is a problem, see #1799 |
…s #1172
Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.
On the implementation side, it uses a helper method to keep the more
complex logic separated from the init method.