Skip to content

Commit f6bda28

Browse files
committed
use NDK 27, support flexible page sizes
1 parent 31495dc commit f6bda28

5 files changed

Lines changed: 19 additions & 50 deletions

File tree

jitpack.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
before_install:
22
- sdk install java 17.0.11-jbr
3-
- sdk use java 17.0.11-jbr
4-
- yes | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-34"
5-
- yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;34.0.0"
3+
- sdk use java 17.0.11-jbr

lib/build.gradle

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ plugins {
88

99
group = 'com.github.dalgarins'
1010

11-
gradle.projectsEvaluated {
12-
preBuild.dependsOn(buildSqlite)
13-
}
14-
1511
android {
1612
namespace 'org.spatialite'
1713
compileSdk 34
18-
ndkVersion '21.0.6113669'
14+
ndkVersion '27.3.13750724'
1915

2016
defaultConfig {
2117
minSdk 21
2218

2319
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2420
consumerProguardFiles "consumer-rules.pro"
21+
22+
externalNativeBuild {
23+
ndkBuild {
24+
arguments "-j8", "V=1"
25+
}
26+
}
2527
}
2628

2729
buildTypes {
@@ -42,6 +44,12 @@ android {
4244
}
4345

4446
sourceSets.main.jni.srcDirs = ['src/main/none']
47+
48+
externalNativeBuild {
49+
ndkBuild {
50+
path "src/main/jni/Android.mk"
51+
}
52+
}
4553
}
4654

4755
ext {
@@ -62,46 +70,7 @@ tasks.register('installSqlite', Copy) {
6270
into 'src/main/jni/ndk-modules/sqlite'
6371
}
6472

65-
def ndkDir = System.getenv("NDK_HOME")
66-
if (ndkDir == null) {
67-
def propertiesFile = project.rootProject.file('local.properties')
68-
if (propertiesFile.exists()) {
69-
Properties properties = new Properties()
70-
properties.load(propertiesFile.newDataInputStream())
71-
ndkDir = properties.getProperty('ndk.dir')
72-
if (ndkDir == null) {
73-
throw GradleScriptException("Either NDK_HOME or ndk.dir in local.properties should point to Android NDK!")
74-
}
75-
} else {
76-
throw GradleScriptException("Either NDK_HOME or ndk.dir in local.properties should point to Android NDK!")
77-
}
78-
}
79-
80-
tasks.register('buildSqlite', Exec) {
81-
dependsOn installSqlite
82-
println("NDK directory: $ndkDir")
83-
84-
// Add NDK_DEBUG=1 for debug symbols or V=1 for verbose building output
85-
if (OperatingSystem.current().linux) {
86-
commandLine "$ndkDir/ndk-build", '-j8', '-C', file('src/main/jni').absolutePath
87-
} else if (OperatingSystem.current().windows) {
88-
commandLine "$ndkDir/ndk-build.cmd", '-j8', '-C', file('src/main/jni').absolutePath
89-
} else {
90-
commandLine "$ndkDir/ndk-build", '-j8', '-C', file('src/main/jni').absolutePath
91-
}
92-
}
93-
94-
tasks.register('ndkClean', Exec) {
95-
if (OperatingSystem.current().linux) {
96-
commandLine "$ndkDir/ndk-build", 'clean', '-C', file('src/main/jni').absolutePath
97-
} else if (OperatingSystem.current().windows) {
98-
commandLine "$ndkDir/ndk-build.cmd", 'clean', '-C', file('src/main/jni').absolutePath
99-
} else {
100-
commandLine "$ndkDir/ndk-build", 'clean', '-C', file('src/main/jni').absolutePath
101-
}
102-
}
103-
104-
clean.dependsOn 'ndkClean'
73+
preBuild.dependsOn installSqlite
10574

10675
dependencies {
10776

lib/src/main/jni/Android.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ include $(BUILD_SHARED_LIBRARY)
3434
# The library concrete version subfolder name must match its .mk file.
3535
# E.g. libxml2-2.9.2/ -> libxml2-2.9.2.mk
3636

37-
NDK_MODULES_PATH := ndk-modules
37+
NDK_MODULES_PATH := $(LOCAL_PATH)/ndk-modules
3838

3939
SPATIALITE_PATH := libspatialite-4.3.0a
4040
PROJ4_PATH := proj-4.8.0

lib/src/main/jni/Application.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ APP_STL := c++_shared
22
APP_OPTIM := release
33
APP_ABI := armeabi-v7a,arm64-v8a,x86,x86_64
44
APP_PLATFORM := android-21
5+
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
6+
APP_CPPFLAGS := -std=c++14
57
NDK_TOOLCHAIN_VERSION := clang
68
NDK_APP_LIBS_OUT=../jniLibs
79
# Temp workaround for https://github.com/android-ndk/ndk/issues/332

lib/src/main/jni/ndk-modules/libiconv/libiconv-1.13.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LOCAL_MODULE := iconv
66
LOCAL_CFLAGS := \
77
-Wno-multichar \
88
-D_ANDROID \
9-
-DLIBDIR "$(LOCAL_PATH)/$(ICONV_PATH)/libcharset/lib" \
9+
-DLIBDIR=\"$(LOCAL_PATH)/$(ICONV_PATH)/libcharset/lib\" \
1010
-DBUILDING_LIBICONV \
1111
-DIN_LIBRARY
1212

0 commit comments

Comments
 (0)