Addition: Example system module as I have it now: https://github.com/Scriptreactor/SwiftCTLS
I'd like to get rid of the absolute path in the module.modulemap's "header" directive and have it instead use pkgConfig values. > On 28 Dec 2016, at 17:12, Etan Kissling via swift-users > <swift-users@swift.org> wrote: > > Hi, > > before Swift 3, for System Modules to work, these steps were necessary: > 1. Creating module map > 2. Creating System Module package > 3. Creating git repo for System Module package, tagging with version > 4. Referencing the System Module package from main package > 5. Adding -Xcc -I and -Xlinker -L flags to the swift build command. > > The problem here is, that absolute system-depending paths are required at: > - module map "header" entry. > - Xcc -I flag when building. > - Xlinker -L flag when building. > > To solve this, Swift 3 introduced support for System Module search paths: > https://github.com/apple/swift-evolution/blob/master/proposals/0063-swiftpm-system-module-search-paths.md > > In my case, I end up with the following for the System Module package: > > module CFoo [system] { > header "/system/depending/path/to/my/header.h" > link "foo" > export * > } > > > import PackageDescription > > let package = Package( > name: "CFoo", > pkgConfig: "foo", > providers: [ > .Brew("foo") > ] > ) > > > With this setup, I can run > PKG_CONFIG_PATH=/system/depending/path/to/my/pc/file swift build > and build the project without specifying custom Xcc -I / Xlinker -L flags. > > However, the absolute system-depending path is still required in the > modulemap. > > When I change the module map to > > module CFoo [system] { > header "header.h" > link "foo" > export * > } > > , I get build errors like > > /module.modulemap:2:##: error: header 'header.h' not found > > This is kind of different than what is suggested by the proposal (that it > should recommend installing via Brew / Apt in that case). > > > ==> How do I need to set up the project so that system-depending paths are > required at no point? > ==> Is there an example project available on github that demonstrates the > pkgConfig feature of SwiftPM? > > > Thanks > > Etan > > > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users