From 75552d51cf50c2793d467be35f0b0c0e07c069bd Mon Sep 17 00:00:00 2001 From: Hussein Kasem Date: Sat, 25 Apr 2020 13:11:45 +0200 Subject: [PATCH 1/2] Add include pEp/pEpLog on basic_api.cc and fix identity_api.cc includes. --- src/basic_api.cc | 1 + src/identity_api.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/basic_api.cc b/src/basic_api.cc index d16553b..a6f4e41 100644 --- a/src/basic_api.cc +++ b/src/basic_api.cc @@ -1,6 +1,7 @@ #include #include #include +#include #ifndef ANDROID #include diff --git a/src/identity_api.cc b/src/identity_api.cc index eb364d0..eb8521e 100644 --- a/src/identity_api.cc +++ b/src/identity_api.cc @@ -1,5 +1,9 @@ +#include #include +#include "jniutils.hh" + + extern "C" { JNIEXPORT jint JNICALL Java_foundation_pEp_jniadapter_Identity__1getRating(JNIEnv *env, jobject thiz, jint comm_type) From 7238fc660ae66cd08ed89d4b520d8836aae2b70d Mon Sep 17 00:00:00 2001 From: Hussein Kasem Date: Fri, 1 May 2020 10:41:20 +0200 Subject: [PATCH 2/2] Add build instructionds for Android --- android/README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 android/README.md diff --git a/android/README.md b/android/README.md new file mode 100644 index 0000000..7def56c --- /dev/null +++ b/android/README.md @@ -0,0 +1,72 @@ +# Build pEpJNIAdapter for Android + +** Asuming machine is already set up to build pEp Engine and Sequoia! ** +## Install dependencies + +```bash +sudo port -N install gsed wget autoconf automake libtool md5sha1sum openjdk8 + +## optionaly (not needed if using Android Studio) +sudo port -N install gradle + +``` + +## Install NDK +It can be done with the SDK and the sdkmanager cli tool, or using Android Studio. + +Android studio -> Configure -> SDK Manager -> SDK Tools (tab) -> Select NDK and install + +Tip: To install other versions click on "Show packages details" and select the desired NDK version (Currently using: 21.0.6113669) + +## Required env\_vars (for MacOS): + +``` bash +export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) +export ANDROID_NDK=$ANDROID_SDK/ndk/21.0.6113669 +export HOST_TAG=darwin-x86_64 +export ANDROID_MIN_SDK_32=18 +export ANDROID_MIN_SDK_64=21 +export NDK_TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/$HOST_TAG + +export PATH=$PATH:ANDROID_NDK/bin +``` + +## Add Rust android targets + +```bash +rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android +``` + +Tell rust the location of the new target linker and AR + +```bash +echo " +[target.aarch64-linux-android] +ar = \"$NDK_TOOLCHAIN/bin/aarch64-linux-android-ar\" +linker = \"$NDK_TOOLCHAIN/bin/aarch64-linux-android$ANDROID_MIN_SDK_64-clang\" + +[target.armv7-linux-androideabi] +ar = \"$NDK_TOOLCHAIN/bin/arm-linux-androideabi-ar\" +linker = \"$NDK_TOOLCHAIN/bin/armv7a-linux-androideabi$ANDROID_MIN_SDK_32-clang\" + +[target.x86_64-linux-android] +ar = \"$NDK_TOOLCHAIN/bin/x86_64-linux-android-ar\" +linker = \"$NDK_TOOLCHAIN/bin/x86_64-linux-android$ANDROID_MIN_SDK_64-clang\" + +[target.i686-linux-android] +ar = \"$NDK_TOOLCHAIN/bin/i686-linux-android-ar\" +linker = \"$NDK_TOOLCHAIN/bin/i686-linux-android$ANDROID_MIN_SDK_32-clang\" +" >> $HOME/.cargo/config + +``` + +## Build it + +Open the android project with Android Studio, this will generate the file local.properties with the sdk location. + +To build can be done form the Gradle menu (on the right in android studio) and select the build task, or just calling gradle build form terminal. + +``` Bash +gradle build #Run inside JNIAdapter/android +``` +