-
Notifications
You must be signed in to change notification settings - Fork 64
/
build.gradle
90 lines (76 loc) · 2.68 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
83
84
85
86
87
88
89
90
apply plugin: 'com.android.library'
// IMPORTANT!
// This variable should normally reflect the value of '--profile' argument when generating wrappers via 'swigpp-java.py' script!
def profiles = "valhalla+nmlmodellodtree"
def cmakeOptions = {
def jsonFile = file('$projectDir/../../../build/sdk_profiles.json')
def parsedJson = new groovy.json.JsonSlurper().parseText(jsonFile.text)
def profileList = profiles.split('\\+')
if (!profileList.contains('lite')) {
profileList += ['standard'];
}
def options = []
def defines = ''
for (profile in profileList) {
if (!parsedJson.containsKey(profile)) {
throw new java.lang.Exception("The profile ${profile} is not valid!")
}
if (parsedJson[profile].containsKey('cmake-options')) {
for (option in parsedJson[profile]['cmake-options'].split(';')) {
options += ['-D' + option]
}
}
if (parsedJson[profile].containsKey('defines')) {
for (define in parsedJson[profile]['defines'].split(';')) {
defines += '-D' + define + ' '
}
}
}
options + ['-DSDK_CPP_DEFINES=' + defines.trim()]
}
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 15
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
ndk {
abiFilters 'arm64-v8a', 'x86_64'
abiFilters 'x86', 'armeabi-v7a'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_static", "-DWRAPPER_DIR=${projectDir.absolutePath.replaceAll('\\\\', '/')}/../../../generated/android-java/wrappers"
cmakeOptions().each {option -> arguments option }
}
}
}
externalNativeBuild {
cmake {
path file("$projectDir/../../build/CMakeLists.txt")
}
}
sourceSets {
main {
java.srcDirs = ["$projectDir/../../../generated/android-java/proxies", "$projectDir/../../../android/java"]
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}