[swift-build-dev] How to specify system header dependencies
emaloney at gilt.com
Tue Dec 15 00:45:30 CST 2015
Just wanted to give you an update: I was able to declare a stub package for the Apple System Log's C headers and expose them to Swift. I'm happy to report that I'm now able to compile against asl.h successfully and can call the API from Swift.
The package declaration for ASL is here -- perhaps other people might find it helpful:
As you'll notice in the module map, I'm hard-coding the path to a specific version of the Mac OS X SDK:
That's definitely not great in the long-run; do you know if there's a better way to do it?
I would love to help push this tool forward; I was wondering if you or anyone else at Apple could shed some light on what might be in active development with SPM and where you're looking for community involvement?
In particular I'd be interested in looking at adding iOS, tvOS and watchOS support, as I've noticed there doesn't seem to be a way to specify a platform other than OS X, which is built by default.
> On Dec 14, 2015, at 11:37 AM, Evan Maloney <emaloney at gilt.com> wrote:
> Thanks for the tip, Daniel. I'll give that a try.
> Very excited that SPM was included in the Swift release. It's going to solve a real pain point for developers.
>> On Dec 14, 2015, at 11:28 AM, Daniel Dunbar <daniel_dunbar at apple.com> wrote:
>>> On Dec 14, 2015, at 8:15 AM, Evan Maloney via swift-build-dev <swift-build-dev at swift.org> wrote:
>>> I have a project that has a dependency on the asl.h system header.
>>> This header is present on all Apple platforms. When building with Xcode, this dependency is specified in the bridging header, allowing the C API provided by asl.h to be exposed to Swift.
>> For now, the only way to do this is with the "system modules" feature (and a hard coded path): https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md
>>> As far as I can tell, there's no way to specify a bridging header using the Swift Package Manager or to otherwise specify a C API to expose to Swift.
>>> Am I mistaken? Am I just missing something? Or is SPM only intended to be used to build something in "pure Swift"?
>> You are correct, but it isn't about "intention", this is just stuff which isn't supported *yet*.
>> - Daniel
>>> swift-build-dev mailing list
>>> swift-build-dev at swift.org
More information about the swift-build-dev