Hi Quinn, let me elaborate.
When using a binary target, my Package.swift file looks like:
/Package.swift:
// swift-tools-version: 5.10
import PackageDescription
let package = Package(
name: "MyLibrary",
products: [
.library(
name: "MyLibrary",
targets: ["MyLibrary"]),
],
targets: [
.target(
name: "MyLibrary",
dependencies: ["OpenSSL", "Curl"]
),
.binaryTarget(name: "OpenSSL", path: "openssl.xcframework"),
.binaryTarget(name: "Curl", path: "curl.xcframework"),
.testTarget(
name: "MyLibraryTests",
dependencies: ["MyLibrary"]),
]
)
When I try to import either OpenSSL or Curl within any source files for MyLibrary it can't find those modules, for example:
/Sources/MyLibrary/Versions.swift:
import Foundation
import OpenSSL // No such module 'OpenSSL'
import Curl // No such module 'Curl'
public final class Versions {
public static func openssl() -> String {
return OPENSSL_VERSION_STR
}
public static func curl() -> String {
return LIBCURL_VERSION
}
}
I'm assuming that I need to define a module map file, but that doesn't seem to have any effect. If I create a module map for OpenSSL:
Sources/MyLibrary/openssl.modulemap:
module OpenSSL [system] {
header "opensslv.h"
link "ssl"
link "crypto"
export *
}
It doesn't seem to do anything, as I get the same error as above. In fact, I'm not even sure this file is being used at all, as if I fill it with gibberish, I don't get an expected syntax error.