-
Notifications
You must be signed in to change notification settings - Fork 4
/
Package.swift
130 lines (102 loc) · 3.5 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
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
// swift-tools-version: 6.0
import PackageDescription
let swiftLanguageMode = SwiftLanguageMode.v5
let cSettings: [CSetting]
let libtomCSettings: [CSetting]
let zTarget: Target
let disableShorten64To32Warning = "-Wno-shorten-64-to-32"
#if os(Windows)
// Sources\libtommath\bignumshim.c:28:10: warning: 'mp_read_unsigned_bin' is deprecated: replaced by mp_from_ubin [-Wdeprecated-declarations]
// Sources\libtomcrypt\mac\xcbc\xcbc_file.c:55:9: warning: 'fopen' is deprecated: This function or variable may be unsafe. Consider using fopen_s instead. [-Wdeprecated-declarations]
let disableDeprecatedDeclarationsWarning = "-Wno-deprecated-declarations"
// Sources\libtomcrypt\include\tomcrypt_cfg.h:27:28: warning: 'malloc' redeclared without 'dllimport' attribute: previous 'dllimport' ignored [-Winconsistent-dllimport]
// Sources\libtomcrypt\include\tomcrypt_cfg.h:28:28: warning: 'realloc' redeclared without 'dllimport' attribute: previous 'dllimport' ignored [-Winconsistent-dllimport]
let disableInconsistentDllImportWarning = "-Wno-inconsistent-dllimport"
cSettings = [
.unsafeFlags([
disableDeprecatedDeclarationsWarning,
disableInconsistentDllImportWarning
])
]
libtomCSettings = [
.unsafeFlags([
disableShorten64To32Warning,
disableDeprecatedDeclarationsWarning,
disableInconsistentDllImportWarning
])
]
zTarget = Target.target(name: "Z", path: "Sources/zlib-1.3.1", cSettings: [
.define("STDC"),
.define("HAVE_STDARG_H"),
.define("HAVE_HIDDEN"),
.unsafeFlags([
disableDeprecatedDeclarationsWarning,
])
])
#else
cSettings = .init()
libtomCSettings = [
.unsafeFlags([
disableShorten64To32Warning
])
]
zTarget = Target.target(name: "Z", linkerSettings: [
.linkedLibrary("z")
])
#endif
let libtommathTarget = Target.target(name: "libtommath",
cSettings: libtomCSettings)
let libtomcryptTarget = Target.target(name: "libtomcrypt",
cSettings: libtomCSettings)
let d3desTarget = Target.target(name: "d3des")
let package = Package(
name: "RoyalVNCKit",
platforms: [
.macOS(.v11),
.iOS(.v15),
.macCatalyst(.v15),
.tvOS(.v15),
.visionOS(.v1)
],
products: [
.library(
name: "RoyalVNCKit",
type: .dynamic,
targets: [ "RoyalVNCKit" ]
),
.executable(name: "RoyalVNCKitDemo",
targets: [ "RoyalVNCKitDemo" ])
],
targets: [
.target(
name: "RoyalVNCKitC",
cSettings: cSettings
),
.target(
name: "RoyalVNCKit",
dependencies: [
"RoyalVNCKitC",
.byName(name: d3desTarget.name),
.byName(name: libtommathTarget.name),
.byName(name: libtomcryptTarget.name),
.byName(name: zTarget.name)
],
cSettings: cSettings,
swiftSettings: [ .swiftLanguageMode(swiftLanguageMode) ]
),
d3desTarget,
libtommathTarget,
libtomcryptTarget,
zTarget,
.executableTarget(
name: "RoyalVNCKitDemo",
dependencies: [ "RoyalVNCKit" ],
cSettings: cSettings
),
.executableTarget(
name: "RoyalVNCKitCDemo",
dependencies: [ "RoyalVNCKit" ],
cSettings: cSettings
)
]
)