-
-
Notifications
You must be signed in to change notification settings - Fork 343
Expand file tree
/
Copy pathPackage.swift
More file actions
71 lines (65 loc) · 2.29 KB
/
Package.swift
File metadata and controls
71 lines (65 loc) · 2.29 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
// swift-tools-version:6.2
// LNPopupController:4.4.1
import PackageDescription
import Foundation.NSFileManager
let packageBase = URL(filePath: Context.packageDirectory, directoryHint: .isDirectory)
extension URL {
var targetRelativePath: String {
var rv = path
rv.replace(packageBase.path, with: "")
rv = rv.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
return String(rv.dropFirst("LNPopupController/".count))
}
}
//This recursively iterates all directories under LNPopupController/Private and adds them as header search paths.
let start = URL(filePath: "LNPopupController/LNPopupController/Private", relativeTo: packageBase)
var settings: [PackageDescription.CSetting] = [.headerSearchPath(start.targetRelativePath)]
if let enumerator = FileManager.default.enumerator(at: start, includingPropertiesForKeys: [.isDirectoryKey], options: [.skipsHiddenFiles, .skipsPackageDescendants]) {
for case let fileURL as URL in enumerator {
do {
let fileAttributes = try fileURL.resourceValues(forKeys:[.isDirectoryKey])
if fileAttributes.isDirectory! {
settings.append(.headerSearchPath(fileURL.targetRelativePath))
}
} catch { fatalError(error.localizedDescription) }
}
}
//if true {
// fatalError(settings.map { String(describing: $0) }.joined(separator: " "))
//}
let package = Package(
name: "LNPopupController",
platforms: [
.iOS(.v13),
.macCatalyst(.v13)
],
products: [
.library(
name: "LNPopupController",
type: .dynamic,
targets: ["LNPopupController", "LNPopupController-ObjC", "LNPopupController-SwiftPrivate"]),
.library(
name: "LNPopupController-Static",
type: .static,
targets: ["LNPopupController", "LNPopupController-ObjC", "LNPopupController-SwiftPrivate"]),
],
dependencies: [],
targets: [
.target(
name: "LNPopupController-ObjC",
dependencies: [],
path: "LNPopupController",
exclude: ["Info.plist", "LNPopupController.xcodeproj", "LNPopupController/Private/Swift"],
publicHeadersPath: "include",
cSettings: settings),
.target(
name: "LNPopupController-SwiftPrivate",
dependencies: ["LNPopupController-ObjC"],
path: "LNPopupController/LNPopupController/Private/Swift"),
.target(
name: "LNPopupController",
dependencies: ["LNPopupController-ObjC"],
path: "LNPopupController+Swift")
],
cxxLanguageStandard: .gnucxx20
)