问题描述
我已经为此苦苦思索了一个多小时,Google 上似乎没有任何东西可以给我一个决定性的答案.
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.
我将 IntelliJ IDEA 13.1.3
与 scala 和 sbt 插件、Scala 2.11.1
和 SBT 0.13
I'm using IntelliJ IDEA 13.1.3
with the scala and sbt plugins, Scala 2.11.1
, and SBT 0.13
认为我很聪明,我将 LWJGL 的 Maven 存储库添加到我的 build.sbt 中
Thinking I was clever I added the Maven repository for LWJGL to my build.sbt
libraryDependencies += "org.lwjgl.lwjgl" % "lwjgl" % "2.9.1"
后来才发现我需要 [将编译器指向 LWJGL 原生].
Only to later find out that I need to [point the compiler to the LWJGL natives].
现在问题来了:让 SBT 下载库,但不会将它们放在项目的任何目录中,这使得指向库有点困难.
Now here's the problem: Asking SBT to download libraries, doesn't put them in any of the project's directories, making the pointing to the libraries a tad difficult.
我尝试使用 [sbt-lwjgl-plugin] 没有任何运气,甚至像文档建议的那样强制使用早期版本的 SBT.
I tried using the [sbt-lwjgl-plugin] without any luck, even forcing an earlier version of SBT like the documentation suggests.
所以我发现自己陷入了僵局,我该怎么办?手动下载库并将其转储到项目目录中?或者有没有更自动的方法来处理这个问题?
So I'm finding myself at an impasse, what am I supposed to do? Manually download the library and dump it into the project directories? Or is there a more automatic way for me to deal with this?
推荐答案
您可以通过简单地将以下代码段添加到您的 build.sbt
中来包含 LWJGL(与本机):
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"
)
}
}
}
classifier
函数很遗憾没有记录,所以我花了一些时间才找到它.
The classifier
function sadly is very undocumented so it took me some time to find this out.
这篇关于无法使用 IDEA 和 SBT 运行 LWJGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论