Gradle如何添加本地依赖? [Libgdx] [英] Gradle how to add native dependency? [Libgdx]

查看:172
本文介绍了Gradle如何添加本地依赖? [Libgdx]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个默认的Libgdx Gradle设置,我需要将我的简单文本渲染库添加到它。它由一个.jar文件和本地lib文件组成。



build.gradle脚本的这一行看起来像我期望的那样工作,它的功能是添加jfreetype。 jar库到我的构建路径。

 编译文件('../ local_lib / jfreetype.jar')

是否有像这样的魔术命令来添加我的文件系统上可用的本地库(准确地说是.dll)并没有Maven化?

  natives../local_lib/jfreetype32.dll

这行代码只是给我一个错误,说在某些回购中找不到某些东西。我猜应该有一个类似于.jar文件的神奇行来添加本地文件,这些文件只能在我的文件系统上使用,而不能在某些回购文件中使用。 解决方案

Gradle Natives插件应该做你想做的。
您可以指定一个配置,指向包含本地dll / so的jar文件。一个gradle任务unpackNatives然后将dll / so打包到build dirs中。


根据您启动应用程序的方式,您可能仍然需要告诉Java运行时在哪里可以找到dll / so。有一些关于如何在项目网站工作的信息:



https://github.com/cjstehno/gradle-natives


I have a default Libgdx Gradle setup, and I need to add my simple text rendering library to it. It consists of a .jar file and native lib file.

This line of build.gradle script seems to work as I would expect, and what it does is add jfreetype.jar java library to my build path.

compile files('../local_lib/jfreetype.jar')

Is there a magic command like this to add native library (.dll to be exact) that is available on my file system and is not Mavenized?

natives "../local_lib/jfreetype32.dll"

This line of code just gives me an error saying that something cannot be found at some repo. I guess there should be a magical line like with .jar file to add native files that are available only on my file system and not on some repo.

解决方案

The Gradle Natives plugin should do what you want. You can specify a configuration that points at jar files that contain native dll/so. A gradle task "unpackNatives" will then unpack the dll/so into the build dirs.

Depending upon how you launch your application, you may still need to tell the Java runtime where to find the dll/so. There is some info about how this works at the project website:

https://github.com/cjstehno/gradle-natives

这篇关于Gradle如何添加本地依赖? [Libgdx]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆