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

[SR-3832] SwiftPM: Support binary dependencies #5117

Open
swift-ci opened this issue Feb 2, 2017 · 0 comments
Open

[SR-3832] SwiftPM: Support binary dependencies #5117

swift-ci opened this issue Feb 2, 2017 · 0 comments

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Feb 2, 2017

Previous ID SR-3832
Radar None
Original Reporter Reitzig (JIRA User)
Type New Feature
Additional Detail from JIRA
Votes 4
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: 8aed5d0a92f99204c3931feab8c5a00d

Issue Description:

Currently, there is no (good/simple) way to have a SwiftPM Package depend on a binary library that is not a system library.

See here for an MWE.
A partial workaround was proposed in Slack.

Use case: use a custom-built cryptography library; ship it as part of the developed application or library.

I'm admittedly mostly naive in the issues of native compilation, but the way I understand it, the current workflow (system libraries aside) is

  1. build the dependency package and
  2. put the resulting .dylib in .build/debug to link against.

This should be easy to replace by

  1. copy the dependency library into .build/debug to link against.

From what I can tell, replacing the current command <name.dylib> (which recursively compiles the library to create .build/debug/libname.dylib) with the following should already be enough:

"<name.dylib>":
    tool: shell
    description: "Linking name"
    inputs: ["/path/to/dependency/my.dylib"]
    outputs: ["/path/to/package/.build/debug/libname.dylib", "<name.dylib>"]
    args: ["cp", "/path/to/dependency/my.dylib", "/path/to/package/.build/debug/libname.dylib"]

On the frontend, SwiftPM would have a Dependency protocol which the current Package and a new Binary(library: String, header: String, ...?) would implement; Package.dependencies would then be of type Array<Dependency> (instead of Array<Package>).

Relates to SR-648 and SR-2048.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
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

2 participants