I have 2 binaries for the same framework, one is built in debug mode, and one is built in release mode.
Now I want to link to those binaries from a local swift package conditionally.
- When the app is built in Debug mode, the debug binary should be linked.
- When the app is built in Release mode, the release binary should be linked.
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "MyLocalSPM",
products: [
.library(
name: "MyLocalSPM",
targets: ["MyLocalSPM"]
),
],
dependencies: [],
targets: [
.binaryTarget(
name: "BinaryXCFramework",
path: "./Libs/Release/BinaryXCFramework.xcframework" // <-- Here, I want to link to Debug/BinaryXCFramework.xcframework when the app is built in Debug configuration
),
.target(
name: "MyLocalSPM",
dependencies: [
"BinaryXCFramework",
]
),
]
)
Anyone knows how I can do that?
5 Likes
I want to do the same thing on my project.
any advance on this matter?
breidest-tbs
(Stephan Breidenbach)
3
I am modularizing an iOS app and stumbled across the same use case.
Maybe I think in the wrong direction.
I can provide two binary library product xcframework s in SPM:
- one in
Debug configuration with debug symbols: "LibADebugBin.xcframework"
- one in
Release configuration without debug symbols; "LibABin.xcframework"
Then I have to conditinally link "LibADebugBin.xcframework" and "LibABin.xcframework" depending on the configuration in the XCode app project.
1 Like
adamski
(Adam Wilson)
4
Just wondering if this an idea or how you actually solved the issue..?
alobaili
(Abdulaziz Alobaili)
5
I'm not sure there's a way to do it in SPM. I've been searching for a way to achieve this even without SPM and embedding directly in the Xcode project, and couldn't find a solid way to do it.
@antranapp Are you able to achieve this without SPM?
My case is I have two xcframeworks once called ABC.xcframework and one called ABC-release.xcframework and I want to link them conditionally based on build configuration.
I have exactly the same issue. Has anyone discovered a solution for this?