Skip to content

Adding CLI option for cross-compiling on Scala Native #2766

Open
@windymelt

Description

@windymelt

Is your feature request related to a problem? Please describe.

Scala Native has its cross-compiling feature that is came from clang/LLVM.

https://scala-native.org/en/stable/user/sbt.html#cross-compilation

nativeConfig ~= { _.withTargetTriple("x86_64-apple-macosx10.14.0") }

Though Scala CLI has some CLI options that manipulates Scala Native, there is no option to handle with target triple.

(Scala CLI have --native-target, but it sets artifact type e.g. application / dynamic lib / static lib)

Describe the solution you'd like

Add --native-target-triple to provide target triple info for Scala Native (and clang/LLVM)

Describe alternatives you've considered

We can convert foobar.scala.sc into sbt project, and manually add Scala Native configurations.

Additional context

I tried building native binary via Docker Image (virtuslab/scala-cli), and that's quite easy (I wrote build stage, and copied binary to host or another thin stage). If we have cross-compiling feature, that's awesome build infrastructure for small tool (like Go, Rust).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions