I want to build a Swift library package that uses modified build of OpenSSL and Curl.
I have already statically compiled both and verified I can use them in an Objective-C framework on my target platform (iOS & iOS Simulator). I'm using XCFramework files that contain the static library binaries and headers:
openssl.xcframework/
ios-arm64/
openssl.framework/
Headers/
[...]
openssl
ios-arm64_x86_64-simulator/
openssl.framework/
Headers/
[...]
openssl
Info.plist
I'm not sure how I'm supposed to set up my Swift package to import these libraries.
I can use .systemLibrary
but that seems to use the embedded copies of libssl and libcurl on my system, and I can't figure out how to use the path:
parameter to that.
I also tried using a .binaryTarget
pointing to the XCFramework files, but that didn't seem to work as there is no module generated and I'm not sure how to make one myself.
At a basic high level, this is what I'm trying to accomplish:
where libcrypto
& libssl
come from the provided openssl.xcframework
file, and libcurl
from curl.xcframework
Thank you so much, Quinn! I genuinely owe you for how often you unblock my from complicated issues :)
I agree that it would be best to let Xcode do the heavy lifting, and perhaps I will investigate that in the future - for now, since I already have a build pipeline set up for OpenSSL and Curl, I went with your suggestion of looking at what Xcode does and making a similar structure.
I can confirm that once I defined the module map within the platform-specific frameworks I can now use the libraries in Swift, both a Swift framework and a Swift package.