Skip to content

Instantly share code, notes, and snippets.

@bongole
Last active September 4, 2017 04:27
Show Gist options
  • Save bongole/05021bdd1f21578e1f6f to your computer and use it in GitHub Desktop.
Save bongole/05021bdd1f21578e1f6f to your computer and use it in GitHub Desktop.
gradle build file for JavaCPP
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android.libraryVariants.all{ variant ->
def projectDir = project.projectDir.absolutePath
def classesDir = variant.javaCompile.destinationDir
def jniDir = file("$classesDir/../../bundles/$variant.name/jni/").absolutePath
variant.javaCompile.doLast {
javaexec {
main = 'org.bytedeco.javacpp.tools.Builder'
classpath = files(configurations.javacpp.asPath)
args = [
'-cp', "$classesDir",
'-properties', 'android-x86',
'-Dplatform.root=/usr/local/opt/android-ndk',
'-Dplatform.compiler=/usr/local/opt/android-ndk/toolchains/x86-4.6/prebuilt/darwin-x86_64/bin/i686-linux-android-g++',
"-Dplatform.includepath=sources/cxx-stl/gnu-libstdc++/4.6/include/:sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/:$projectDir/jni/include",
"-d", "$jniDir/x86/"
]
}
}
}
configurations {
javacpp
}
dependencies {
javacpp 'org.bytedeco:javacpp:0.10'
compile configurations.javacpp.dependencies
//compile fileTree(dir: 'libs', include: ['*.jar'])
}
@leaf918
Copy link

leaf918 commented Sep 4, 2017

is there a project which is using this gradle file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment