Repository navigation
Expand file tree
/
Copy pathPackage.swift
More file actions
212 lines (204 loc) · 6.65 KB
/
Copy pathPackage.swift
File metadata and controls
212 lines (204 loc) · 6.65 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
// swift-tools-version: 5.10
import PackageDescription
// onetbb's library name, libtbb.12.dylib on apple platforms, tbb12.dll on windows, libtbb.so elsewhere
#if os(Windows)
let tbbLibrary = "tbb12"
#elseif os(Linux) || os(Android) || os(OpenBSD)
let tbbLibrary = "tbb"
#else
let tbbLibrary = "tbb.12"
#endif
let package = Package(
name: "MetaOpenImageIO",
platforms: [
.macOS(.v14),
.visionOS(.v1),
.iOS(.v17),
.tvOS(.v17),
.watchOS(.v10),
],
products: [
.library(
name: "OpenImageIO",
type: .dynamic,
targets: ["OpenImageIO"]
),
],
dependencies: [
.package(url: "https://github.com/wabiverse/MetaTIFF.git", from: "1.0.1"),
.package(url: "https://github.com/stackotter/libjpegturbo", from: "0.1.4"),
.package(url: "https://github.com/wabiverse/MetaRaw.git", from: "1.0.0"),
.package(url: "https://github.com/wabiverse/MetaPtex.git", from: "1.0.0"),
.package(url: "https://github.com/wabiverse/MetaOpenVDB.git", from: "1.1.0"),
.package(url: "https://github.com/wabiverse/MetaImath.git", from: "1.0.0"),
.package(url: "https://github.com/wabiverse/MetaOpenEXR.git", from: "1.0.0"),
.package(url: "https://github.com/wabiverse/MetaOneTBB.git", from: "2.0.0"),
.package(url: "https://github.com/wabiverse/MetaMicrosoftSTL.git", from: "1.0.0"),
.package(url: "https://github.com/the-swift-collective/zlib", from: "1.3.3"),
.package(url: "https://github.com/the-swift-collective/libwebp", from: "1.4.2"),
.package(url: "https://github.com/the-swift-collective/libpng", from: "1.6.46"),
],
targets: [
.target(
name: "OpenImageIO",
dependencies: [
.product(name: "TIFF", package: "MetaTIFF"),
.product(name: "JPEGTurbo", package: "libjpegturbo"),
.product(name: "Raw", package: "MetaRaw"),
.product(name: "Ptex", package: "MetaPtex"),
.product(name: "OpenVDB", package: "MetaOpenVDB"),
.product(name: "Imath", package: "MetaImath"),
.product(name: "OpenEXR", package: "MetaOpenEXR"),
.product(name: tbbLibrary, package: "MetaOneTBB"),
.product(name: "ZLib", package: "zlib"),
.product(name: "MicrosoftSTL", package: "MetaMicrosoftSTL", condition: .when(platforms: Arch.OS.windows.platform)),
.product(name: "WebP", package: "libwebp"),
.product(name: "LibPNG", package: "libpng"),
],
exclude: [
"jpeg2000.imageio",
"heif.imageio",
"gif.imageio",
"ffmpeg.imageio",
"dicom.imageio",
"bmp.imageio",
"term.imageio",
"psd.imageio",
"pnm.imageio",
"oiiotool",
],
publicHeadersPath: "include",
cxxSettings: [
.headerSearchPath("."),
.headerSearchPath("include/OpenImageIO/detail"),
.define("EMBED_PLUGINS", to: "1"),
.define("OpenImageIO_EXPORTS", to: "1"),
.define("OpenImageIO_Util_EXPORTS", to: "1"),
.define("DISABLE_PSD", to: "1"),
.define("DISABLE_BMP", to: "1"),
.define("DISABLE_TERM", to: "1"),
.define("DISABLE_PNM", to: "1"),
.define("DISABLE_OPENVDB", to: "1", .when(platforms: [.windows])),
.define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])),
.define("_ALLOW_KEYWORD_MACROS", to: "1", .when(platforms: [.windows])),
.define("static_assert(_conditional, ...)", to: "", .when(platforms: [.windows])),
.define("FMT_LIB_EXPORT"),
.define("FMT_HEADER_ONLY")
]
),
],
cLanguageStandard: .gnu17,
cxxLanguageStandard: .cxx17
)
enum Arch
{
enum OS
{
case apple
case linux
case windows
case web
case nix
case applewindows
case applewindowsdroid
case nixnodroid
case nodroid
case nowasm
var platform: [Platform]
{
switch self
{
case .apple: [.macOS, .iOS, .visionOS, .tvOS, .watchOS]
case .linux: [.linux, .android, .openbsd]
case .windows: [.windows]
case .web: [.wasi]
case .nix: [.macOS, .iOS, .visionOS, .tvOS, .watchOS, .linux, .android, .openbsd]
case .applewindows: [.macOS, .iOS, .visionOS, .tvOS, .watchOS, .windows]
case .applewindowsdroid: [.macOS, .iOS, .visionOS, .tvOS, .watchOS, .windows, .android]
case .nixnodroid: [.macOS, .iOS, .visionOS, .tvOS, .watchOS, .linux, .openbsd]
case .nodroid: [.macOS, .iOS, .visionOS, .tvOS, .watchOS, .linux, .openbsd, .windows]
case .nowasm: [.macOS, .iOS, .visionOS, .tvOS, .watchOS, .linux, .android, .openbsd, .windows]
}
}
}
enum CPU: String
{
case arm
case arm64
case aarch64
case x86_64
case i386
case powerpc
case powerpc64
case powerpc64le
case s390x
case wasm32
case arm64_32
var family: [CPU]
{
switch self
{
case .arm, .arm64, .aarch64, .arm64_32: [.arm, .arm64, .aarch64, .arm64_32]
case .x86_64, .i386: [.x86_64, .i386]
case .powerpc, .powerpc64, .powerpc64le: [.powerpc, .powerpc64, .powerpc64le]
case .s390x: [.s390x]
case .wasm32: [.wasm32]
}
}
}
#if os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS)
static let host = "apple"
#if os(macOS)
static let device = "macosx"
#elseif os(visionOS)
static let device = "xros"
#elseif os(iOS)
static let device = "ios"
#elseif os(tvOS)
static let device = "tvos"
#elseif os(watchOS)
static let device = "watchos"
#endif
#elseif os(Linux) || os(Android) || os(OpenBSD) || os(FreeBSD)
static let host = "unknown-linux"
#if os(Android)
static let device = "android24"
#else
static let device = "gnu"
#endif
#elseif os(Windows)
static let host = "unknown-windows"
static let device = "msvc"
#elseif os(Cygwin)
static let host = "cygwin"
static let device = "windows"
#elseif os(WASI)
static let host = "wasi"
static let device = "wasi"
#endif
#if arch(arm64)
#if os(Linux) || os(Android) || os(OpenBSD) || os(FreeBSD)
static let cpuArch: CPU = .aarch64
#else
static let cpuArch: CPU = .arm64
#endif
#elseif arch(x86_64)
static let cpuArch: CPU = .x86_64
#elseif arch(i386)
static let cpuArch: CPU = .i386
#elseif arch(arm)
static let cpuArch: CPU = .arm
#elseif arch(powerpc64)
static let cpuArch: CPU = .powerpc64
#elseif arch(powerpc64le)
static let cpuArch: CPU = .powerpc64le
#elseif arch(powerpc)
static let cpuArch: CPU = .powerpc
#elseif arch(s390x)
static let cpuArch: CPU = .s390x
#elseif arch(wasm32)
static let cpuArch: CPU = .wasm32
#elseif arch(arm64_32)
static let cpuArch: CPU = .arm64_32
#endif
}