// 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.4.0/Sentry.xcframework.zip", checksum: "c0af612b43a4eacab4d38bda0a65b7a310295b3daadb95df2aa8251a9f6bdf6d" //Sentry-Static ), .binaryTarget( name: "Sentry-Dynamic", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.4.0/Sentry-Dynamic.xcframework.zip", checksum: "05f6925c228021e9e2bbdc9b609602de18a30f8192cba88d11aafb867ae24a5e" //Sentry-Dynamic ), .binaryTarget( name: "Sentry-Dynamic-WithARM64e", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.4.0/Sentry-Dynamic-WithARM64e.xcframework.zip", checksum: "e351c4f85ae32e9180ceea4e8a3f470b44148658ba7e119fd4df7548afedca45" //Sentry-Dynamic-WithARM64e ), .binaryTarget( name: "Sentry-WithoutUIKitOrAppKit", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.4.0/Sentry-WithoutUIKitOrAppKit.xcframework.zip", checksum: "993d0e3cc5530e4b22737eb4aeeae1a84ad9182e8df958160e3e8ec1a8a4b5f0" //Sentry-WithoutUIKitOrAppKit ), .binaryTarget( name: "Sentry-WithoutUIKitOrAppKit-WithARM64e", url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.4.0/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip", checksum: "70d0b5865e9ffb7c9f1c1f5bd0511cd8ffd335da895c5ad17ebc250c9d9694b6" //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 )