aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2013-06-18 19:40:22 +0200
committerJakob Odersky <jodersky@gmail.com>2013-06-18 19:40:22 +0200
commit98241aa830bedb006ae041dce661afd57c3d90a8 (patch)
tree70443e7597aca759733e587220a8323fde89af1f /project
parentb0c32f5325702dd7f7ef3d5ccc0eb9a2b972cf7a (diff)
downloadakka-serial-98241aa830bedb006ae041dce661afd57c3d90a8.tar.gz
akka-serial-98241aa830bedb006ae041dce661afd57c3d90a8.tar.bz2
akka-serial-98241aa830bedb006ae041dce661afd57c3d90a8.zip
use sbt-native plugin and restructure build
Diffstat (limited to 'project')
-rw-r--r--project/Build.scala34
-rw-r--r--project/Jni.scala2
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",