forked from apple/swift-crypto
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPackage.swift
More file actions
72 lines (66 loc) · 2.49 KB
/
Copy pathPackage.swift
File metadata and controls
72 lines (66 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// swift-tools-version:5.1
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftCrypto open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
// This package contains a vendored copy of BoringSSL. For ease of tracking
// down problems with the copy of BoringSSL in use, we include a copy of the
// commit hash of the revision of BoringSSL included in the given release.
// This is also reproduced in a file called hash.txt in the
// Sources/CCryptoBoringSSL directory. The source repository is at
// https://boringssl.googlesource.com/boringssl.
//
// BoringSSL Commit: 0416e8c3055c7fcfd6c3eab4c127a36df1e6097b
import PackageDescription
import Foundation
let env = ProcessInfo.processInfo.environment
let backDeployKey = "SWIFT_CRYPTO_BACK_DEPLOY"
let isBackDeploy = (env[backDeployKey] as NSString?)?.boolValue == true
var swiftSettings: [SwiftSetting] = [
.define("CRYPTO_IN_SWIFTPM"),
]
let platforms: [SupportedPlatform]
if isBackDeploy {
swiftSettings += [.define("CRYPTO_IN_SWIFTPM_FORCE_BUILD_API")]
platforms = [
.macOS(.v10_10),
.iOS(.v8),
.watchOS(.v2),
.tvOS(.v9),
]
} else {
platforms = [
.macOS(.v10_15),
.iOS(.v13),
.watchOS(.v6),
.tvOS(.v13),
]
}
let package = Package(
name: "swift-crypto",
platforms: platforms,
products: [
.library(name: "Crypto", targets: ["Crypto"]),
/* This target is used only for symbol mangling. It's added and removed automatically because it emits build warnings. MANGLE_START
.library(name: "CCryptoBoringSSL", type: .static, targets: ["CCryptoBoringSSL"]),
MANGLE_END */
],
dependencies: [],
targets: [
.target(name: "CCryptoBoringSSL"),
.target(name: "CCryptoBoringSSLShims", dependencies: ["CCryptoBoringSSL"]),
.target(name: "Crypto", dependencies: ["CCryptoBoringSSL", "CCryptoBoringSSLShims"], swiftSettings: swiftSettings),
.target(name: "crypto-shasum", dependencies: ["Crypto"]),
.testTarget(name: "CryptoTests", dependencies: ["Crypto"], swiftSettings: swiftSettings),
],
cxxLanguageStandard: .cxx11
)