-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathPackage.swift
More file actions
52 lines (48 loc) · 1.67 KB
/
Copy pathPackage.swift
File metadata and controls
52 lines (48 loc) · 1.67 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
// 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 swiftSettings: [SwiftSetting] = hasFFmpeg ? [.define("FFMPEG")] : []
let package = Package(
name: "macSubtitleOCR",
platforms: [
.macOS("14.0")
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.7.1")
],
targets: [
.executableTarget(
name: "macSubtitleOCR",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser")
] + (hasFFmpeg ? ["CFFmpeg"] : []),
cSettings: cSettings,
swiftSettings: swiftSettings,
linkerSettings: linkerSettings),
.testTarget(
name: "macSubtitleOCRTests",
dependencies: [
.target(name: "macSubtitleOCR")
],
resources: [
.process("Resources")
],
swiftSettings: swiftSettings)
] + (hasFFmpeg ? [
.systemLibrary(
name: "CFFmpeg",
pkgConfig: "libavformat libavcodec libavutil",
providers: [
.brew(["ffmpeg"])
])
] : []))