-
-
Notifications
You must be signed in to change notification settings - Fork 236
Add ability to specify frameworks to link against #3061
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
Conversation
✅ PR OK, no changes in deprecations or warnings Total deprecations: 0 Total warnings: 0 Build statistics: statistics (-before, +after)
-executable size=5249272 bin/dub
-rough build time=61s
+executable size=5261560 bin/dub
+rough build time=59s Full build output
|
I would suggest changing this to Given that this is limited to Apple platforms anyway, it prevents us from using that directive for things that may be D-specific in the future. Which may be necessary for PhobosV3. |
Not limited to apple platforms; limited to ones that use mach-o, or which support mach-o. |
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.
tests?
Added some rudementary tests into the existing unit tests for parsing; but I should probably also add a macOS specific test that tries to link to foundation or something. |
Failed test is unrelated to the PR, fetchzip apparently had a stroke in that run |
@thewilsonator added unit test passes; linking to Foundation.framework successfully. |
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.
Looks good to me - definitely nice to have, also because it avoids duplicate framework arguments when multiple dependencies specify the same framework.
Should also be listed in https://github.com/dlang/dub-docs/blob/master/docs/dub-reference/build_settings.md
@LunaTheFoxgirl is the |
Yes, it is linking given that it's using a symbol that needs to be resolved whether or not it's an executable. That being said the config should ensure it's compiled as an executable; but only on Darwin targets. Is no-op if targeting anything else. |
You can "use" a symbol at compile time and have it be unresolved. It will fail at link time. I am asking specifically because I can |
In my experience that is behavior exclusive to Linux. Has never happened to me on macOS or Windows. I think the object file structure of macOS and Windows more or less requires linking to be done or weak be applied before such behavior presents itself for those. As mach-o objects themselves store library reference data. And same with PE/COFF objects, if I understand that spec correctly. Also in my local testing an executable mach-o file was created. |
That being said; being more clear by adding targetType would be a good idea. Should be done in a separate PR though since this one's already merged. |
Something here appears to be miscommunicated. You can use any symbol that you want to as far as the D compiler is concerned. Linkers do most of symbol resolution, but not all. Usually you must communicate to the linker which binary includes a given symbol if its not found within the object files you passed to it. Loaders will do the final symbol resolution. The only way to know for certain that a symbol has been resolved is to use it. Anything other than this can have it be ignored. |
This pull-request adds a new configuration variable called
frameworks
as an analogue tolibs
; which allows specifying which frameworks to link against.Frameworks are semantically different from dylibs/shared objects, as such
libs
is not really able to provide this functionality.The
frameworks
directive is ignored on non-darwin systems.