Reposting my stack overflow question from : http://stackoverflow.com/questions/31362266/regarding-linking-external-native-libs-opencv-c-in-gradle
I am creating a project that uses opencv C++ code. As of this moment I am only able to find the java executables being hosted in maven central at :-
http://mvnrepository.com/artifact/nu.pattern/opencv/2.4.9-4
So I installed opencv on my system and started using that for my project. In order to compile my project with the opencv headers I introduced the following in my build.gradle script:-
// C++ specific build configurations
// Acquiring environment variables
def opencvhome = System.getenv(“OPENCV_HOME”)
def opencvinclude = opencvhome + “\include”
model {
components {
main(NativeLibrarySpec) {
sources {
cpp {
source {
srcDirs "src/main/cpp"
include “**/*.cpp”
}
exportedHeaders {
srcDirs “src/main/include”, opencvinclude
}
}
}
}
}
}
This was for including the necessary headers. Notice the opencvinclude part as picked up as an environment variable which I set to the install location before running the gradle build.
Now my question is how do I add additional linkage dependencies of opencv?
https://docs.gradle.org/current/userguide/nativeBinaries.html
I consulted the above documentation. It only covers dependencies that are themselves gradle projects. But opencv C++ is not a gradle project. Can someone please help me out with this?