Closed thebluepotato closed 4 years ago
Thanks, would be good to link the SPM issue here as well
We will have to wait and see if later version of Xcode can fix this issue
This is actually a correct behaviour. According to the documentation (https://developer.apple.com/documentation/swift_packages/csetting/3112666-headersearchpath) it is supposed to be only internal directory, not pointing outside:
Use this setting to add a search path for headers within your target. You can’t use absolute paths and you can’t use this setting to provide headers that are visible to other targets. The path must be a directory inside the package.
So I'm afraid you'll have to find a different way...
@algi Yeah, I found another way )) I put source code to Third-party folder in my project, and now I happy :) My project now faster neither when I use swift-soup :)
@iDevPro would you mind saying a bit more on how you solve the problem? Did you mean that you copied Fuzi's source code or copied libxml2 source code to your project?
Btw, I'm not sure what you meant by My project now faster neither when I use swift-soup :)
, do you mean Fuzi is faster or is slower? I never used swift-soup before, but I'm interested to know about it.
@cezheng Sorry for being a bit silent these past months, I was enjoying my summer :) I'm currently hacking around at a solution which currently builds under iOS, but I still have to test integrating into a project. Stay tuned
Response from the Swift team:
Unfortunately there is no way to properly reference libxml2 in a Swift package, but we are aware of this issue.
I am afraid the only workaround right now is copying and patching the libxml headers but that might cause other issues if your copy of headers get out-of-sync with the ones in SDK :(
https://forums.swift.org/t/referring-to-libxml2-in-swift-package-description/28880
FYI, others have the exact same issue: https://forums.swift.org/t/dependency-only-for-linux/28515/
From the Xcode 11.4 beta release notes:
You can import libxml2, libxslt, and libexslt modules in both Swift package targets and regular Xcode targets, without any additional search paths. (52043828)
So it seems SPM support for Fuzi should now be possible (but I didn't try it out yet)
See #101
Reading up on PackageDescription, the
.headerSearchPath
has to be relative and not absolute, but it wasn't really enforced before Xcode 11 beta 4, which allowed us to use$(SDKROOT)/usr/include/libxml2
to point to the correctlibxml2
headers. Another issue seems to be that I can't get Xcode to read the.unsafeFlags
which would allow to at least build the Package (but not distribute it). I'll open an issue in SPM as well.