Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle how to add native dependency? [Libgdx]

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.

like image 995
Kristupas A. Avatar asked Feb 01 '15 15:02

Kristupas A.


1 Answers

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

like image 111
janh Avatar answered Oct 04 '22 15:10

janh