forked from NetLogo/NetLogo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNativeLibs.scala
51 lines (39 loc) · 1.57 KB
/
NativeLibs.scala
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
import sbt.TaskKey, sbt.Keys._
import sbt.io.{ IO, syntax }, syntax._
import java.io.File
import java.net.URL
import NetLogoBuild.cclArtifacts
import scala.language.postfixOps
// native libraries for JOGL
object NativeLibs {
val nativeLibs = TaskKey[Seq[File]](
"native-libs", "download native libraries for JOGL")
val cocoaLibs = TaskKey[Seq[File]](
"download native libraries for mac interaction")
lazy val nativeLibsTask =
nativeLibs := {
val baseURL = "https://s3.amazonaws.com/ccl-artifacts/"
val joglNatives = baseDirectory.value / "natives"
val joglTmp = baseDirectory.value / "jogl-2.4.0-natives-rc-20200307.zip"
val joglUrl = new URL(baseURL + "jogl-2.4.0-natives-rc-20200307.zip")
IO.createDirectory(joglNatives)
FileActions.download(joglUrl, joglTmp)
IO.unzip(joglTmp, joglNatives)
IO.delete(joglTmp)
// if we need any additional libraries
// excluded by this, make sure the copyright notice is updated
(joglNatives.allPaths).get.foreach { f =>
if (Seq("jocl", "mobile", "newt", "openal", "oal", "jogl_cg", "joal")
.exists(notwanted => f.getName.contains(notwanted)))
IO.delete(f)
}
(joglNatives.allPaths).get
}
lazy val cocoaLibsTask =
cocoaLibs := {
val libDir = baseDirectory.value / "natives" / "macosx-universal"
IO.createDirectory(libDir / "natives")
FileActions.download(new java.net.URL(cclArtifacts("libjcocoa.dylib")), libDir / "libjcocoa.dylib")
Seq(libDir / "libjcocoa.dylib")
}
}