I am trying to create a Swift package that contains a library written purely in Swift and a dependency for that library that is written in C/C++. The dependency contains a modulemap and a bridge header for a library and uses custom linker settings for its dependencies. The package also has an executable target that works without a problem.
The problem arises when I try to use this package in an app, where I include the library that is the product of the package. This produces an error with the message
No such module 'demo_dependency'.
Here is my package manifest:
// swift-tools-version: 5.7 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "demo", platforms: [ .macOS(.v11), .iOS(.v14) ], products: [ .library( name: "demo", targets: ["demo"]) ], dependencies: , targets: [ .target( name: "demo_dependency", dependencies: , linkerSettings: [ .linkedFramework("Foundation"), .linkedFramework("CoreGraphics"), .linkedFramework("CoreText"), .linkedLibrary("lib1"), .linkedLibrary("lib2"), .unsafeFlags(["-Lbuild/out"]) ]), .target( name: "demo", dependencies: ["demo_dependency"]), .executableTarget( name: "demo_exec", dependencies: ["demo"] ) ], cxxLanguageStandard: .cxx17 )
How can I use this package in an iOS app?