-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPackage.swift
49 lines (45 loc) · 1.51 KB
/
Package.swift
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
// swift-tools-version: 6.0
import Foundation
import PackageDescription
let hasFFmpeg = ProcessInfo.processInfo.environment["USE_FFMPEG"] == "1"
#if arch(arm64)
let includePath = "-I/opt/homebrew/include"
let libPath = "-L/opt/homebrew/lib"
#else
let includePath = "-I/usr/local/include"
let libPath = "-L/usr/local/lib"
#endif
let cSettings: [CSetting] = (hasFFmpeg ? [CSetting.unsafeFlags([includePath])] : [CSetting.unsafeFlags([])])
let linkerSettings: [LinkerSetting] = (hasFFmpeg ? [LinkerSetting.unsafeFlags([libPath])] : [LinkerSetting.unsafeFlags([])])
let package = Package(
name: "macSubtitleOCR",
platforms: [
.macOS("14.0")
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0")
],
targets: [
.executableTarget(
name: "macSubtitleOCR",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser")
] + (hasFFmpeg ? ["CFFmpeg"] : []),
cSettings: cSettings,
linkerSettings: linkerSettings),
.testTarget(
name: "macSubtitleOCRTests",
dependencies: [
.target(name: "macSubtitleOCR")
],
resources: [
.process("Resources")
])
] + (hasFFmpeg ? [
.systemLibrary(
name: "CFFmpeg",
pkgConfig: "libavformat libavcodec libavutil",
providers: [
.brew(["ffmpeg"])
])
] : []))