[swift-evolution] SwiftPM Xcode Integration

David Turnbull dturnbull at gmail.com
Fri Feb 19 12:40:26 CST 2016


It's nice to see progress on the package manager. I manually maintain an
xcodeproj for the SwiftGL project. Here's a couple things in there which
are off the beaten path.

I use GLFW3 for the demos. This is a simple C API for which I made a
modulemap package. Two actually, because the linked libraries differ on
Linux and Mac. So I end up using this:

#if os(Linux)
    package.dependencies.append(
        Package.Dependency.Package(url: "
https://github.com/AE9RB/SwiftCGLFW3Linux.git", majorVersion: 1)
    )
#else
    package.dependencies.append(
        Package.Dependency.Package(url: "
https://github.com/AE9RB/SwiftCGLFW3.git", majorVersion: 1)
    )
#endif

This works just fine from the pm build. But I have to add the /usr/lib and
/usr/include paths to XCode manually.

So that's it I think. Conditionals in Package.swift, and paths for
modulemaps. Hopefully these can be supported in the xcodeproj generator.

It's not clear if we will have to combine all the swift package
dependencies manually in Xcode. That would be unfortunate. I see some web
server libraries coming up and these tend to grow to dozens of dependencies.

-david  https://github.com/AE9RB/SwiftGL


On Fri, Feb 19, 2016 at 9:55 AM, Max Howell via swift-evolution <
swift-evolution at swift.org> wrote:

> One of our goals for the Swift Package Manager is excellent and delightful
> integration with Xcode.
>
> To this end we are going to start work on initial integration by making
> SwiftPM able to generate Xcode project files. This is not the long-term
> design we want for the Xcode integration, but it is a concrete step we can
> take now which will allow Xcode users to adopt Swift packages and use them
> in their products. We expect this to significantly increase the adoption of
> SwiftPM and give us more feedback and experience, which will inform the
> eventual full integration design. This will also enable Swift packages to
> be built for Apple's iOS, Apple TV, and watchOS platforms, in addition to
> OS X.
>
> The code for this will be written in the open as part of the SwiftPM open
> source project and we will begin the feature presently.
>
> We would like to emphasize again that proper and tight integration with
> Xcode is our long-term goal, but in the near-term we consider this a good
> intermediary solution—making real Swift package use possible.
>
> Our design for this feature is as follows:
>
> * Generate a single xcodeproj from the command line for a Package.swift
> * The xcodeproj will contain targets for all packages and their modules
> * Require the user to add this xcodeproj to their main project and link
> the dependency by hand.
>
> In addition to allowing users to adopt Swift packages in their Xcode
> projects through this mechanism, this will allow package authors to use
> Xcode to work on their packages.
>
> We are also considering a feature that auto-regenerates the xcodeproj if
> the user changes their Package.swift or edits any of their package sources,
> though parts of that feature would be built in Xcode and not in the open
> source project. We are aware of the frustrating aspects of other systems
> that generate Xcode projects and will be looking at ways to mitigate the
> problems that come with this solution.
>
> We're looking forward to your feedback on this intermediary solution as it
> evolves!
>
> Max
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160219/f13d69cb/attachment.html>


More information about the swift-evolution mailing list