1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
import sbt._
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" //version of flow library
val BinaryMajorVersion = 1 //binary major (api-level) version used to select so's and dlls when publishing
val ScalaVersion = "2.10.1"
lazy val commonSettings: Seq[Setting[_]] = Seq(
organization := Organization,
version := Version,
scalaVersion := ScalaVersion,
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/",
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature"))
lazy val runSettings: Seq[Setting[_]] = Seq(
fork := true,
connectInput in run := true)
lazy val main: Project = (
Project("flow-main", file("flow-main"))
settings (commonSettings: _*)
settings (
libraryDependencies += Dependencies.akka,
compileOrder in Compile := CompileOrder.Mixed
)
)
lazy val samples = (
Project("flow-samples-rwc", file("samples") / "rwc")
settings(commonSettings: _*)
settings(runSettings: _*)
dependsOn(main)
)
//---native projects --------------------------------------------------
lazy val commonNativeSettings: Seq[Setting[_]] = Seq(
includeDirectories in Native += file("flow-native") / "include",
javahClasses := Seq("com.github.jodersky.flow.internal.NativeSerial")) ++ Jni.defaultSettings
//---native unix like settings ----------------------------------------
val UnixBinaryName = "flow"
val UnixBinaryMinorVersion = 0
lazy val unixNativeSettings: Seq[Setting[_]] = commonNativeSettings ++ Seq(
flags in Native := Seq("-fPIC", "-O2"),
linkFlags in Native ++= Seq("-shared", s"-Wl,-soname,lib${UnixBinaryName}.so.${BinaryMajorVersion}"),
binaryName in Native := s"lib${UnixBinaryName}.so.${BinaryMajorVersion}.${UnixBinaryMinorVersion}")
lazy val nativeLinux = (
NativeProject("flow-native-linux", file("flow-native") / "unix")
settings (unixNativeSettings: _*)
settings (
nativeSource in Native := baseDirectory.value / "src",
includeDirectories in Native += jdkHome.value / "include" / "linux"
)
dependsOn (main)
)
/*
Seq(
libraryDependencies ++= Dependencies.all,
javahClasses := Seq("com.github.jodersky.flow.internal.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
*
*/
}
|