Skip to content

Commit 6812f1e

Browse files
Sync with 0.5.9 snapshots - add copt and cppopt flags (#47)
* Sync with 0.5.9 snapshots - add copt and cppopt flags * Test with latest snapshot
1 parent d0fd95b commit 6812f1e

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.scalanative.nir.Proxy.nativeBinaryVersion
33

44
val ScalaNativeVersion = envOrNone("CI_NATIVE_VERSION")
55
.filterNot(_.isEmpty)
6-
.getOrElse("0.5.8")
6+
.getOrElse("0.5.9-20251012-9628085-SNAPSHOT")
77

88
val crossScalaVersions212 = (14 to 20).map("2.12." + _)
99
val crossScalaVersions213 = (8 to 17).map("2.13." + _)

cli/src/main/scala/scala/scalanative/cli/options/NativeConfigOptions.scala

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ case class NativeConfigOptions(
2525
ltp: List[String] = List.empty,
2626
linkingOption: List[String] = List.empty,
2727
compileOption: List[String] = List.empty,
28+
cCompileOptions: List[String] = List.empty,
29+
cppCompileOptions: List[String] = List.empty,
2830
targetTriple: Option[String] = None,
2931
clang: Option[String] = None,
3032
clangPP: Option[String] = None,
@@ -227,12 +229,43 @@ object NativeConfigOptions {
227229
.valueName("<passed-option>")
228230
.optional()
229231
.unbounded()
230-
.action((x, c) =>
232+
.action((value, c) =>
231233
c.copy(nativeConfig =
232-
c.nativeConfig.copy(compileOption = c.nativeConfig.compileOption :+ x)
234+
c.nativeConfig
235+
.copy(cCompileOptions = c.nativeConfig.cCompileOptions :+ value)
233236
)
234237
)
235238
.text("Compilation options passed to LLVM. Multiple can be defined.")
239+
parser
240+
.opt[String]("c-compile-option")
241+
.valueName("<option>")
242+
.optional()
243+
.unbounded()
244+
.abbr("-copt")
245+
.text(
246+
"Compilation options used when compiling C files only. Multiple can be defined."
247+
)
248+
.action((value, c) =>
249+
c.copy(nativeConfig =
250+
c.nativeConfig
251+
.copy(cCompileOptions = c.nativeConfig.cCompileOptions :+ value)
252+
)
253+
)
254+
parser
255+
.opt[String]("cpp-compile-option")
256+
.valueName("<option>")
257+
.optional()
258+
.unbounded()
259+
.abbr("-cppopt")
260+
.text(
261+
"Compilation options used when compiling C++ files only. Multiple can be defined."
262+
)
263+
.action((value, c) =>
264+
c.copy(nativeConfig =
265+
c.nativeConfig
266+
.copy(cCompileOptions = c.nativeConfig.cppCompileOptions :+ value)
267+
)
268+
)
236269
parser
237270
.opt[String]("target-triple")
238271
.valueName("<config-string>")

cli/src/main/scala/scala/scalanative/cli/utils/ConfigConverter.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ object ConfigConverter {
113113
.withClang(clang)
114114
.withClangPP(clangPP)
115115
.withCompileOptions(options.nativeConfig.compileOption)
116+
.withCOptions(options.nativeConfig.cCompileOptions)
117+
.withCppOptions(options.nativeConfig.cppCompileOptions)
116118
.withLinkingOptions(options.nativeConfig.linkingOption)
117119
.withLinktimeProperties(ltp)
118120
.withBuildTarget(options.nativeConfig.buildTarget)

0 commit comments

Comments
 (0)