-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
68 lines (55 loc) · 1.75 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
}
}
android {
compileSdkVersion 21
buildToolsVersion "22.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
ndk {
moduleName "mupdf"
cFlags "-DANDROID_NDK -DDISABLE_IMPORTGL"
stl "stlport_static"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs' //set .so files location to libs
jni.srcDirs = [] //disable automatic ndk-build call
}
}
task showClasspath << {
buildscript.configurations.classpath.each { println it.name }
}
//Compile Jni
task buildNative(type: Exec, description: 'Compile JNI source via NDK') {
def ndkDir = plugins.getPlugin('com.android.library').sdkHandler.ndkFolder
if (System.properties['os.name'].toLowerCase().contains('windows')) {
commandLine "$ndkDir/ndk-build.cmd",
'-C', file('src/main/jni').absolutePath,
'-j', Runtime.runtime.availableProcessors(),
'all', 'NDK_DEBUG=1'
} else {
commandLine "$ndkDir/ndk-build",
'-C', file('src/main/jni').absolutePath,
'-j', Runtime.runtime.availableProcessors(),
'all', 'NDK_DEBUG=1'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative
}
}