diff options
Diffstat (limited to 'project')
-rw-r--r-- | project/Build.scala | 34 | ||||
-rw-r--r-- | project/Jni.scala | 2 |
2 files changed, 21 insertions, 15 deletions
diff --git a/project/Build.scala b/project/Build.scala index 5b157a7..73f0894 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -3,26 +3,32 @@ import Keys._ import com.github.jodersky.build.NativeKeys._ import com.github.jodersky.build.NativePlugin._ +import com.github.jodersky.build.NativeDefault import Jni._ object FlowBuild extends Build { val Organization = "com.github.jodersky" val Version = "1.0-SNAPSHOT" val ScalaVersion = "2.10.1" - - lazy val main = Project("flow-main", file("flow-main")).settings( - buildSettings ++ Seq(libraryDependencies ++= Dependencies.all): _* - ) - - lazy val native = NativeProject("flow-native", file("flow-native")).settings((Seq( - javahClasses := Seq("com.github.jodersky.flow.low.NativeSerial"), - includeDirectories in Native += jdkHome.value / "include" / "linux", - nativeSource in Native := baseDirectory.value / "src", - binaryType in Native := SharedLibrary, - binaryName in Native := "flow", - options in Native := Seq("-fPIC", "-O2"), - linkOptions in Native := Seq("-Wl,-soname,libflow.so.1") - ) ++ Jni.defaultSettings): _*).dependsOn(main) + + lazy val main: Project = Project("flow", file("."), settings = + Defaults.defaultSettings ++ + buildSettings ++ + NativeDefault.defaultSettings ++ + Seq( + libraryDependencies ++= Dependencies.all, + javahClasses := Seq("com.github.jodersky.flow.low.NativeSerial"), + includeDirectories in Native += jdkHome.value / "include" / "linux", + binaryType in Native := SharedLibrary, + binaryName in Native := "flow", + options in Native := Seq("-fPIC", "-O2"), + linkOptions in Native := Seq("-Wl,-soname,libflow.so.1"), + resourceGenerators in Compile <+= (resourceManaged in Compile, link in Native) map { (resDir, binary) => + val file = resDir / "native" / sys.props("os.name").toLowerCase / sys.props("os.arch").toLowerCase / binary.getName + IO.copyFile(binary, file) + Seq(file) + } + ) ++ Jni.defaultSettings) lazy val example = Project( id = "flow-example", diff --git a/project/Jni.scala b/project/Jni.scala index 0263786..8aacf3b 100644 --- a/project/Jni.scala +++ b/project/Jni.scala @@ -13,7 +13,7 @@ object Jni { javahHeaderDirectory := (sourceManaged in Native).value / "javah", javah := { - val cp = (fullClasspath in Compile).value.map(_.data.getAbsolutePath).mkString(":") + val cp = (classDirectory in Compile).value for (clazz <- javahClasses.value) { val parts = Seq( "javah", |