mirror of
https://github.com/zhigang1992/facebook-ios-sdk.git
synced 2026-01-12 17:22:28 +08:00
Summary: $title Reviewed By: xta0 Differential Revision: D52021803 fbshipit-source-id: f5c6fdd39934031c348155c7e9f33bf81a475cf2
240 lines
7.1 KiB
Swift
240 lines
7.1 KiB
Swift
// 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(.v12)],
|
|
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,
|
|
],
|
|
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,
|
|
],
|
|
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])
|
|
}
|
|
|
|
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/v16.3.1/\(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])
|
|
|
|
enum Prefixed {
|
|
static let basics = binaryTarget(
|
|
name: .Prefixed.basics,
|
|
remoteChecksum: "b09263314beecd42ec735b2294cb783a3130e7a730817847a98f23e47050fbca"
|
|
)
|
|
|
|
static let aem = binaryTarget(
|
|
name: .Prefixed.aem,
|
|
remoteChecksum: "e15cac49f9a4faf61b4a6283957d9bff7a5b8dc9610fd731049d1a6a6183b705"
|
|
)
|
|
|
|
static let core = binaryTarget(
|
|
name: .Prefixed.core,
|
|
remoteChecksum: "60fb77ce96184325479400afdca9ea798c4d278bcd63e1551b7a938b7f8425e1"
|
|
)
|
|
|
|
static let login = binaryTarget(
|
|
name: .Prefixed.login,
|
|
remoteChecksum: "c15f770a240848b893b03c21bff2090ab9b9a61ea52589d0868bcfe92bbfe458"
|
|
)
|
|
|
|
static let share = binaryTarget(
|
|
name: .Prefixed.share,
|
|
remoteChecksum: "2795b44c28bbd18a306bff10aa809121987b0bd958bb71ceae7ecf32f0c907b4"
|
|
)
|
|
|
|
static let gamingServices = binaryTarget(
|
|
name: .Prefixed.gaming,
|
|
remoteChecksum: "59a04242968a10e87d91477204cbeed3e015f637ed4953ccf337be032e6613aa"
|
|
)
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
|
|
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"
|
|
|
|
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"
|
|
}
|
|
}
|