Build
object Build
Utility methods for building code using Scala Native.
Value members
Concrete methods
Run the complete Scala Native pipeline, LLVM optimizer and system linker, producing a native binary in the end.
Run the complete Scala Native pipeline, LLVM optimizer and system linker, producing a native binary in the end.
For example, to produce a binary one needs a classpath, a working directory and a main class entry point:
val classpath: Seq[Path] = ...
val workdir: Path = ...
val main: String = ...
val clang = Discover.clang()
val clangpp = Discover.clangpp()
val linkopts = Discover.linkingOptions()
val compopts = Discover.compileOptions()
val outpath = workdir.resolve("out")
val config =
Config.empty
.withCompilerConfig{
NativeConfig.empty
.withGC(GC.default)
.withMode(Mode.default)
.withClang(clang)
.withClangPP(clangpp)
.withLinkingOptions(linkopts)
.withCompileOptions(compopts)
.withLinkStubs(true)
}
.withMainClass(main)
.withClassPath(classpath)
.withWorkdir(workdir)
Build.build(config, outpath)
- Value parameters:
- config
The configuration of the toolchain.
- outpath
The path to the resulting native binary.
- Returns:
outpath
, the path to the resulting native binary.