From 5f14f5e6981c808f27707792de9c000849dd95f2 Mon Sep 17 00:00:00 2001 From: Anes Hmida <33029571+AnassHmida@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:53:57 +0100 Subject: [PATCH] fix: Dynamically determine ABI filters in CMake configuration --- android/build.gradle | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 7d07aae..0bd980f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -36,6 +36,11 @@ def getExtOrIntegerDefault(name) { return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Keys_" + name]).toInteger() } +def reactNativeArchitectures() { + def value = project.getProperties().get("reactNativeArchitectures") + return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] +} + def resolveReactNativeDirectory() { def reactNativeLocation = safeExtGet("REACT_NATIVE_NODE_MODULES_DIR", null) if (reactNativeLocation != null) { @@ -103,7 +108,6 @@ if(!found) { def nodeModulesPath = nodeModulesDir.toString().replace("\\", "/") def reactNativePath = reactNativeDir.toString().replace("\\", "/") - def supportsNamespace() { def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') def major = parsed[0].toInteger() @@ -138,7 +142,7 @@ android { externalNativeBuild { cmake { cppFlags "-fexceptions", "-frtti", "-std=c++1y", "-DONANDROID" - abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' + abiFilters (*reactNativeArchitectures()) arguments '-DANDROID_STL=c++_shared', "-DNODE_MODULES_DIR=${nodeModulesPath}", "-DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION}"