[swift-users] Swift Package Manager – system-module and code

Andrey Fidrya af at zabiyaka.com
Sun Jul 24 11:12:21 CDT 2016

It's possible to declare multiple submodules in Package.swift. For example:

import PackageDescription

let package = Package(
    name: "SQLite.swift",
    targets: [
            name: "SQLite",
            dependencies: [
                .Target(name: "CSQLite")
            name: "CSQLite")

Sources/CSQLite/ contains sqlite3.c, module.map etc
Source/SQLite/ - contains Swift code.


> On 15 Jul 2016, at 20:56, Omri Mor via swift-users <swift-users at swift.org> wrote:
> I’m trying to link some Swift code a C library. I have generated a Swift package for the library, but the library cannot be directly used from Swift – it relies on some complex macros that cannot be imported.
> I’ve created C code and header files that replace these macros with variables and functions (where applicable). I’d like to be able to have this code within the package for the library and have the C code be compiled so that Swift code is linked with both it and the library.
> I think I can have the C code be in a different package and have the library package depend on it, but I’d prefer to avoid that – using the library from Swift is impossible without the C bridge, so it should be part of the same package.
> Is this possible?
> Thanks,
> Omri Mor
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160724/6d939f75/attachment.html>

More information about the swift-users mailing list