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)
The configuration of the toolchain.
The path to the resulting native binary.
outpath
, the path to the resulting native binary.
Utility methods for building code using Scala Native.