From 6962dd59fa420bedf9dc98b27bf678afe5c850e6 Mon Sep 17 00:00:00 2001 From: Gerhard Stein Date: Tue, 29 Sep 2020 16:40:03 +0000 Subject: [PATCH] Added Blacklist feature for SDL2 stuff --- changeAppSettings.sh | 4 ++-- project/jni/Android.mk | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 37c31d845..35853df04 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -996,13 +996,13 @@ $SEDI "s/public static String AppLibraries.*/public static String AppLibraries[] $SEDI "s/public static String AppMainLibraries.*/public static String AppMainLibraries[] = { $MainLibrariesToLoad };/" project/src/Globals.java APP_MODULES_BASE="sdl-$LibSdlVersion sdl_main sdl_native_helpers jpeg png ogg flac vorbis freetype" + +# TODO: We should not build png, jpeg if SDL2_image is used if [ "$LibSdlVersion" = "2.0" ]; then APP_MODULES_BASE="sdl-$LibSdlVersion" fi - - echo Patching project/jni/Settings.mk echo '# DO NOT EDIT THIS FILE - it is automatically generated, edit file SettingsTemplate.mk' > project/jni/Settings.mk cat project/jni/SettingsTemplate.mk | \ diff --git a/project/jni/Android.mk b/project/jni/Android.mk index b608388a0..5f10447ef 100644 --- a/project/jni/Android.mk +++ b/project/jni/Android.mk @@ -12,4 +12,19 @@ endif NDK_PATH := $(shell dirname $(shell which ndk-build)) -include $(call all-subdir-makefiles) +NDK_SUBDIR_MAKEFILES_FULL := $(call all-subdir-makefiles) + +# If you want to exclude certain subprojects from the build process. +# v.g.: SDL2_image already brings it's own implementation of png, so we exclude the bundled one +ifeq ($(SDL_VERSION),2.0) +BLACKLISTED_SUBPROJECTS := jpeg png +else +BLACKLISTED_SUBPROJECTS := sdl2_image +endif + +BLACKLISTED_MAKEFILES := $(addprefix jni/../jni/,$(BLACKLISTED_SUBPROJECTS)) +BLACKLISTED_MAKEFILES := $(addsuffix /Android.mk,$(BLACKLISTED_MAKEFILES)) + +NDK_SUBDIR_MAKEFILES := $(filter-out $(BLACKLISTED_MAKEFILES), $(NDK_SUBDIR_MAKEFILES_FULL)) + +include $(NDK_SUBDIR_MAKEFILES)