forked from liteglue/Android-sqlite-native-driver
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
85 lines (73 loc) · 3.44 KB
/
build.gradle
File metadata and controls
85 lines (73 loc) · 3.44 KB
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
apply plugin: 'com.android.library'
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
android {
repositories {
google()
mavenCentral()
}
namespace 'com.hotwirestudios.sqlite.driver'
compileSdkVersion 33
ndkPath '/Users/Alexander/Library/Android/sdk/ndk/'
defaultConfig {
minSdkVersion 16
targetSdkVersion 33
versionCode 1
versionName "1.0"
consumerProguardFiles 'proguard-rules.txt'
}
sourceSets {
main {
jniLibs.srcDirs += 'libs'
}
}
// See https://github.com/bytedeco/javacpp/blob/master/src/main/resources/org/bytedeco/javacpp/properties/ for defaults
libraryVariants.all { variant ->
variant.getJavaCompileProvider().get().doLast {
println 'javacpp ' + variant.name
def projectRoot = projectDir.getCanonicalPath()
def ndkRoot = android.getNdkDirectory().getCanonicalPath()
def cp = variant.getJavaCompileProvider().get().destinationDir.getCanonicalPath()
buildSQLiteTask(cp, ndkRoot, projectRoot, 'arm', 'arm-linux-androideabi', 'arm-linux-androideabi', '-march=armv5te -mtune=xscale -msoft-float', 'armeabi')
buildSQLiteTask(cp, ndkRoot, projectRoot, 'arm', 'arm-linux-androideabi', 'arm-linux-androideabi', '-march=armv7-a -mfloat-abi=softfp -mfpu=neon -ffast-math -Wl,--fix-cortex-a8', 'armeabi-v7a')
buildSQLiteTask(cp, ndkRoot, projectRoot, 'arm64', 'aarch64-linux-android', 'aarch64-linux-android', ' ', 'arm64-v8a')
buildSQLiteTask(cp, ndkRoot, projectRoot, 'x86', 'x86', 'i686-linux-android', ' ', 'x86')
buildSQLiteTask(cp, ndkRoot, projectRoot, 'x86_64', 'x86_64', 'x86_64-linux-android', ' ', 'x86_64')
println 'javacpp done'
}
}
}
configurations {
javacpp
}
dependencies {
implementation 'org.bytedeco:javacpp:1.2.1'
javacpp 'org.bytedeco:javacpp:1.2.1'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'com.parse.bolts:bolts-tasks:1.4.0'
}
def buildSQLiteTask(cp, ndkRoot, projectRoot, androidArchitecture, compilerArchitecture, compilerPrefix, flags, outputArchitecture) {
javaexec {
main 'org.bytedeco.javacpp.tools.Builder'
classpath configurations.javacpp
args '-cp', cp,
'-properties', 'android-arm',
'-Dplatform.root=' + ndkRoot,
'-Dplatform.sysroot=platforms/android-23/arch-' + androidArchitecture,
'-Dplatform.compiler.default=' + flags,
'-Dplatform.compiler=toolchains/' + compilerArchitecture + '-4.9/prebuilt/darwin-x86_64/bin/' + compilerPrefix + '-g++',
'-Dplatform.includepath=sources/cxx-stl/gnu-libstdc++/4.9/include:sources/cxx-stl/gnu-libstdc++/4.9/libs/' + outputArchitecture + '/include:' + projectRoot + '/sqlite-amalgamation:' + projectRoot + '/rapidjson/include:' + projectRoot + '/sqlite-rapidjson',
'-Dplatform.linkpath=sources/cxx-stl/gnu-libstdc++/4.9/libs/' + outputArchitecture + ':' + projectRoot + '/libs/' + outputArchitecture,
'-d', projectRoot + '/libs/' + outputArchitecture,
'com.hotwirestudios.sqlite.driver.SQLiteNative'
}
}