Repository navigation
Expand file tree
/
Copy pathPackage.swift
More file actions
61 lines (56 loc) · 1.94 KB
/
Copy pathPackage.swift
File metadata and controls
61 lines (56 loc) · 1.94 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
// swift-tools-version:6.0
//
// Copyright 2020-2021 Signal Messenger, LLC.
// SPDX-License-Identifier: AGPL-3.0-only
//
import PackageDescription
// This is only used for local builds; the directory won't exist when used as a (remote) dependency.
let rustBuildDir: String = {
let manifestPath = #filePath
if let lastDirectorySep = manifestPath.lastIndex(of: "/") {
return manifestPath[...lastDirectorySep] + "target/debug/"
} else {
return "target/debug/"
}
}()
var testDependencies: [Target.Dependency] = ["LibSignalClient"]
var binaryTargets: [Target] = []
if let ffiXCFrameworkPath = Context.environment["LIBSIGNAL_FFI_XCFRAMEWORK"] {
testDependencies.append("LibSignalFfi")
binaryTargets.append(.binaryTarget(name: "LibSignalFfi", path: ffiXCFrameworkPath))
}
let package = Package(
name: "LibSignalClient",
platforms: [
.macOS(.v10_15), .iOS(.v15),
],
products: [
.library(
name: "LibSignalClient",
targets: ["LibSignalClient"]
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.4.3")
],
targets: [
.systemLibrary(name: "SignalFfi", path: "swift/Sources/SignalFfi"),
.target(
name: "LibSignalClient",
dependencies: ["SignalFfi"],
path: "swift/Sources/LibSignalClient",
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")],
linkerSettings: [
.linkedLibrary("stdc++", .when(platforms: [.linux]))
]
),
.testTarget(
name: "LibSignalClientTests",
dependencies: testDependencies,
path: "swift/Tests/LibSignalClientTests",
resources: [.process("Resources")],
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")],
linkerSettings: [.unsafeFlags(["-L\(rustBuildDir)"])]
),
] + binaryTargets
)