// swift-tools-version:6.0 #if canImport(Darwin) import Darwin.C #elseif canImport(Glibc) import Glibc #elseif canImport(MSVCRT) import MSVCRT #endif import PackageDescription var products: [Product] = [ .library(name: "Sentry", targets: ["Sentry", "SentryCppHelper"]), .library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]), .library(name: "Sentry-Dynamic-WithARM64e", targets: ["Sentry-Dynamic-WithARM64e"]), .library(name: "Sentry-WithoutUIKitOrAppKit", targets: ["Sentry-WithoutUIKitOrAppKit", "SentryCppHelper"]), .library(name: "Sentry-WithoutUIKitOrAppKit-WithARM64e", targets: ["Sentry-WithoutUIKitOrAppKit-WithARM64e", "SentryCppHelper"]), .library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"]), .library(name: "SentryDistribution", targets: ["SentryDistribution"]) ] var targets: [Target] = [ .binaryTarget( name: "Sentry", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.1.0/Sentry.xcframework.zip", checksum: "dbe8684753ee9590d2785edfd3ae2a48f4953cb7a8e5251de8a3b534238d9f93" //Sentry-Static ), .binaryTarget( name: "Sentry-Dynamic", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.1.0/Sentry-Dynamic.xcframework.zip", checksum: "71d1e398eb21e933887a71289008df38a180ac3d0047d24301dec4e9977e52ac" //Sentry-Dynamic ), .binaryTarget( name: "Sentry-Dynamic-WithARM64e", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.1.0/Sentry-Dynamic-WithARM64e.xcframework.zip", checksum: "7104ff7d0a454a587eaefaf804ab63adabe6623803811ce47e33c516ae556be7" //Sentry-Dynamic-WithARM64e ), .binaryTarget( name: "Sentry-WithoutUIKitOrAppKit", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.1.0/Sentry-WithoutUIKitOrAppKit.xcframework.zip", checksum: "8d1ddafc78732e3b03e8bfa2a2f41e6c914a938f06dd5f7330f47435553c21d1" //Sentry-WithoutUIKitOrAppKit ), .binaryTarget( name: "Sentry-WithoutUIKitOrAppKit-WithARM64e", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.1.0/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip", checksum: "e653ba630e9858c33090b24cb1be97c4d88a9e8157adab119eb100bf479bebf8" //Sentry-WithoutUIKitOrAppKit-WithARM64e ), .target( name: "SentrySwiftUI", dependencies: ["Sentry", "SentryInternal"], path: "Sources/SentrySwiftUI", exclude: ["SentryInternal/", "module.modulemap"], linkerSettings: [ .linkedFramework("Sentry") ] ), .target( name: "SentryInternal", path: "Sources/SentrySwiftUI", sources: [ "SentryInternal/" ], publicHeadersPath: "SentryInternal/" ), .target( name: "SentryCppHelper", path: "Sources/SentryCppHelper", linkerSettings: [ .linkedLibrary("c++") ] ), .target(name: "SentryDistribution", path: "Sources/SentryDistribution"), .testTarget(name: "SentryDistributionTests", dependencies: ["SentryDistribution"], path: "Sources/SentryDistributionTests") ] products.append(.library(name: "SentrySPM", targets: ["SentryObjc"])) targets.append(contentsOf: [ // At least one source file is required, therefore we use a dummy class to satisfy the SPM build system .target( name: "SentryHeaders", path: "Sources/Sentry", sources: ["SentryDummyPublicEmptyClass.m"], publicHeadersPath: "Public" ), .target( name: "_SentryPrivate", dependencies: ["SentryHeaders"], path: "Sources/Sentry", sources: ["SentryDummyPrivateEmptyClass.m"], publicHeadersPath: "include"), .target( name: "SentrySwift", dependencies: ["_SentryPrivate", "SentryHeaders"], path: "Sources/Swift", swiftSettings: [ .unsafeFlags(["-enable-library-evolution"]) ]), .target( name: "SentryObjc", dependencies: ["SentrySwift"], path: "Sources", exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper", "SentryDistribution", "SentryDistributionTests"], cSettings: [ .headerSearchPath("Sentry"), .headerSearchPath("SentryCrash/Recording"), .headerSearchPath("SentryCrash/Recording/Monitors"), .headerSearchPath("SentryCrash/Recording/Tools"), .headerSearchPath("SentryCrash/Installations"), .headerSearchPath("SentryCrash/Reporting/Filters"), .headerSearchPath("SentryCrash/Reporting/Filters/Tools")]) ]) let package = Package( name: "Sentry", platforms: [.iOS(.v15), .macOS(.v10_14), .tvOS(.v15), .watchOS(.v8), .visionOS(.v1)], products: products, targets: targets, swiftLanguageModes: [.v5], cxxLanguageStandard: .cxx14 )