Package.swift (162 lines of code) (raw):

// swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the license found in the * LICENSE file in the root directory of this source tree. */ import PackageDescription import Foundation #if os(Linux) import Glibc #else import Darwin.C #endif let package = Package( name: "Facebook", platforms: [ .iOS(.v10), .tvOS(.v10) ], products: [ // The Kernel of the SDK. Must be included as a runtime dependency. .basics, // The Facebook AEM Kit .aem, /* The Core SDK library that provides two importable modules: - FacebookCore which includes the most current interface and will contain interfaces for new features written in Swift - FBSDKCoreKit which contains legacy Objective-C interfaces that will be used to maintain backwards compatibility with types that have been converted to Swift. This will not contain interfaces for new features written in Swift. */ .core, // The Facebook Login SDK .login, // The Facebook Share SDK .share, // The Facebook Gaming Services SDK .gaming, // The Facebook tvOS SDK. .tv, ], targets: [ // The kernel of the SDK .Prefixed.basics, /* The legacy Objective-C implementation that will be converted to Swift. This will not contain interfaces for new features written in Swift. */ .Prefixed.aem, // The main AEM module .aem, /* The legacy Objective-C implementation that will be converted to Swift. This will not contain interfaces for new features written in Swift. */ .Prefixed.core, // The main Core SDK module .core, /* The legacy Objective-C implementation that will be converted to Swift. This will not contain interfaces for new features written in Swift. */ .Prefixed.login, // The main Login SDK module .login, /* The legacy Objective-C implementation that has been converted to Swift. This will not contain interfaces for new features written in Swift. */ .Prefixed.share, // The main Share SDK module .share, /* The legacy Objective-C implementation that has been converted to Swift. This will not contain interfaces for new features written in Swift. */ .Prefixed.gamingServices, // The main Facebook Gaming Services module .gaming, // The tvOS-specific SDK with an FBSDK-prefixed name. .Prefixed.tv, // The tvOS-specific SDK. .tv, ], cxxLanguageStandard: .cxx11 ) extension Product { static let basics = library(name: .basics, targets: [.Prefixed.basics]) static let core = library(name: .core, targets: [.core, .Prefixed.core]) static let login = library(name: .login, targets: [.login]) static let share = library(name: .share, targets: [.share, .Prefixed.share]) static let gaming = library(name: .gaming, targets: [.gaming, .Prefixed.gaming]) static let aem = library(name: .aem, targets: [.aem, .Prefixed.aem]) static let tv = library(name: .tv, targets: [.tv]) } extension Target { static let binarySource = BinarySource() static func binaryTarget(name: String, remoteChecksum: String) -> Target { switch binarySource { case .local: return .binaryTarget( name: name, path: localBinaryPath(for: name) ) case .remote: return .binaryTarget( name: name, url: remoteBinaryURLString(for: name), checksum: remoteChecksum ) } } static func localBinaryPath(for targetName: String) -> String { "build/XCFrameworks/Static/\(targetName).xcframework" } static func remoteBinaryURLString(for targetName: String) -> String { "https://github.com/facebook/facebook-ios-sdk/releases/download/v13.1.0/\(targetName)-Static_XCFramework.zip" } static let aem = target(name: .aem, dependencies: [.Prefixed.aem]) static let core = target( name: .core, dependencies: [.aem, .Prefixed.basics, .Prefixed.core], linkerSettings: [ .cPlusPlusLibrary, .zLibrary, .accelerateFramework, ] ) static let login = target(name: .login, dependencies: [.core, .Prefixed.login]) static let share = target(name: .share, dependencies: [.core, .Prefixed.share]) static let gaming = target(name: .gaming, dependencies: [.Prefixed.gaming]) static let tv = target(name: .tv, dependencies: [.Prefixed.tv]) enum Prefixed { static let basics = binaryTarget( name: .Prefixed.basics, remoteChecksum: "f4ef1db46bc5a76542cdb3664485b5b7b2fc4c812f085cbd1eda659d4d8f544d" ) static let aem = binaryTarget( name: .Prefixed.aem, remoteChecksum: "af4de135cf6fd2985fb9519e51168d4bcfe4fa726ecd5120ead5ea17a49840fd" ) static let core = binaryTarget( name: .Prefixed.core, remoteChecksum: "2aca2fc4fc117d6e50836b08bdf5344aa8e71646112b6937353e1e8f2ac5f02b" ) static let login = binaryTarget( name: .Prefixed.login, remoteChecksum: "145c44b4ca14efa987c2b562d29e2a58bd5c9ac764a7b16907c7e93b5110641f" ) static let share = binaryTarget( name: .Prefixed.share, remoteChecksum: "0cb02e92c31ad8abc3e39e7d9843577eb65323f0f03d6ad50bbf7827bdc461cc" ) static let gamingServices = binaryTarget( name: .Prefixed.gaming, remoteChecksum: "7651d1a02c71da1b30b43c8f6e19fc70701bdf325fcfdb31d32e610e84beea45" ) static let tv = binaryTarget( name: .Prefixed.tv, remoteChecksum: "061ca46117c316a1cfe1bb4cf1a842ee41d4aa7fb1f9814363c4fcadb0df5bb7" ) } } extension Target.Dependency { static let aem = byName(name: .aem) static let core = byName(name: .core) enum Prefixed { static let aem = byName(name: .Prefixed.aem) static let basics = byName(name: .Prefixed.basics) static let core = byName(name: .Prefixed.core) static let login = byName(name: .Prefixed.login) static let share = byName(name: .Prefixed.share) static let gaming = byName(name: .Prefixed.gaming) static let tv = byName(name: .Prefixed.tv) } } extension LinkerSetting { static let cPlusPlusLibrary = linkedLibrary("c++") static let zLibrary = linkedLibrary("z") static let accelerateFramework = linkedFramework("Accelerate") } enum BinarySource { case local, remote init() { if getenv("USE_LOCAL_FB_BINARIES") != nil { self = .local } else { self = .remote } } } extension String { static let aem = "FacebookAEM" static let basics = "FacebookBasics" static let core = "FacebookCore" static let login = "FacebookLogin" static let share = "FacebookShare" static let gaming = "FacebookGamingServices" static let tv = "FacebookTV" enum Prefixed { static let aem = "FBAEMKit" static let basics = "FBSDKCoreKit_Basics" static let core = "FBSDKCoreKit" static let login = "FBSDKLoginKit" static let share = "FBSDKShareKit" static let gaming = "FBSDKGamingServicesKit" static let tv = "FBSDKTVOSKit" } }