Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64-v8a build support [WIP] #2364

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion react-native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ task downloadOpenSSL_arm(type: Download) {
dest new File(downloadsDir, "openssl-release-1.0.2k-Android-armeabi-v7a.tar.gz")
}

task downloadOpenSSL_arm64(type: Download) {
src "https://static.realm.io/downloads/openssl/1.0.2k/Android/arm64-v8a/openssl-release-1.0.2k-Android-arm64-v8a.tar.gz"
onlyIfNewer true
overwrite true
dest new File(downloadsDir, "openssl-release-1.0.2k-Android-arm64-v8a.tar.gz")
}

task prepareOpenSSL_arm(dependsOn: downloadOpenSSL_arm, type:Copy) {
from tarTree(downloadOpenSSL_arm.dest)
into "$coreDownloadDir/core"
Expand All @@ -121,6 +128,14 @@ task prepareOpenSSL_arm(dependsOn: downloadOpenSSL_arm, type:Copy) {
}
}

task prepareOpenSSL_arm64(dependsOn: downloadOpenSSL_arm64, type:Copy) {
from tarTree(downloadOpenSSL_arm64.dest)
into "$coreDownloadDir/core"
rename { String fileName ->
fileName.replace("-arm-", "-arm64-")
}
}

def getDependenciesVersion(keyName) {
def inputFile = new File(buildscript.sourceFile.getParent() + "/../../dependencies.list")
def line
Expand Down Expand Up @@ -227,7 +242,7 @@ def getNdkBuildFullPath() {
return ndkBuildFullPath
}

task buildReactNdkLib(dependsOn: [downloadJSCHeaders,prepareRealmCore,prepareOpenSSL_x86,prepareOpenSSL_arm], type: Exec) {
task buildReactNdkLib(dependsOn: [downloadJSCHeaders,prepareRealmCore,prepareOpenSSL_x86,prepareOpenSSL_arm64,prepareOpenSSL_arm], type: Exec) {
inputs.files('src/main/jni')
outputs.dir("$buildDir/realm-react-ndk/all")
commandLine getNdkBuildFullPath(),
Expand Down
2 changes: 1 addition & 1 deletion react-native/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ POM_PACKAGING=aar
POM_DESCRIPTION=Android Realm React Native module. Realm is a mobile database: a replacement for SQLite & ORMs
DEBUG_BUILD=true
android.useDeprecatedNdk=true
ndkVersion=r10e
ndkVersion=16.1.4479499
2 changes: 1 addition & 1 deletion react-native/android/src/main/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ LOCAL_STATIC_LIBRARIES += crypto-$(TARGET_ARCH_ABI)
endif

# Workaround for memmove/memcpy bug
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a,arm64-v8a)
LOCAL_CPPFLAGS += -DREALM_WRAP_MEMMOVE=1
LOCAL_LDFLAGS += -Wl,--wrap,memmove
LOCAL_LDFLAGS += -Wl,--wrap,memcpy
Expand Down
8 changes: 4 additions & 4 deletions react-native/android/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
APP_BUILD_SCRIPT := Android.mk

APP_ABI := armeabi-v7a x86
APP_PLATFORM := android-9
APP_ABI := armeabi-v7a x86 arm64-v8a
APP_PLATFORM := android-16

APP_MK_DIR := $(dir $(lastword $(MAKEFILE_LIST)))

NDK_MODULE_PATH := $(APP_MK_DIR)$(HOST_DIRSEP)$(THIRD_PARTY_NDK_DIR)$(HOST_DIRSEP)$(APP_MK_DIR)

APP_STL := gnustl_static
APP_STL := c++_shared
APP_CPPFLAGS := -std=c++14
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
Expand All @@ -30,4 +30,4 @@ APP_CPPFLAGS += -DREALM_ENABLE_SYNC=1
APP_LDFLAGS += -lz
endif

NDK_TOOLCHAIN_VERSION := 4.9
NDK_TOOLCHAIN_VERSION := clang