This would allow to linking of system SDK frameworks
Is this needed?
Would be useful for something like Google Maps where you have to specify a whole list of system SDK's.
Have a look at Google Maps Install Manually
This should be technically possible from your build settings @sbarow. What about adding an extra parameter in the target specification where you specify those frameworks, and generates the BUILD_SETTINGS necessary for doing the linking automatically?
Hey guys,
Is this still not possible? How do you exactly achieve adding SDK dependencies?
@peymankh - You can achieve this by passing configuration settings for your target
i.e.
"OTHER_LDFLAGS" : "$(inherited) -framework Foundation -weak_framework CoreML",
Use -framework for linking a framework
Use -weak_framework for weakly linking a framework
Use -l (example -lc++) to link a dylib
@rahul-malik Thanks, that's great.
Thanks @rahul-malik.
Are there any other edges cases that would require explicit linking to something in the SDK directory? Otherwise I might close this
I think they are fairly uncommon but there are cases where you can specify additional sdk paths in xcconfig
In general, itād be nice to have support for this out of the box. Maybe sdkDependencies attribute?
I think this is an interesting use case for a general design principle here.
Should the spec make it easier to express things that are configurable in xcconfig?
Hey all! Iād like to resurrect this topic, as I prefer to explicitly declare all dependencies but also want a single place for it that other engineers can edit. Without them having to know xcconfig syntax and linker flags š
I think adding another type of key to the regular dependencies array would be a good way to solve this. Doing so would also allow for declaring that the dependency is optional (for deployment to earlier OS versions). In my opinion it should be in the spec as opposed to an xcconfig file. Since thatās where all the other dependencies for a target are defined.
Something like:
targets:
Foo:
dependencies:
- system: UserNotification
optional: true # defaults to false
That should result in:
UserNotification.framework from the SDK directory in the targetās āFrameworksā group.
optional is set to true the āstatusā is changed from Required to Optional.
What do you think @yonaskolb @rahul-malik
Update: The support for optional (uses weak as the key) was implemented by @alvarhansen in https://github.com/yonaskolb/XcodeGen/pull/411 š
Hi @rastersize. Sorry for the late reply. I like that solution, though I would opt for the name sdk rather than system, as it will be using the sdk root path. What do you think?
I've opened an initial PR here https://github.com/yonaskolb/XcodeGen/pull/430
Can you guys have a look.
I decided to go with sdkFramework as you just pass in the framework name.
sdk could be reserved for other things in the sdk root path like libs, which could be referenced by the full path within the sdk root.
I'm still not sure why this is required, because if you're using something like the Contacts framework it should be automatically found when importing
@yonaskolb sdkFramework sounds good to me š
I've finalized on sdk that handles frameworks and libs easily with a simple filename, and can handle anything else in the sdk with a full path (though this shouldn't be required)
targets:
MyApp
dependencies:
- sdk: Contacts.framework
- sdk: libc++.tbd
- sdk: some/random/path/in/sdk/root/file.file
Most helpful comment
@peymankh - You can achieve this by passing configuration settings for your target
i.e.
Use
-frameworkfor linking a frameworkUse
-weak_frameworkfor weakly linking a frameworkUse
-l(example-lc++) to link a dylib