@@ -13,9 +13,12 @@ case class NativeConfigOptions(
13
13
linkStubs : Boolean = false ,
14
14
check : Boolean = false ,
15
15
checkFatalWarnings : Boolean = false ,
16
+ checkFeatures : Option [Boolean ] = None ,
16
17
dump : Boolean = false ,
17
18
noOptimize : Boolean = false ,
18
19
embedResources : Boolean = false ,
20
+ resourceIncludePatterns : List [String ] = Nil ,
21
+ resourceExcludePatterns : List [String ] = Nil ,
19
22
multithreading : Option [Boolean ] = None ,
20
23
incrementalCompilation : Boolean = false ,
21
24
baseName : Option [String ] = None ,
@@ -24,7 +27,9 @@ case class NativeConfigOptions(
24
27
compileOption : List [String ] = List .empty,
25
28
targetTriple : Option [String ] = None ,
26
29
clang : Option [String ] = None ,
27
- clangPP : Option [String ] = None
30
+ clangPP : Option [String ] = None ,
31
+ serviceProviders : List [(String , String )] = Nil ,
32
+ sanitizer : Option [String ] = None
28
33
)
29
34
30
35
object NativeConfigOptions {
@@ -81,6 +86,15 @@ object NativeConfigOptions {
81
86
c.copy(nativeConfig = c.nativeConfig.copy(checkFatalWarnings = true ))
82
87
)
83
88
.text(" Shall linker NIR check treat warnings as errors? [false]" )
89
+ parser
90
+ .opt[Boolean ](" check-features" )
91
+ .optional()
92
+ .action((x, c) =>
93
+ c.copy(nativeConfig = c.nativeConfig.copy(checkFeatures = Some (x)))
94
+ )
95
+ .text(
96
+ " Shall build fail if it detects usage of unsupported feature on given platform? [true]"
97
+ )
84
98
parser
85
99
.opt[Unit ](" dump" )
86
100
.optional()
@@ -93,6 +107,34 @@ object NativeConfigOptions {
93
107
c.copy(nativeConfig = c.nativeConfig.copy(noOptimize = true ))
94
108
)
95
109
.text(" Should the resulting NIR code be not optimized? [false]" )
110
+ parser
111
+ .opt[String ](" embed-resources-include" )
112
+ .optional()
113
+ .unbounded()
114
+ .action((x, c) =>
115
+ c.copy(nativeConfig =
116
+ c.nativeConfig.copy(resourceIncludePatterns =
117
+ x :: c.nativeConfig.resourceIncludePatterns
118
+ )
119
+ )
120
+ )
121
+ .text(
122
+ " Add glob pattern for resource files that should be embeded in the binary [**]"
123
+ )
124
+ parser
125
+ .opt[String ](" embed-resources-exclude" )
126
+ .optional()
127
+ .unbounded()
128
+ .action((x, c) =>
129
+ c.copy(nativeConfig =
130
+ c.nativeConfig.copy(resourceExcludePatterns =
131
+ x :: c.nativeConfig.resourceExcludePatterns
132
+ )
133
+ )
134
+ )
135
+ .text(
136
+ " Add glob pattern for resource files that should not be embeded in the binary"
137
+ )
96
138
parser
97
139
.opt[Unit ](" embed-resources" )
98
140
.optional()
@@ -137,6 +179,7 @@ object NativeConfigOptions {
137
179
.opt[String ](" ltp" )
138
180
.valueName(" <keystring=value>" )
139
181
.optional()
182
+ .unbounded()
140
183
.action((x, c) =>
141
184
c.copy(nativeConfig =
142
185
c.nativeConfig.copy(ltp = c.nativeConfig.ltp :+ x)
@@ -145,6 +188,29 @@ object NativeConfigOptions {
145
188
.text(
146
189
" User defined properties resolved at link-time. Multiple can be defined. Example: \" isCli=true\" "
147
190
)
191
+ parser
192
+ .opt[String ](" service-providers" )
193
+ .valueName(" <serviceName:implementationName>" )
194
+ .optional()
195
+ .unbounded()
196
+ .action((x, c) =>
197
+ x.split(':' ) match {
198
+ case Array (serviceName, serviceImplementation) =>
199
+ c.copy(nativeConfig =
200
+ c.nativeConfig.copy(serviceProviders =
201
+ c.nativeConfig.serviceProviders :+ (serviceName, serviceImplementation)
202
+ )
203
+ )
204
+ case _ =>
205
+ parser.reportWarning(
206
+ " Invalid format for 'service-providers', expected <serviceName:implementationName>"
207
+ )
208
+ c
209
+ }
210
+ )
211
+ .text(
212
+ " Explicitly enabled service providers that should be avaiable in the executable"
213
+ )
148
214
parser
149
215
.opt[String ](" linking-option" )
150
216
.valueName(" <passed-option>" )
@@ -196,5 +262,22 @@ object NativeConfigOptions {
196
262
.text(
197
263
" Path to the `clang++` executable. Internally discovered if not specified."
198
264
)
265
+ parser
266
+ .opt[String ](" sanitizer" )
267
+ .optional()
268
+ .action { (x, c) =>
269
+ val supportedSanitizers = Seq (" thread" , " address" , " undefined" )
270
+ if (supportedSanitizers.contains(x))
271
+ c.copy(nativeConfig = c.nativeConfig.copy(sanitizer = Some (x)))
272
+ else {
273
+ parser.reportWarning(
274
+ s " Unsupported sanitizer type ' $x', allowed values: ${supportedSanitizers.mkString(" , " )}"
275
+ )
276
+ c
277
+ }
278
+ }
279
+ .text(
280
+ " Path to the `clang++` executable. Internally discovered if not specified."
281
+ )
199
282
}
200
283
}
0 commit comments