All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.scalanative.build.LTO.scala Maven / Gradle / Ivy

There is a newer version: 0.5.5
Show newest version
package scala.scalanative.build

/** Link Time Optimization (LTO) mode to be used when during a release build.
 */
sealed abstract class LTO private (val name: String) {
  override def toString: String = name
}

object LTO {

  /** LTO disabled */
  private[scalanative] case object None extends LTO("none")

  /** LTO mode uses ThinLTO */
  private[scalanative] case object Thin extends LTO("thin")

  /** LTO mode uses standard LTO compilation */
  private[scalanative] case object Full extends LTO("full")

  def none: LTO = None
  def thin: LTO = Thin
  def full: LTO = Full

  /** Default LTO mode. */
  def default: LTO = None

  def apply(name: String): LTO = name.toLowerCase match {
    case "none" => None
    case "thin" => Thin
    case "full" => Full
    case value =>
      throw new IllegalArgumentException(s"Unknown LTO: '$value'")
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy