-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPackage.swift
86 lines (71 loc) · 2.26 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
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
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import Foundation
import PackageDescription
// Get the values we need to populate the LIBTIDY_VERSION and RELEASE_DATE macros later.
func tidyVersion() -> [String] {
let PWD = (#filePath as NSString).deletingLastPathComponent
let VERSION_FILE = NSString.path(withComponents: [PWD, "Sources", "CLibTidy", "version.txt"])
if let CONTENTS = try? String(contentsOfFile: VERSION_FILE).components(separatedBy: "\n") {
return CONTENTS
}
return ["5.0.0", "2021/01/01"]
}
let package = Package(
name: "SwLibTidy",
products: [
.library(
name: "SwLibTidy",
targets: ["SwLibTidy"]),
.executable(
name: "Console",
targets: ["Console"]),
],
dependencies: [],
targets: [
.target(
name: "CLibTidy"
, dependencies: []
, path: "Sources/CLibTidy"
, exclude: [
"CMakeLists.txt",
"tidy.pc.cmake.in",
"README.md",
"version.txt",
"build",
"console",
"experimental",
"localize",
"man",
"README",
"regression_testing",
"include/buffio.h",
"include/platform.h",
]
, sources: ["src"]
, publicHeadersPath: "include"
, cSettings: [
.define("LIBTIDY_VERSION", to: "\"\(tidyVersion()[0])\"", nil),
.define("RELEASE_DATE", to: "\"\(tidyVersion()[1])\"", nil)
]
),
.target(
name: "SwLibTidy",
dependencies: ["CLibTidy"],
path: "Sources/SwLibTidy"
),
.target(
name: "Console",
dependencies: ["SwLibTidy"],
path: "Sources/Console"
),
.testTarget(
name: "SwLibTidyTests",
dependencies: ["CLibTidy", "SwLibTidy"],
resources: [
.process("Resources/")
]
),
],
cLanguageStandard: CLanguageStandard.gnu89
)