[build/android] Unify the behavior with iOS and macOS

This commit is contained in:
Romain Goyet
2020-03-24 14:26:49 -04:00
committed by EmilieNumworks
parent 46647cc35c
commit 625afcfd42
3 changed files with 13 additions and 13 deletions

View File

@@ -3,6 +3,8 @@ EXE = so
EPSILON_TELEMETRY ?= 1
ifdef NDK_ABI
BUILD_DIR := $(BUILD_DIR)/$(NDK_ABI)
ARCHS = armeabi-v7a arm64-v8a x86 x86_64
ifdef ARCH
BUILD_DIR := $(BUILD_DIR)/$(ARCH)
endif

View File

@@ -13,16 +13,16 @@ NDK_TOOLCHAIN_PATH = $(NDK_PATH)/toolchains/llvm/prebuilt/$(NDK_HOST_TAG)/bin
# is no toolchain for those archs on those API levels. Let's enforce NDK_VERSION
# at 21 for these archs, and 16 for the others.
ifeq ($(NDK_ABI),armeabi-v7a)
ifeq ($(ARCH),armeabi-v7a)
NDK_TARGET = armv7a-linux-androideabi
NDK_VERSION = 16
else ifeq ($(NDK_ABI),arm64-v8a)
else ifeq ($(ARCH),arm64-v8a)
NDK_TARGET = aarch64-linux-android
NDK_VERSION = 21
else ifeq ($(NDK_ABI),x86)
else ifeq ($(ARCH),x86)
NDK_TARGET = i686-linux-android
NDK_VERSION = 16
else ifeq ($(NDK_ABI),x86_64)
else ifeq ($(ARCH),x86_64)
NDK_TARGET = x86_64-linux-android
NDK_VERSION = 21
endif

View File

@@ -40,27 +40,25 @@ $(BUILD_DIR)/app/res/%.xml: ion/src/simulator/android/src/res/%.xml | $$(@D)/.
define rule_for_libepsilon
$$(BUILD_DIR)/app/libs/%/lib$(1): force_remake $$$$(@D)/.
$(Q) echo "MAKE NDK_ABI=$$*"
$(Q) $$(MAKE) NDK_ABI=$$* $(1)
$(Q) echo "MAKE ARCH=$$*"
$(Q) $$(MAKE) ARCH=$$* $(1)
$(Q) cp $$(BUILD_DIR)/$$*/$(1) $$@
endef
$(eval $(call rule_for_libepsilon,epsilon.so))
$(eval $(call rule_for_libepsilon,epsilon.official.so))
# If NDK_ABI is not defined, we will re-trigger a build for each avaialble ABI.
# If ARCH is not defined, we will re-trigger a build for each avaialble ABI.
# This is used to build APKs, which needs to embbed a binary for each ABI.
ifndef NDK_ABI
NDK_ABIS = armeabi-v7a arm64-v8a x86 x86_64
ifndef ARCH
epsilon_apk_deps = $(subst ion/src/simulator/android/src/res,$(BUILD_DIR)/app/res,$(wildcard ion/src/simulator/android/src/res/*/*))
epsilon_apk_deps += $(addprefix $(BUILD_DIR)/app/res/,mipmap/ic_launcher.png mipmap-v26/ic_launcher_foreground.png)
define rule_for_gradle
.PHONY: gradle_%_$1
gradle_%_$1.: $$(epsilon_apk_deps) $$(patsubst %,$$(BUILD_DIR)/app/libs/%/libepsilon$1.so,$(NDK_ABIS))
gradle_%_$1.: $$(epsilon_apk_deps) $$(patsubst %,$$(BUILD_DIR)/app/libs/%/libepsilon$1.so,$(ARCHS))
@echo "GRADLE ion/src/simulator/android/build.gradle"
$(Q) ANDROID_HOME=$(ANDROID_HOME) EPSILON_VERSION=$(EPSILON_VERSION) BUILD_DIR=$(BUILD_DIR) LIBEPSILON_NAME="epsilon$1" ion/src/simulator/android/gradlew -b ion/src/simulator/android/build.gradle $$*
endef