1
1
/*
2
2
This source file is part of the Swift.org open source project
3
-
3
+
4
4
Copyright (c) 2018 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
-
6
+
7
7
See http://swift.org/LICENSE.txt for license information
8
8
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9
- */
9
+ */
10
10
11
11
/// The build configuration such as debug or release.
12
12
public struct BuildConfiguration : Encodable {
13
13
private let config : String
14
-
14
+
15
15
private init ( _ config: String ) {
16
16
self . config = config
17
17
}
18
-
18
+
19
19
/// The debug build configuration.
20
20
public static let debug : BuildConfiguration = BuildConfiguration ( " debug " )
21
-
21
+
22
22
/// The release build configuration.
23
23
public static let release : BuildConfiguration = BuildConfiguration ( " release " )
24
24
}
@@ -49,15 +49,15 @@ public struct BuildConfiguration: Encodable {
49
49
/// ]
50
50
/// ),
51
51
public struct BuildSettingCondition : Encodable {
52
-
52
+
53
53
private let platforms : [ Platform ] ?
54
54
private let config : BuildConfiguration ?
55
-
55
+
56
56
private init ( platforms: [ Platform ] ? , config: BuildConfiguration ? ) {
57
57
self . platforms = platforms
58
58
self . config = config
59
59
}
60
-
60
+
61
61
/// Creates a build setting condition.
62
62
///
63
63
/// At least one parameter is mandatory.
@@ -77,25 +77,25 @@ public struct BuildSettingCondition: Encodable {
77
77
78
78
/// The underlying build setting data.
79
79
fileprivate struct BuildSettingData : Encodable {
80
-
80
+
81
81
/// The name of the build setting.
82
82
let name : String
83
-
83
+
84
84
/// The value of the build setting.
85
85
let value : [ String ]
86
-
86
+
87
87
/// A condition that restricts the application of the build setting.
88
88
let condition : BuildSettingCondition ?
89
89
}
90
90
91
91
/// A C-language build setting.
92
92
public struct CSetting : Encodable {
93
93
private let data : BuildSettingData
94
-
94
+
95
95
private init ( name: String , value: [ String ] , condition: BuildSettingCondition ? ) {
96
96
self . data = BuildSettingData ( name: name, value: value, condition: condition)
97
97
}
98
-
98
+
99
99
/// Provides a header search path relative to the target's directory.
100
100
///
101
101
/// Use this setting to add a search path for headers within your target.
@@ -112,7 +112,7 @@ public struct CSetting: Encodable {
112
112
public static func headerSearchPath( _ path: String , _ condition: BuildSettingCondition ? = nil ) -> CSetting {
113
113
return CSetting ( name: " headerSearchPath " , value: [ path] , condition: condition)
114
114
}
115
-
115
+
116
116
/// Defines a value for a macro.
117
117
///
118
118
/// If you don't specify a value, the macro's default value is 1.
@@ -130,7 +130,7 @@ public struct CSetting: Encodable {
130
130
}
131
131
return CSetting ( name: " define " , value: [ settingValue] , condition: condition)
132
132
}
133
-
133
+
134
134
/// Sets unsafe flags to pass arbitrary command-line flags to the corresponding build tool.
135
135
///
136
136
/// As the usage of the word "unsafe" implies, the Swift Package Manager
@@ -155,11 +155,11 @@ public struct CSetting: Encodable {
155
155
/// A CXX-language build setting.
156
156
public struct CXXSetting : Encodable {
157
157
private let data : BuildSettingData
158
-
158
+
159
159
private init ( name: String , value: [ String ] , condition: BuildSettingCondition ? ) {
160
160
self . data = BuildSettingData ( name: name, value: value, condition: condition)
161
161
}
162
-
162
+
163
163
/// Provides a header search path relative to the target's directory.
164
164
///
165
165
/// Use this setting to add a search path for headers within your target.
@@ -176,7 +176,7 @@ public struct CXXSetting: Encodable {
176
176
public static func headerSearchPath( _ path: String , _ condition: BuildSettingCondition ? = nil ) -> CXXSetting {
177
177
return CXXSetting ( name: " headerSearchPath " , value: [ path] , condition: condition)
178
178
}
179
-
179
+
180
180
/// Defines a value for a macro.
181
181
///
182
182
/// If you don't specify a value, the macro's default value is 1.
@@ -194,7 +194,7 @@ public struct CXXSetting: Encodable {
194
194
}
195
195
return CXXSetting ( name: " define " , value: [ settingValue] , condition: condition)
196
196
}
197
-
197
+
198
198
/// Sets unsafe flags to pass arbitrary command-line flags to the corresponding build tool.
199
199
///
200
200
/// As the usage of the word "unsafe" implies, the Swift Package Manager
@@ -218,11 +218,11 @@ public struct CXXSetting: Encodable {
218
218
/// A Swift language build setting.
219
219
public struct SwiftSetting : Encodable {
220
220
private let data : BuildSettingData
221
-
221
+
222
222
private init ( name: String , value: [ String ] , condition: BuildSettingCondition ? ) {
223
223
self . data = BuildSettingData ( name: name, value: value, condition: condition)
224
224
}
225
-
225
+
226
226
/// Defines a compilation condition.
227
227
///
228
228
/// Use compilation conditions to only compile statements if a certain condition is true.
@@ -244,7 +244,7 @@ public struct SwiftSetting: Encodable {
244
244
public static func define( _ name: String , _ condition: BuildSettingCondition ? = nil ) -> SwiftSetting {
245
245
return SwiftSetting ( name: " define " , value: [ name] , condition: condition)
246
246
}
247
-
247
+
248
248
/// Sets unsafe flags to pass arbitrary command-line flags to the corresponding build tool.
249
249
///
250
250
/// As the usage of the word "unsafe" implies, the Swift Package Manager
@@ -268,11 +268,11 @@ public struct SwiftSetting: Encodable {
268
268
/// A linker build setting.
269
269
public struct LinkerSetting : Encodable {
270
270
private let data : BuildSettingData
271
-
271
+
272
272
private init ( name: String , value: [ String ] , condition: BuildSettingCondition ? ) {
273
273
self . data = BuildSettingData ( name: name, value: value, condition: condition)
274
274
}
275
-
275
+
276
276
/// Declares linkage to a system library.
277
277
///
278
278
/// This setting is most useful when the library can't be linked
@@ -287,7 +287,7 @@ public struct LinkerSetting: Encodable {
287
287
public static func linkedLibrary( _ library: String , _ condition: BuildSettingCondition ? = nil ) -> LinkerSetting {
288
288
return LinkerSetting ( name: " linkedLibrary " , value: [ library] , condition: condition)
289
289
}
290
-
290
+
291
291
/// Declares linkage to a system framework.
292
292
///
293
293
/// This setting is most useful when the framework can't be linked
@@ -302,7 +302,7 @@ public struct LinkerSetting: Encodable {
302
302
public static func linkedFramework( _ framework: String , _ condition: BuildSettingCondition ? = nil ) -> LinkerSetting {
303
303
return LinkerSetting ( name: " linkedFramework " , value: [ framework] , condition: condition)
304
304
}
305
-
305
+
306
306
/// Sets unsafe flags to pass arbitrary command-line flags to the corresponding build tool.
307
307
///
308
308
/// As the usage of the word "unsafe" implies, the Swift Package Manager
0 commit comments