Skip to content

Commit

Permalink
Update android build
Browse files Browse the repository at this point in the history
* update NDK version 27
* enable 16KB page size

Signed-off-by: HyukWoo Park <[email protected]>
  • Loading branch information
clover2123 authored and ksh8281 committed Jul 31, 2024
1 parent 0f6ea46 commit dd479c4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,25 @@ ninja

## Build Android version

Build prerequisites on Ubuntu:
```sh
sudo apt install openjdk-17-jdk # require java 17
```

```sh
git clone https://github.com/Samsung/escargot.git
cd escargot
git submodule update --init third_party
export ANDROID_SDK_ROOT=.... # set your android SDK root first
cd build/android/
./gradlew bundleReleaseAar # build escargot AAR
./gradlew bundleHostJar # bundle jar for host
./gradlew javadocJar # create java doc
./gradlew sourcesJar # create sources jar

./gradlew assembleDebug # build debug test shell
./gradlew :escargot:connectedDebugAndroidTest # run escargot-jni tests on android device
./gradlew :escargot:testDebugUnitTest # run escargot-jni tests on host
./gradlew bundleHostJar # bundle jar for host
```

## Build Windows version
Expand Down
4 changes: 2 additions & 2 deletions build/android/escargot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ android {
}
}

ndkVersion '25.2.9519653'
ndkVersion '27.0.12077973'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -158,7 +158,7 @@ project.afterEvaluate {
}

task clearHostJar(type: Delete) {
delete 'build/outputs/escargot.jar'
delete 'build/libs/escargot.jar'
}

task bundleHostJar(type: Jar) {
Expand Down
6 changes: 4 additions & 2 deletions build/android/escargot/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ endif ()

if (UNDER_NDK)
FIND_LIBRARY(LOG_LIBRARY log)
else (UNDER_NDK)
else ()
FIND_PACKAGE(JNI REQUIRED)
INCLUDE_DIRECTORIES(${JNI_INCLUDE_DIRS})
endif ()

# enable 16KB page size (require version of Android NDK >= 27)
ADD_LINK_OPTIONS(-Wl,-z,max-page-size=16384)
TARGET_LINK_LIBRARIES (escargot-jni PRIVATE escargot ${LOG_LIBRARY})

if (ENABLE_SHELL)
Expand All @@ -53,4 +55,4 @@ if (ENABLE_SHELL)

ADD_EXECUTABLE(test-data-runner ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../tools/test/test-data-runner/test-data-runner.cpp)
TARGET_COMPILE_OPTIONS(test-data-runner PRIVATE -std=c++11)
endif ()
endif ()

0 comments on commit dd479c4

Please sign in to comment.