From 22a891a925d68a096420d3383a2e31b58e3eb244 Mon Sep 17 00:00:00 2001 From: stujones11 Date: Wed, 6 Dec 2017 20:36:29 +0000 Subject: [PATCH] Android build fixes for c++11 --- build/android/Makefile | 87 ++++++++++++------- build/android/jni/Android.mk | 33 +++++-- build/android/jni/Application.mk | 10 ++- build/android/jni/Deps.mk | 4 +- build/android/jni/Irrlicht.mk | 8 +- .../MtNativeActivity.java | 2 - src/client/clientlauncher.cpp | 2 +- src/client/renderingengine.cpp | 15 ++++ src/client/tile.cpp | 2 +- src/client/tile.h | 6 +- src/game.cpp | 3 +- src/gui/guiEditBoxWithScrollbar.cpp | 7 ++ src/gui/guiEditBoxWithScrollbar.h | 7 ++ src/gui/touchscreengui.h | 1 + src/porting_android.h | 5 ++ 15 files changed, 139 insertions(+), 53 deletions(-) diff --git a/build/android/Makefile b/build/android/Makefile index 24f640a7f..1457a7efd 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -34,7 +34,8 @@ TARGET_TOOLCHAIN = arm-linux-androideabi- TARGET_CFLAGS_ADDON = -mfloat-abi=softfp -mfpu=vfpv3 -O3 TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) TARGET_ARCH = armv7 -CROSS_PREFIX = arm-linux-androideabi- +CROSS_CC = clang +CROSS_CXX = clang++ COMPILER_VERSION = clang HAVE_LEVELDB = 0 @@ -46,7 +47,8 @@ HAVE_LEVELDB = 0 #TARGET_LIBDIR = mips #TARGET_TOOLCHAIN = mipsel-linux-android- #TARGET_ARCH = mips32 -#CROSS_PREFIX = mipsel-linux-android- +#CROSS_CC = mipsel-linux-android-gcc +#CROSS_CXX = mipsel-linux-android-g++ #COMPILER_VERSION = 4.9 #HAVE_LEVELDB = 0 @@ -57,9 +59,10 @@ HAVE_LEVELDB = 0 #TARGET_ABI = x86 #TARGET_LIBDIR = x86 #TARGET_TOOLCHAIN = x86- -#CROSS_PREFIX = i686-linux-android- #TARGET_ARCH = x86 -#COMPILER_VERSION = 4.9 +#CROSS_CC = clang +#CROSS_CXX = clang++ +#COMPILER_VERSION = clang #HAVE_LEVELDB = 0 ################################################################################ @@ -95,7 +98,7 @@ IRRLICHT_URL_SVN = https://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@$(IRR OPENSSL_VERSION = 1.0.2k OPENSSL_BASEDIR = openssl-$(OPENSSL_VERSION) OPENSSL_DIR = $(ANDR_ROOT)/deps/$(OPENSSL_BASEDIR)/ -OPENSSL_LIB = $(OPENSSL_DIR)/libssl.so.1.0.0 +OPENSSL_LIB = $(OPENSSL_DIR)/libssl.a OPENSSL_TIMESTAMP = $(OPENSSL_DIR)timestamp OPENSSL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/openssl_timestamp OPENSSL_URL = https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz @@ -173,7 +176,7 @@ delconfig: local.properties: @echo "Please specify path of ANDROID NDK"; \ - echo "e.g. $$HOME/Android/ndk-r11c/"; \ + echo "e.g. $$HOME/Android/Sdk/ndk-bundle/"; \ read ANDROID_NDK ; \ if [ ! -d $$ANDROID_NDK ] ; then \ echo "$$ANDROID_NDK is not a valid folder"; \ @@ -181,7 +184,7 @@ local.properties: fi; \ echo "ndk.dir = $$ANDROID_NDK" > local.properties; \ echo "Please specify path of ANDROID SDK"; \ - echo "e.g. $$HOME/Android/sdk/"; \ + echo "e.g. $$HOME/Android/Sdk/"; \ read SDKFLDR ; \ if [ ! -d $$SDKFLDR ] ; then \ echo "$$SDKFLDR is not a valid folder"; \ @@ -219,7 +222,10 @@ $(OPENAL_LIB): $(OPENAL_TIMESTAMP) cd ${OPENAL_DIR}; \ export APP_PLATFORM=${APP_PLATFORM}; \ export TARGET_ABI=${TARGET_ABI}; \ - ${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + ${ANDROID_NDK}/ndk-build \ NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \ touch ${OPENAL_TIMESTAMP}; \ touch ${OPENAL_TIMESTAMP_INT}; \ @@ -262,7 +268,10 @@ $(OGG_LIB): $(OGG_TIMESTAMP) cd ${OGG_DIR}; \ export APP_PLATFORM=${APP_PLATFORM}; \ export TARGET_ABI=${TARGET_ABI}; \ - ${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + ${ANDROID_NDK}/ndk-build \ NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \ touch ${OGG_TIMESTAMP}; \ touch ${OGG_TIMESTAMP_INT}; \ @@ -288,6 +297,7 @@ openssl_download : tar -xzf ${OPENSSL_BASEDIR}.tar.gz; \ cd ${OPENSSL_BASEDIR}; \ patch -p1 < ${ANDR_ROOT}/patches/openssl_arch.patch; \ + sed -i 's/-mandroid //g' Configure; \ fi openssl : $(OPENSSL_LIB) @@ -309,11 +319,15 @@ $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB) ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ --platform=${APP_PLATFORM} \ + --stl=libc++ \ --install-dir=$${TOOLCHAIN}; \ export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ - CC=${CROSS_PREFIX}gcc ./Configure enable-gmp -DL_ENDIAN -I${GMP_DIR} -L${GMP_DIR}/usr/lib android-${TARGET_ARCH};\ - CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make depend; \ - CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \ + export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ + export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \ + CC=${CROSS_CC} ./Configure enable-gmp no-asm -DL_ENDIAN -I${GMP_DIR} \ + -L${GMP_DIR}/usr/lib android-${TARGET_ARCH} -D__ANDROID_API__=$(API); \ + CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make depend; \ + CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \ touch ${OPENSSL_TIMESTAMP}; \ touch ${OPENSSL_TIMESTAMP_INT}; \ $(RM) -rf $${TOOLCHAIN}; \ @@ -355,17 +369,18 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP) if [ $$REFRESH -ne 0 ] ; then \ echo "changed timestamp for leveldb detected building..."; \ cd deps/leveldb; \ - export CROSS_PREFIX=${CROSS_PREFIX}; \ + export CROSS_PREFIX=${TARGET_TOOLCHAIN}; \ export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-leveldb; \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ --platform=${APP_PLATFORM} \ + --stl=libc++ \ --install-dir=$${TOOLCHAIN}; \ export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ - export CC=${CROSS_PREFIX}gcc; \ - export CXX=${CROSS_PREFIX}g++; \ + export CC=${CROSS_CC}; \ + export CXX=${CROSS_CXX}; \ export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ - export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \ + export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \ export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \ export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \ $(MAKE) || exit 1; \ @@ -413,7 +428,10 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP) cd ${FREETYPE_DIR}/Android/jni; \ export APP_PLATFORM=${APP_PLATFORM}; \ export TARGET_ABI=${TARGET_ABI}; \ - ${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + ${ANDROID_NDK}/ndk-build \ NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \ touch ${FREETYPE_TIMESTAMP}; \ touch ${FREETYPE_TIMESTAMP_INT}; \ @@ -461,16 +479,17 @@ $(ICONV_LIB) : $(ICONV_TIMESTAMP) mkdir -p ${ICONV_DIR}; \ echo "changed timestamp for iconv detected building..."; \ cd ${ICONV_DIR}; \ - \ export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-iconv; \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ --platform=${APP_PLATFORM} \ + --stl=libc++ \ --install-dir=$${TOOLCHAIN}; \ export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ - export CC=${CROSS_PREFIX}gcc; \ - export CXX=${CROSS_PREFIX}g++; \ + export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON} -lstdc++"; \ + export CC=${CROSS_CC}; \ + export CXX=${CROSS_CXX}; \ export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \ ./configure --host=${TARGET_HOST} || exit 1; \ sed -i 's/LIBICONV_VERSION_INFO) /LIBICONV_VERSION_INFO) -avoid-version /g' lib/Makefile; \ @@ -529,8 +548,11 @@ $(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB) cd deps/irrlicht/source/Irrlicht/Android; \ export APP_PLATFORM=${APP_PLATFORM}; \ export TARGET_ABI=${TARGET_ABI}; \ - ${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \ - NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Irrlicht.mk || exit 1; \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + ${ANDROID_NDK}/ndk-build \ + NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \ touch ${IRRLICHT_TIMESTAMP}; \ touch ${IRRLICHT_TIMESTAMP_INT}; \ else \ @@ -574,15 +596,16 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB) mkdir -p ${CURL_DIR}; \ echo "changed timestamp for curl detected building..."; \ cd deps/curl-${CURL_VERSION}; \ - export CROSS_PREFIX=${CROSS_PREFIX}; \ + export CROSS_PREFIX=${TARGET_TOOLCHAIN}; \ export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-curl; \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ --platform=${APP_PLATFORM} \ + --stl=libc++ \ --install-dir=$${TOOLCHAIN}; \ export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ - export CC=${CROSS_PREFIX}gcc; \ - export CXX=${CROSS_PREFIX}g++; \ + export CC=${CROSS_CC}; \ + export CXX=${CROSS_CXX}; \ export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \ export CPPFLAGS="$${CPPFLAGS} -I${OPENSSL_DIR}/include ${TARGET_CFLAGS_ADDON}"; \ export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ @@ -634,15 +657,17 @@ $(GMP_LIB): $(GMP_TIMESTAMP) mkdir -p ${GMP_DIR}; \ echo "changed timestamp for gmp detected building..."; \ cd deps/gmp-${GMP_VERSION}; \ - export CROSS_PREFIX=${CROSS_PREFIX}; \ + export CROSS_PREFIX=${TARGET_TOOLCHAIN}; \ export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ --platform=${APP_PLATFORM} \ + --stl=libc++ \ --install-dir=$${TOOLCHAIN}; \ export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ - export CC=${CROSS_PREFIX}gcc; \ - export CXX=${CROSS_PREFIX}g++; \ + export CC=${CROSS_CC}; \ + export CXX=${CROSS_CXX}; \ + export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \ export LIBGMP_LDFLAGS="-avoid-version"; \ export LIBGMPXX_LDFLAGS="-avoid-version"; \ ./configure --disable-static --host=${TARGET_HOST} --prefix=/usr; \ @@ -713,7 +738,7 @@ assets : $(ASSETS_TIMESTAMP) $(MAKE) clean_assets; \ mkdir -p ${APP_ROOT}/assets/Minetest; \ cp ${PROJ_ROOT}/minetest.conf.example ${APP_ROOT}/assets/Minetest; \ - cp ${PROJ_ROOT}/README.txt ${APP_ROOT}/assets/Minetest; \ + cp ${PROJ_ROOT}/README.md ${APP_ROOT}/assets/Minetest; \ cp -r ${PROJ_ROOT}/builtin ${APP_ROOT}/assets/Minetest; \ mkdir -p ${APP_ROOT}/assets/Minetest/client; \ cp -r ${PROJ_ROOT}/client/shaders ${APP_ROOT}/assets/Minetest/client; \ @@ -756,6 +781,10 @@ apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) export HAVE_LEVELDB=${HAVE_LEVELDB}; \ export APP_PLATFORM=${APP_PLATFORM}; \ export TARGET_ABI=${TARGET_ABI}; \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + export GPROF=${GPROF}; \ ${ANDROID_NDK}/ndk-build || exit 1; \ if [ ! -e ${APP_ROOT}/jniLibs ]; then \ ln -s ${ANDR_ROOT}/libs ${APP_ROOT}/jniLibs || exit 1; \ diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index 749f138a2..6aa658af3 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -80,7 +80,7 @@ LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \ ifndef NDEBUG LOCAL_CFLAGS += -g -D_DEBUG -O0 -fno-omit-frame-pointer else -LOCAL_CFLAGS += -O3 +LOCAL_CFLAGS += $(TARGET_CFLAGS_ADDON) endif ifdef GPROF @@ -91,7 +91,7 @@ endif # LOCAL_CFLAGS += -fsanitize=address # LOCAL_LDFLAGS += -fsanitize=address -ifeq ($(TARGET_ARCH_ABI),x86) +ifeq ($(TARGET_ABI),x86) LOCAL_CFLAGS += -fno-stack-protector endif @@ -134,6 +134,7 @@ LOCAL_SRC_FILES := \ jni/src/craftdef.cpp \ jni/src/database/database-dummy.cpp \ jni/src/database/database-files.cpp \ + jni/src/database/database-leveldb.cpp \ jni/src/database/database-sqlite3.cpp \ jni/src/database/database.cpp \ jni/src/debug.cpp \ @@ -149,6 +150,7 @@ LOCAL_SRC_FILES := \ jni/src/genericobject.cpp \ jni/src/gettext.cpp \ jni/src/gui/guiChatConsole.cpp \ + jni/src/gui/guiConfirmRegistration.cpp \ jni/src/gui/guiEditBoxWithScrollbar.cpp \ jni/src/gui/guiEngine.cpp \ jni/src/gui/guiPathSelectMenu.cpp \ @@ -159,6 +161,7 @@ LOCAL_SRC_FILES := \ jni/src/guiscalingfilter.cpp \ jni/src/gui/guiVolumeChange.cpp \ jni/src/gui/profilergraph.cpp \ + jni/src/gui/touchscreengui.cpp \ jni/src/httpfetch.cpp \ jni/src/hud.cpp \ jni/src/imagefilters.cpp \ @@ -196,6 +199,7 @@ LOCAL_SRC_FILES := \ jni/src/mapgen/mg_schematic.cpp \ jni/src/minimap.cpp \ jni/src/mods.cpp \ + jni/src/modchannels.cpp \ jni/src/nameidmapping.cpp \ jni/src/nodedef.cpp \ jni/src/nodemetadata.cpp \ @@ -222,12 +226,12 @@ LOCAL_SRC_FILES := \ jni/src/serverobject.cpp \ jni/src/shader.cpp \ jni/src/sky.cpp \ - jni/src/socket.cpp \ jni/src/sound.cpp \ jni/src/sound_openal.cpp \ jni/src/staticobject.cpp \ jni/src/subgame.cpp \ jni/src/tileanimation.cpp \ + jni/src/translation.cpp \ jni/src/tool.cpp \ jni/src/mapgen/treegen.cpp \ jni/src/version.cpp \ @@ -250,6 +254,7 @@ LOCAL_SRC_FILES := \ jni/src/unittest/test_compression.cpp \ jni/src/unittest/test_connection.cpp \ jni/src/unittest/test_filepath.cpp \ + jni/src/unittest/test_gameui.cpp \ jni/src/unittest/test_inventory.cpp \ jni/src/unittest/test_map_settings_manager.cpp \ jni/src/unittest/test_mapnode.cpp \ @@ -266,28 +271,39 @@ LOCAL_SRC_FILES := \ jni/src/unittest/test_utilities.cpp \ jni/src/unittest/test_voxelalgorithms.cpp \ jni/src/unittest/test_voxelmanipulator.cpp \ - jni/src/touchscreengui.cpp \ - jni/src/database-leveldb.cpp \ jni/src/settings.cpp \ jni/src/wieldmesh.cpp \ jni/src/client/clientlauncher.cpp \ + jni/src/client/gameui.cpp \ jni/src/client/hud.cpp \ jni/src/client/inputhandler.cpp \ jni/src/client/renderingengine.cpp \ jni/src/client/tile.cpp \ jni/src/client/joystick_controller.cpp \ - jni/src/irrlicht_changes/static_text.cpp + jni/src/client/render/factory.cpp \ + jni/src/client/render/pageflip.cpp \ + jni/src/client/render/sidebyside.cpp \ + jni/src/client/render/plain.cpp \ + jni/src/client/render/anaglyph.cpp \ + jni/src/client/render/interlaced.cpp \ + jni/src/client/render/core.cpp \ + jni/src/client/render/stereo.cpp \ + jni/src/irrlicht_changes/static_text.cpp \ + jni/src/irrlicht_changes/CGUITTFont.cpp # intentionally kept out (we already build openssl itself): jni/src/util/sha256.c # Network LOCAL_SRC_FILES += \ + jni/src/network/address.cpp \ jni/src/network/connection.cpp \ jni/src/network/networkpacket.cpp \ jni/src/network/clientopcodes.cpp \ jni/src/network/clientpackethandler.cpp \ + jni/src/network/connectionthreads.cpp \ jni/src/network/serveropcodes.cpp \ jni/src/network/serverpackethandler.cpp \ + jni/src/network/socket.cpp \ # lua api LOCAL_SRC_FILES += \ @@ -303,6 +319,7 @@ LOCAL_SRC_FILES += \ jni/src/script/cpp_api/s_inventory.cpp \ jni/src/script/cpp_api/s_item.cpp \ jni/src/script/cpp_api/s_mainmenu.cpp \ + jni/src/script/cpp_api/s_modchannels.cpp \ jni/src/script/cpp_api/s_node.cpp \ jni/src/script/cpp_api/s_nodemeta.cpp \ jni/src/script/cpp_api/s_player.cpp \ @@ -322,6 +339,7 @@ LOCAL_SRC_FILES += \ jni/src/script/lua_api/l_mapgen.cpp \ jni/src/script/lua_api/l_metadata.cpp \ jni/src/script/lua_api/l_minimap.cpp \ + jni/src/script/lua_api/l_modchannels.cpp \ jni/src/script/lua_api/l_nodemeta.cpp \ jni/src/script/lua_api/l_nodetimer.cpp \ jni/src/script/lua_api/l_noise.cpp \ @@ -341,7 +359,7 @@ LOCAL_SRC_FILES += \ jni/src/script/scripting_mainmenu.cpp #freetype2 support -LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp +#LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp # Lua LOCAL_SRC_FILES += \ @@ -382,7 +400,6 @@ LOCAL_SRC_FILES += deps/sqlite/sqlite3.c # Threading LOCAL_SRC_FILES += \ jni/src/threading/event.cpp \ - jni/src/threading/mutex.cpp \ jni/src/threading/semaphore.cpp \ jni/src/threading/thread.cpp diff --git a/build/android/jni/Application.mk b/build/android/jni/Application.mk index dfe7afb3d..63442dbfc 100644 --- a/build/android/jni/Application.mk +++ b/build/android/jni/Application.mk @@ -1,9 +1,11 @@ APP_PLATFORM := ${APP_PLATFORM} APP_ABI := ${TARGET_ABI} -APP_STL := gnustl_static -NDK_TOOLCHAIN_VERSION := 4.9 +APP_STL := c++_shared +NDK_TOOLCHAIN_VERSION := ${COMPILER_VERSION} APP_DEPRECATED_HEADERS := true APP_MODULES := minetest +ifndef NDEBUG +APP_OPTIM := debug +endif -APP_CPPFLAGS += -fexceptions -APP_GNUSTL_FORCE_CPP_FEATURES := rtti +APP_CPPFLAGS += -fexceptions -std=c++11 -frtti diff --git a/build/android/jni/Deps.mk b/build/android/jni/Deps.mk index cc6e56747..0d007b438 100644 --- a/build/android/jni/Deps.mk +++ b/build/android/jni/Deps.mk @@ -4,5 +4,5 @@ APP_STL := c++_shared NDK_TOOLCHAIN_VERSION := ${COMPILER_VERSION} APP_DEPRECATED_HEADERS := true -APP_CLAFGS += -mfloat-abi=softfp -mfpu=vfpv3 -O3 -APP_CPPFLAGS += -fexceptions +APP_CLAFGS += ${TARGET_CFLAGS_ADDON} +APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions -std=c++11 diff --git a/build/android/jni/Irrlicht.mk b/build/android/jni/Irrlicht.mk index a48c2902b..592e1c68f 100644 --- a/build/android/jni/Irrlicht.mk +++ b/build/android/jni/Irrlicht.mk @@ -1,9 +1,9 @@ APP_PLATFORM := ${APP_PLATFORM} APP_ABI := ${TARGET_ABI} -APP_STL := gnustl_static -NDK_TOOLCHAIN_VERSION := 4.9 +APP_STL := c++_shared +NDK_TOOLCHAIN_VERSION := ${COMPILER_VERSION} APP_DEPRECATED_HEADERS := true APP_MODULES := Irrlicht -APP_CLAFGS += -mfloat-abi=softfp -mfpu=vfpv3 -O3 -APP_CPPFLAGS += -fexceptions +APP_CLAFGS += ${TARGET_CFLAGS_ADDON} +APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions diff --git a/build/android/src/main/java/net.minetest.minetest/MtNativeActivity.java b/build/android/src/main/java/net.minetest.minetest/MtNativeActivity.java index ea3cec45f..dd611158f 100644 --- a/build/android/src/main/java/net.minetest.minetest/MtNativeActivity.java +++ b/build/android/src/main/java/net.minetest.minetest/MtNativeActivity.java @@ -84,8 +84,6 @@ public class MtNativeActivity extends NativeActivity { System.loadLibrary("openal"); System.loadLibrary("ogg"); System.loadLibrary("vorbis"); - System.loadLibrary("ssl"); - System.loadLibrary("crypto"); System.loadLibrary("gmp"); System.loadLibrary("iconv"); diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 741a90d9f..b02f1b438 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -215,7 +215,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args) video::ETCF_CREATE_MIP_MAPS, g_settings->getBool("mip_map")); #ifdef HAVE_TOUCHSCREENGUI - receiver->m_touchscreengui = new TouchScreenGUI(device, receiver); + receiver->m_touchscreengui = new TouchScreenGUI(RenderingEngine::get_raw_device(), receiver); g_touchscreengui = receiver->m_touchscreengui; #endif diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 94c9c5ef2..72c1ccfbd 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -45,6 +45,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #endif +#ifdef __ANDROID__ +#include "filesys.h" +#endif + RenderingEngine *RenderingEngine::s_singleton = nullptr; RenderingEngine::RenderingEngine(IEventReceiver *receiver) @@ -567,4 +571,15 @@ v2u32 RenderingEngine::getDisplaySize() return deskres; } + +#else // __ANDROID__ +float RenderingEngine::getDisplayDensity() +{ + return porting::getDisplayDensity(); +} + +v2u32 RenderingEngine::getDisplaySize() +{ + return porting::getDisplaySize(); +} #endif // __ANDROID__ diff --git a/src/client/tile.cpp b/src/client/tile.cpp index a88163a50..ddc0de907 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -794,7 +794,7 @@ video::ITexture* TextureSource::generateTextureFromMesh( g_settings->getBool("inventory_image_hack") ) { // Get a scene manager - scene::ISceneManager *smgr_main = m_device->getSceneManager(); + scene::ISceneManager *smgr_main = RenderingEngine::get_raw_device()->getSceneManager(); sanity_check(smgr_main); scene::ISceneManager *smgr = smgr_main->createNewSceneManager(); sanity_check(smgr); diff --git a/src/client/tile.h b/src/client/tile.h index c21594206..b1f6d6ac9 100644 --- a/src/client/tile.h +++ b/src/client/tile.h @@ -28,6 +28,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "util/numeric.h" +#if __ANDROID__ +#include +#endif + class IGameDef; struct TileSpec; struct TileDef; @@ -153,7 +157,7 @@ public: IWritableTextureSource *createTextureSource(); #ifdef __ANDROID__ -video::IImage * Align2Npot2(video::IImage * image, video::IVideoDriver* driver); +video::IImage * Align2Npot2(video::IImage * image, irr::video::IVideoDriver* driver); #endif enum MaterialType{ diff --git a/src/game.cpp b/src/game.cpp index 2145d565d..f1c27d3bb 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2092,10 +2092,11 @@ void Game::toggleFreeMoveAlt() void Game::toggleFast() { bool fast_move = !g_settings->getBool("fast_move"); + bool has_fast_privs = client->checkPrivilege("fast"); g_settings->set("fast_move", bool_to_cstr(fast_move)); if (fast_move) { - if (client->checkPrivilege("fast")) { + if (has_fast_privs) { m_game_ui->showTranslatedStatusText("Fast mode enabled"); } else { m_game_ui->showTranslatedStatusText("Fast mode enabled (note: no 'fast' privilege)"); diff --git a/src/gui/guiEditBoxWithScrollbar.cpp b/src/gui/guiEditBoxWithScrollbar.cpp index d4d2a0c1c..cf278a58e 100644 --- a/src/gui/guiEditBoxWithScrollbar.cpp +++ b/src/gui/guiEditBoxWithScrollbar.cpp @@ -1522,3 +1522,10 @@ void GUIEditBoxWithScrollBar::deserializeAttributes(io::IAttributes* in, io::SAt // setOverrideFont(in->getAttributeAsFont("OverrideFont")); setWritable(in->getAttributeAsBool("Writable")); } + +bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled() const { return false; } +bool GUIEditBoxWithScrollBar::isDrawBorderEnabled() const { return false; } +void GUIEditBoxWithScrollBar::setCursorChar(const wchar_t cursorChar) { } +wchar_t GUIEditBoxWithScrollBar::getCursorChar() const { return '|'; } +void GUIEditBoxWithScrollBar::setCursorBlinkTime(irr::u32 timeMs) { } +irr::u32 GUIEditBoxWithScrollBar::getCursorBlinkTime() const { return 500; } diff --git a/src/gui/guiEditBoxWithScrollbar.h b/src/gui/guiEditBoxWithScrollbar.h index cca2f6536..cedffd82f 100644 --- a/src/gui/guiEditBoxWithScrollbar.h +++ b/src/gui/guiEditBoxWithScrollbar.h @@ -128,6 +128,13 @@ public: //! Reads attributes of the element virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); + virtual bool isDrawBackgroundEnabled() const; + virtual bool isDrawBorderEnabled() const; + virtual void setCursorChar(const wchar_t cursorChar); + virtual wchar_t getCursorChar() const; + virtual void setCursorBlinkTime(irr::u32 timeMs); + virtual irr::u32 getCursorBlinkTime() const; + protected: //! Breaks the single text line. void breakText(); diff --git a/src/gui/touchscreengui.h b/src/gui/touchscreengui.h index da97381cd..9d4150ea6 100644 --- a/src/gui/touchscreengui.h +++ b/src/gui/touchscreengui.h @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include #include diff --git a/src/porting_android.h b/src/porting_android.h index 7bdb226aa..0b3f2575e 100644 --- a/src/porting_android.h +++ b/src/porting_android.h @@ -76,4 +76,9 @@ int getInputDialogState(); */ std::string getInputDialogValue(); +#ifndef SERVER +float getDisplayDensity(); +v2u32 getDisplaySize(); +#endif + } -- 2.25.1