-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackage.swift
More file actions
117 lines (112 loc) · 3.66 KB
/
Copy pathPackage.swift
File metadata and controls
117 lines (112 loc) · 3.66 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// swift-tools-version: 6.0
import PackageDescription
let v5 = [SwiftSetting.swiftLanguageMode(.v5)]
// Portable core: builds on macOS and Linux (the Qt frontend consumes these).
var targets: [Target] = [
.systemLibrary(
name: "CLibRaw",
pkgConfig: "libraw_r",
providers: [.brew(["libraw"]), .apt(["libraw-dev"])]
),
// Pure conversion kernel: analysis, metering, curve parameters. No UI, no Metal.
.target(name: "NegativeKit", swiftSettings: v5),
.target(name: "RawDecodeKit", dependencies: ["CLibRaw", "NegativeKit"], swiftSettings: v5),
.testTarget(
name: "NegativeKitTests",
dependencies: ["NegativeKit"],
swiftSettings: v5
),
]
// negcli builds everywhere; only the macOS build links the Metal renderer.
// On Linux the GPU path is VulkanRenderKit (compute mirror of the Metal
// chain; ReferenceCurve remains the no-GPU fallback). Declared per-branch
// because SwiftPM validates conditional dependency names even when the
// condition is false.
// The Qt frontend consumes the core through this C-ABI dylib (CoreBridge's
// @_cdecl surface; qt/swiftinvert_core.h is the matching header).
// Products are explicit because of the dylib; executables must then be
// listed per-platform too (an explicit list suppresses the implicit ones,
// and `swift run` / `--product` only see listed products).
var products: [Product] = []
#if os(macOS)
products += [
.executable(name: "SwiftInvert", targets: ["SwiftInvert"]),
.executable(name: "negcli", targets: ["negcli"]),
]
#else
products += [
.library(name: "SwiftInvertCore", type: .dynamic, targets: ["CoreBridge"]),
.executable(name: "negcli", targets: ["negcli"]),
]
#endif
#if !os(macOS)
targets += [
.systemLibrary(
name: "CVulkan",
pkgConfig: "vulkan",
providers: [.apt(["libvulkan-dev"])]
),
.target(
name: "CoreBridge",
dependencies: ["NegativeKit", "RawDecodeKit", "VulkanRenderKit"],
swiftSettings: v5
),
.target(
name: "VulkanRenderKit",
dependencies: ["CVulkan", "NegativeKit"],
resources: [.copy("Shaders")],
swiftSettings: v5
),
.executableTarget(
name: "negcli",
dependencies: ["RawDecodeKit", "NegativeKit", "VulkanRenderKit"],
swiftSettings: v5
),
.testTarget(
name: "VulkanRenderKitTests",
dependencies: ["VulkanRenderKit", "NegativeKit"],
swiftSettings: v5
),
]
#endif
// Package.swift executes on the build host, so this gates by where the build
// runs — exactly right for Metal/SwiftUI, which only exist there.
#if os(macOS)
targets += [
.target(
name: "MetalRenderKit",
dependencies: ["NegativeKit"],
resources: [.copy("Shaders")],
swiftSettings: v5
),
.executableTarget(
name: "negcli",
dependencies: ["RawDecodeKit", "NegativeKit", "MetalRenderKit"],
swiftSettings: v5
),
.executableTarget(
name: "SwiftInvert",
dependencies: ["RawDecodeKit", "NegativeKit", "MetalRenderKit"],
resources: [.copy("Resources")],
swiftSettings: v5
),
.testTarget(
name: "MetalRenderKitTests",
dependencies: ["MetalRenderKit", "NegativeKit"],
swiftSettings: v5
),
// App-layer logic (SwiftPM can test @main executables since 5.5):
// history labels, sidecar IO, export options, densitometer probe.
.testTarget(
name: "SwiftInvertTests",
dependencies: ["SwiftInvert", "NegativeKit"],
swiftSettings: v5
),
]
#endif
let package = Package(
name: "SwiftInvert",
platforms: [.macOS(.v14)],
products: products,
targets: targets
)