Hi,
I started to use xcode 11 and I'm really impressed by the new feature Swift Package Manger I really like it and move some of my project with it.
One of my framework is a a Swift wrapper around c++ libraries. Theses libraries are static libraries and I cannot change it.
I'm trying to configure the Package.swift but I didn't have any success.
I create 2 targets one with all the c++ and objective-c++ files and one other with the Swift file.
My package looks like this:
// swift-tools-version:5.1
import PackageDescription
let package = Package(
name: "MyFrameworkSDK",
platforms: [.iOS(.v9)],
products: [
.library(
name: "MyFrameworkSDK",
targets: ["MyFrameworkSDK"]
),
],
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire", from: "4.9.0"),
.package(url: "https://github.com/realm/realm-cocoa", from: "3.19.0"),
.package(url: "https://github.com/SwiftyJSON/SwiftyJSON", from: "5.0.0")
],
targets: [
.target(
name: "CPP",
path: "Sources/CPP",
cxxSettings: [
.headerSearchPath("signalProcessingSDK/include/SignalProcessing"),
.headerSearchPath("signalProcessingSDK/include/MyCPPSDK"),
.headerSearchPath("signalProcessingSDK/include"),
.headerSearchPath("CPPSignalProcessing/Codebridge"), // objective-c++ bridge
.headerSearchPath("CPPSignalProcessing/SignalProcessing.Cpp")
],
linkerSettings: [
.unsafeFlags(["-LsignalProcessingSDK/lib", "-llibAlgebra"]) // Thise line seems not to work in the client project
]
),
.target(
name: "MyFrameworkSDK",
dependencies: ["Alamofire", "RealmSwift", "SwiftyJSON", "CPP"],
path: "Sources/Swift"
)
],
swiftLanguageVersions: [.v5],
cxxLanguageStandard: .gnucxx11
)
I get the following error in the client:
d: warning: directory not found for option '-LsignalProcessingSDK/lib'
ld: library not found for -llibAlgebra
So my questions are:
- Is "unsafeFlags" is the right command to use to link binary with libraries? If not what should I use?
- Is the path given to "unsafeFlags" absolute or relative to the target?
Thanks for your help.