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-12687] Let me add package dependencies that use CMake #4555

Open
swift-ci opened this issue Apr 27, 2020 · 5 comments
Open

[SR-12687] Let me add package dependencies that use CMake #4555

swift-ci opened this issue Apr 27, 2020 · 5 comments
Assignees

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-12687
Radar rdar://problem/62895037
Original Reporter mattdipasquale (JIRA User)
Type New Feature
Additional Detail from JIRA
Votes 5
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: a099242e58e51479ea615ca4bd9f1123

Issue Description:

When I try to add a package dependency to my app with the repository URL (eg, https://github.com/signalapp/libsignal-protocol-c.git) of a library that uses CMake to manage its build process, I get the error:

https://github.com/signalapp/libsignal-protocol-c.git has no Package.swift manifest for version 2.3.3

It'd be nice if the Swift Package Manager (SwiftPM) could recognize when a project uses CMake and then use CMake to compile that project.

Possible Solutions

  1. Maybe Xcode could come with CMake, and then SwiftPM could use CMake to build such projects when added as package dependencies. One problem with this approach for the project I used as an example (above) is that its maintainers set (via CMake) the project name to signal-protocol-c, but I don't think that's a valid name for a Swift module. So either SwiftPM could automatically set the module name to SignalProtocolC or allow me to specify a name when adding it as a package dependency. (I'd rather call it SignalProtocol anyway.) [Aside: Does SwiftPM even allow me to set the name of a package dependency? That'd especially be useful to resolve naming collisions, in cases where I wanted to add two or more different package dependencies with the same name.]

  2. Even if I had to install CMake myself and fork the libsignal-protocol-c repository and add a `Package.swift` file to it, it'd still be nice if I could put something in the `Package.swift` file that told SwiftPM to just use CMake to build the package. This would be helpful because I don't want to have to respecify all of the build configurations that are already specified in the project's CMakeLists.txt files.

Related

@beccadax
Copy link
Contributor

beccadax commented May 5, 2020

@swift-ci create

@swift-ci
Copy link
Contributor Author

swift-ci commented May 6, 2020

Comment by Brennan Saeta (JIRA)

This is a great suggestion, and having this feature implemented would be very helpful to the Swift for TensorFlow project (among other projects at Google). Thanks!

@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
@sergeiromanov
Copy link

This is much needed for our project too. We have a cmake c++ project which swift code depends on. Would be great if we could just add cmake project as a dependency to a swift target.

@neonichu
Copy link
Member

I think doing this would be extremely problematic for build correctness and performance. By definition, SwiftPM would not be able to introspect what is happening in a CMake build, leading to poor parallelism and making it impossible to cache build artifacts in any meaningful way.

@sergeiromanov
Copy link

The only way to have cmake in xcode is to build .xcodeproj from it which I did. Is it possible to include it into SwiftPM?

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