hqjenny-rocket-chip/build.sbt

105 lines
3.7 KiB
Plaintext
Raw Normal View History

2017-12-13 10:12:30 +08:00
// See LICENSE.Berkeley for license details.
import sbt.complete._
import sbt.complete.DefaultParsers._
import xerial.sbt.pack._
import sys.process._
enablePlugins(PackPlugin)
2017-12-13 10:12:30 +08:00
lazy val commonSettings = Seq(
organization := "edu.berkeley.cs",
version := "1.2-SNAPSHOT",
2018-07-04 07:49:35 +08:00
scalaVersion := "2.12.4",
crossScalaVersions := Seq("2.12.4"),
2017-12-13 10:12:30 +08:00
parallelExecution in Global := false,
traceLevel := 15,
2018-07-04 07:49:35 +08:00
scalacOptions ++= Seq("-deprecation","-unchecked","-Xsource:2.11"),
2017-12-13 10:12:30 +08:00
libraryDependencies ++= Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value),
2018-12-14 10:45:10 +08:00
libraryDependencies ++= Seq("org.json4s" %% "json4s-jackson" % "3.6.1"),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { x => false },
pomExtra := <url>https://github.com/freechipsproject/rocket-chip</url>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
<license>
<name>BSD-style</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/freechipsproject/rocketchip.git</url>
<connection>scm:git:github.com/freechipsproject/rocketchip.git</connection>
</scm>,
publishTo := {
val v = version.value
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) {
Some("snapshots" at nexus + "content/repositories/snapshots")
}
else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
}
2017-12-13 10:12:30 +08:00
)
lazy val chisel = (project in file("chisel3")).settings(commonSettings)
def dependOnChisel(prj: Project) = {
if (sys.props.contains("ROCKET_USE_MAVEN")) {
prj.settings(
libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % "3.2-SNAPSHOT")
)
} else {
prj.dependsOn(chisel)
}
}
lazy val hardfloat = dependOnChisel(project).settings(commonSettings)
.settings(crossScalaVersions := Seq("2.12.4"))
.settings(publishArtifact := false)
lazy val `rocket-macros` = (project in file("macros")).settings(commonSettings)
.settings(publishArtifact := false)
lazy val rocketchip = dependOnChisel(project in file("."))
2017-12-13 10:12:30 +08:00
.settings(commonSettings, chipSettings)
.dependsOn(hardfloat % "compile-internal;test-internal")
.dependsOn(`rocket-macros` % "compile-internal;test-internal")
.settings(
aggregate := false,
// Include macro classes, resources, and sources in main jar.
mappings in (Compile, packageBin) ++= (mappings in (hardfloat, Compile, packageBin)).value,
mappings in (Compile, packageSrc) ++= (mappings in (hardfloat, Compile, packageSrc)).value,
mappings in (Compile, packageBin) ++= (mappings in (`rocket-macros`, Compile, packageBin)).value,
mappings in (Compile, packageSrc) ++= (mappings in (`rocket-macros`, Compile, packageSrc)).value,
exportJars := true
)
2017-12-13 10:12:30 +08:00
lazy val addons = settingKey[Seq[String]]("list of addons used for this build")
lazy val make = inputKey[Unit]("trigger backend-specific makefile command")
val setMake = NotSpace ~ ( Space ~> NotSpace )
lazy val chipSettings = Seq(
2017-12-13 10:12:30 +08:00
addons := {
val a = sys.env.getOrElse("ROCKETCHIP_ADDONS", "")
println(s"Using addons: $a")
a.split(" ")
},
unmanagedSourceDirectories in Compile ++= addons.value.map(baseDirectory.value / _ / "src/main/scala"),
mainClass in (Compile, run) := Some("rocketchip.Generator"),
make := {
val jobs = java.lang.Runtime.getRuntime.availableProcessors
val (makeDir, target) = setMake.parsed
(run in Compile).evaluated
s"make -C $makeDir -j $jobs $target".!
2017-12-13 10:12:30 +08:00
}
)