SPM does use pkg-config to determine these extra install flags (https://github.com/apple/swift-package-manager/blob/d58d857c5049a6e0e27896fe9a21f00e42b16527/Sources/SPMUtility/PkgConfig.swift).
From my first glance, I don’t see any easy/obvious ways to extract the extra args from SPM. I’m sure it’s possible in the longer term, maybe by adding some features to SPM. But for a quick fix, I propose that we just run pkg-config ourselves.
There’s another obstacle that I do not know how to add extra include search paths after the kernel starts running. We can work around this by making symlinks from
/tmp/xyzxyzxyz/swift-install/modules to all the necessary header files.
I propose combining all these workarounds into a swift-jupyter feature that you use like this:
%install-location ... %install ... %install-extra-include-command pkg-config --cflags-only-I vips
This feature will run the specified commands, extract the
-I flags from them, and create links from the kernel’s “install location” to all the headers.
This is kinda nasty, but it should work for now.
PR incoming soon…