Fri*_*igo 2 eclipse java-native-interface native lwjgl gradle
我正在尝试使用Gradle的示例LWJGL应用程序。LWJGL在jar lwjgl-platform-2.8.5-natives-windows.jar中具有OpenGL和OpenAL的本机绑定,但是,Gradle似乎无法识别这一事实。
应用程序插件的distZip任务正确地将所有jar文件复制到zip的lib目录中,但是,在.bat文件中,它仅将上述本地jar放在类路径中,而没有将其作为显式本地传递给Java。
同样,Eclipse项目生成也无法设置给定依赖项的“本机库位置”。
是否有任何官方解决方案可将本机库正确添加到生成的应用程序或Eclipse项目中;如果没有,围绕此限制是否有不错的解决方法?
我的gradle.build:
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
sourceCompatibility = 1.7
mainClassName = 'org.lwjgl.examples.Game'
repositories {
mavenCentral();
}
dependencies {
compile group: 'com.google.guava', name: 'guava', version: 'latest.release'
compile group: 'org.apache.commons', name: 'commons-lang3', version: 'latest.release'
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl', version: 'latest.release'
testCompile group: 'com.jayway.awaitility', name: 'awaitility', version: 'latest.release'
testCompile group: 'junit', name: 'junit', version: 'latest.release'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: 'latest.release'
testCompile group: 'org.mockito', name: 'mockito-core', version: 'latest.release'
}
jar {
baseName = rootProject.name
version = System.env['BUILD_NUMBER']
version = version == null ? 0 : version
manifest {
attributes("Implementation-Title": baseName, "Implementation-Version": version)
}
}
Run Code Online (Sandbox Code Playgroud)
生成的zip分发的内容:
/lib//bin/tyle
/lib//bin/tyle.bat
/lib/commons-lang3-3.1.jar
/lib/guava-14.0-rc2.jar
/lib/jinput-2.0.5.jar
/lib/jinput-platform-2.0.5-natives-linux.jar
/lib/jinput-platform-2.0.5-natives-osx.jar
/lib/jinput-platform-2.0.5-natives-windows.jar
/lib/jutils-1.0.0.jar
/lib/lwjgl-2.8.5.jar
/lib/lwjgl-platform-2.8.5-natives-linux.jar
/lib/lwjgl-platform-2.8.5-natives-osx.jar
/lib/lwjgl-platform-2.8.5-natives-windows.jar
/lib/tyle-0.jar
Run Code Online (Sandbox Code Playgroud)
lwjgl-platform-2.8.5-natives-windows.jar的内容:
META-INF/MANIFEST.MF
lwjgl.dll
lwjgl64.dll
OpenAL32.dll
OpenAL64.dll
Run Code Online (Sandbox Code Playgroud)
我一直在努力解决类似问题,并且已经启动了Gradle Natives插件来管理Java库的本地依赖项。另请参阅博客文章“ 使用Gradle本地化 ”,在其中我会详细介绍。
基本上,它将提供的本机库解压缩到“本机”构建目录中,以供使用和进一步打包。
| 归档时间: |
|
| 查看次数: |
5136 次 |
| 最近记录: |