-
Notifications
You must be signed in to change notification settings - Fork 130
/
build.gradle
82 lines (75 loc) · 2.23 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def pocketsphinx_dir = properties.getProperty('pocketsphinx.dir')
def sphinxbase_dir = properties.getProperty('sphinxbase.dir')
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 14
targetSdkVersion 29
versionCode 5
versionName "5prealpha"
setProperty("archivesBaseName", "pocketsphinx-android-$versionName")
externalNativeBuild {
cmake {
arguments "-DPOCKETSPHINX_DIR=$pocketsphinx_dir", "-DSPHINXBASE_DIR=$sphinxbase_dir"
}
}
ndk {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'build/generated-src']
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
task swig {
doFirst {
assert file("$sphinxbase_dir/include").exists()
assert file("$pocketsphinx_dir/include").exists()
}
doLast {
mkdir 'build/generated-src/java'
mkdir 'build/generated-src/cpp'
exec {
commandLine 'swig',
"-I$sphinxbase_dir/include", "-I$sphinxbase_dir/swig",
"-java", "-package", "edu.cmu.pocketsphinx",
"-outdir", "build/generated-src/java", "-o", "build/generated-src/cpp/sphinxbase_wrap.c",
"$sphinxbase_dir/swig/sphinxbase.i"
}
exec {
commandLine 'swig',
"-I$sphinxbase_dir/swig",
"-I$pocketsphinx_dir/include",
"-I$pocketsphinx_dir/swig",
"-java", "-package", "edu.cmu.pocketsphinx",
"-outdir", "build/generated-src/java", "-o", "build/generated-src/cpp/pocketsphinx_wrap.c",
"$pocketsphinx_dir/swig/pocketsphinx.i"
}
}
}
preBuild.dependsOn swig