I\'ve been scratching myself in the head for a little over an hour with this, nothing on Google seems to be able to give me a decisive answer.
I\'m using Intel
You can include LWJGL (with natives) by simply adding the following snippet to your build.sbt
:
libraryDependencies ++= {
val version = "3.1.6"
val os = "windows" // TODO: Change to "linux" or "macos" if necessary
Seq(
"lwjgl",
"lwjgl-glfw",
"lwjgl-opengl"
// TODO: Add more modules here
).flatMap {
module => {
Seq(
"org.lwjgl" % module % version,
"org.lwjgl" % module % version classifier s"natives-$os"
)
}
}
}
The classifier
function sadly is very undocumented so it took me some time to find this out.
I know this is quite a bit old, but I thought this might help others who come across this problem. What I did myself was download the jar file from the site, extract the natives from the jar and add them to my resources directory. As for lwjgl I added it to my sbt project as you have. During runtime, I extracted the natives from the jar and loaded the native libraries using
System.load("<native-library-name>")
then set the natives directory for lwjgl using
System.setProperty("org.lwjgl.librarypath", <natives-path>)
Also, as for extracting the natives from your jar file during runtime, you could do something like this
val source = Channels.newChannel(
NativesLoader.getClass.getClassLoader.getResourceAsStream("<native>"))
val fileOut = new File(<desination directory>, "<native path in jar>")
val dest = new FileOutputStream(fileOut)
dest.getChannel.transferFrom(source, 0, Long.MaxValue)
source.close()
dest.close()