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 basedir: Path = ...
val main: String = ...
val logger: Logger = ...
val clang = Discover.clang()
val clangpp = Discover.clangpp()
val linkopts = Discover.linkingOptions()
val compopts = Discover.compileOptions()
val config =
Config.empty
.withCompilerConfig{
NativeConfig.empty
.withGC(GC.default)
.withMode(Mode.default)
.withMultithreading(enabled = false)
.withClang(clang)
.withClangPP(clangpp)
.withLinkingOptions(linkopts)
.withCompileOptions(compopts)
.withLinkStubs(true)
}
.withMainClass(main)
.withClassPath(classpath)
.withBaseDir(basedir)
.withModuleName(moduleName)
.withTestConfig(false)
.withLogger(logger)
Build.build(config)
- Value parameters:
- config
The configuration of the toolchain.
- Returns:
Config#artifactPath, the path to the resulting native binary.
Run the complete Scala Native pipeline, LLVM optimizer and system linker,
producing a native binary in the end, same as build
method.
Run the complete Scala Native pipeline, LLVM optimizer and system linker,
producing a native binary in the end, same as build
method.
This method skips the whole build and link process if the input hasn't changed from the previous build, and the previous build artifact is available at Config#artifactPath.
- Value parameters:
- config
The configuration of the toolchain.
- Returns:
Config#artifactPath, the path to the resulting native binary.