Skip to content
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

System dependencies #11

Closed
yonaskolb opened this issue Jul 24, 2017 · 15 comments
Closed

System dependencies #11

yonaskolb opened this issue Jul 24, 2017 · 15 comments

Comments

@yonaskolb
Copy link
Owner

This would allow to linking of system SDK frameworks

@yonaskolb yonaskolb changed the title Support SDK dependencies System dependencies Aug 4, 2017
@yonaskolb
Copy link
Owner Author

Is this needed?

@sbarow
Copy link
Contributor

sbarow commented Aug 18, 2017

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

@pepicrft
Copy link

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?

@TheCoordinator
Copy link
Contributor

Hey guys,

Is this still not possible? How do you exactly achieve adding SDK dependencies?

@rahul-malik
Copy link
Collaborator

@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

@TheCoordinator
Copy link
Contributor

@rahul-malik Thanks, that's great.

@yonaskolb
Copy link
Owner Author

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

@rahul-malik
Copy link
Collaborator

I think they are fairly uncommon but there are cases where you can specify additional sdk paths in xcconfig

@TheCoordinator
Copy link
Contributor

In general, it’d be nice to have support for this out of the box. Maybe sdkDependencies attribute?

@rahul-malik
Copy link
Collaborator

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?

@rastersize
Copy link

rastersize commented Sep 19, 2018

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:

  • Adding a reference to UserNotification.framework from the SDK directory in the target’s “Frameworks” group.
    screen shot 2018-09-19 at 2 26 14 pm
  • Adding the framework to the “Link Binary With Libraries” build phase for the target.
  • If optional is set to true the “status” is changed from Required to Optional.
    screen shot 2018-09-19 at 2 29 19 pm

What do you think @yonaskolb @rahul-malik


Update: The support for optional (uses weak as the key) was implemented by @alvarhansen in #411 🎉

@yonaskolb
Copy link
Owner Author

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?

@yonaskolb
Copy link
Owner Author

yonaskolb commented Nov 2, 2018

I've opened an initial PR here #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

@rastersize
Copy link

@yonaskolb sdkFramework sounds good to me 👍

@yonaskolb
Copy link
Owner Author

yonaskolb commented Nov 4, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants