-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Remove unnecessary checks when exporting gdextension binaries and allow using a prefix to auto-detect files #67906
Remove unnecessary checks when exporting gdextension binaries and allow using a prefix to auto-detect files #67906
Conversation
ae8fe75
to
9462e41
Compare
9462e41
to
447779e
Compare
66638a4
to
5c5c042
Compare
5c5c042
to
37d9a8d
Compare
Actually
But using the master branch (68e3f49) with this PR (there was one conflict with error printing) breaks how tags are selected.
Part of the actual config:
If I replace |
Oops, misclicked.
If you have a look to the
I think the error is expected. The logic is that all tags in If you did not mess your rebase, I think the fact exporting was working before may be due to the wrong code that was using |
37d9a8d
to
e4624a9
Compare
Yes, I've seen it. Unfortunately, dependencies probably don't work in beta6, but at least you can export with these lines.
Now we have In addition, the same format is used in the example: https://github.com/godotengine/godot-cpp/blob/576bd172851932ba3db95fda8760b4f297c89efd/test/demo/example.gdextension But according to the logic of Maybe it's just worth improving the handling of |
#include "core/extension/gdnative_interface.h" | ||
#include "core/io/config_file.h" |
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.
Could possibly be forward declared? Not very important though.
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.
Approved in PR review meeting. Needs the "standalone" feature back, but renamed as "template".
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.
Approved in GDExtension PR meeting.
We discussed that the standalone
feature defined for both types of templates should likely still be kept, but likely renamed template
(so e.g. on a template_debug build you have both template_debug
and template
defined).
Yeah that sounds good. But here's a potential problem:
Which one should be chosen? Should it raise an error? We might need something a bit more advanced than just OS features for this if we want to differentiate between the best match and other suitable matches. |
If you only have neither "debug" or "editor", then yeah, it should fail. All tags in the identifier should be in the provided feature list for it to be selected. This is what the current behavior already implement. The only problem is that in only matches the first match right now, while I think the "most precise" should likely be selected instead. |
Yeah but my question is: Which one will be considered the "most precise" for an editor build between |
Ah ok, you mean if both are present! Then I guess the first one will do, just like it is right now ? I can't think of a better way to solve it, unless we start to implement some sort of feature tags priority or something like that. But I think it would be too complex for little gain. |
e4624a9
to
fa4143c
Compare
Alright, I updated the PR. I tested the algorithm for libraries and it seems to work as expected. |
Just checked the latest build and found a couple of problems. v4.0.beta.custom_build [181687847] First I launched the editor without changing the tags in [configuration]
entry_symbol = "godot_qoi_library_init"
[libraries]
windows.debug.x86_64 = "libs/win/godot_qoi.windows.editor.x86_64.dll"
windows.release.x86_64 = "libs/win/godot_qoi.windows.template_release.x86_64.dll" But when exporting, there was an error related to the formatting of the error string
Next I added windows.template_debug.x86_64 = "libs/win/godot_qoi.windows.editor.x86_64.dll"
windows.template_release.x86_64 = "libs/win/godot_qoi.windows.template_release.x86_64.dll" But after that, the editor can't find the right library, and I had to explicitly specify another line with [configuration]
entry_symbol = "godot_qoi_library_init"
[libraries]
windows.editor.x86_64 = "libs/win/godot_qoi.windows.editor.x86_64.dll"
windows.template_debug.x86_64 = "libs/win/godot_qoi.windows.editor.x86_64.dll"
windows.template_release.x86_64 = "libs/win/godot_qoi.windows.template_release.x86_64.dll" To check [configuration]
entry_symbol = "godot_qoi_library_init"
autodetect_library_prefix = "res://addons/qoi/libs/"
[libraries]
windows.editor.x86_64 = "win/godot_qoi.windows.editor.x86_64.dll"
windows.template_debug.x86_64 = "win/godot_qoi.windows.editor.x86_64.dll"
windows.template_release.x86_64 = "win/godot_qoi.windows.template_release.x86_64.dll"
But the editor and the project export could not find these libraries. It looks like
Even using completely wrong paths like
I also tried adding [configuration]
entry_symbol = "godot_qoi_library_init"
[dependencies]
windows.template_debug.x86_64 = ["res://icon.svg", "res://shared_object.dll"]
windows.template_release.x86_64 = ["res://icon.svg", "res://shared_object.dll"]
[libraries]
windows.editor.x86_64 = "libs/win/godot_qoi.windows.editor.x86_64.dll"
windows.template_debug.x86_64 = "libs/win/godot_qoi.windows.editor.x86_64.dll"
windows.template_release.x86_64 = "libs/win/godot_qoi.windows.template_release.x86_64.dll" |
That's weird, but I don't think it's a related to this PR. It might be worth opening a dedicated issue.
Technically, you don't need to, this should work:
The algorithm should now select the most precise line out of the two, when all fits. Otherwise it will fall back to the first line.
The prefix should include also the files prefix. A prefix is not a path to a folder, it MUST include the part of the file that does not consist of acceptable tags. Your library prefix should then be:
This is provided you put all library files in the exact same folder. You should not use subfolders there. |
It looks like this error appeared after #68271.
Yeah cool! I completely forgot about this option.
The whole file can now look like this: [configuration]
entry_symbol = "godot_qoi_library_init"
autodetect_library_prefix = "res://addons/qoi/libs/libgodot_qoi" Now I understand how it works. Looks useful. What about |
I don't know. maybe try to open an issue with a MRP maybe. This was not really the original goal of this PR, so it might deserve another one. |
Thanks. I'll open new issues if needed. |
Thanks! |
I think dependencies are expected to be in a
|
@bruvzg Yes, it requires a [dependencies]
windows.x86_64 = {
"res://icon.svg" : "Content/",
"res://test.gd" : "",
"README.md" : "",
}
# "README.md" is a relative path to .gdextension This is what the folder looks like after exporting Thanks for the tip! |
bool dvalid = exists_export_template(get_template_file_name("template_debug", arch), &err); | ||
bool rvalid = exists_export_template(get_template_file_name("template_release", arch), &err); |
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.
This broke looking up the templates. Is that needed for GDExtension or was just a search-and-replace mistake?
Closes #63230
May help with #53958, if it's not fixed already. I don't know.
This is something we discussed with @bruvzg and @Faless, it does three things:
autodetect_library_prefix
that allows automatically finding files matching the given export features. The logic simply search for the file with the higher number of matching tags.[dependencies]
section in the.gdextension
config file not being processed at all.Also, to avoid duplicated code between the exporter and the loader, I refactored the code to have a single function looking for the library file.