Android: fix resolution, upd. irrlicht compile flags, add recommended ARMv7a and x86 flags,
Android resolution fix by @sfan5 SRP fix by @red-001 (https://github.com/minetest/minetest/pull/7484)
This commit is contained in:
parent
7bef8c982b
commit
3cf64d3947
|
@ -29,7 +29,7 @@ VERSION_PATCH := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \
|
|||
TARGET_HOST = arm-linux
|
||||
TARGET_ABI = armeabi-v7a
|
||||
TARGET_TOOLCHAIN = arm-linux-androideabi
|
||||
TARGET_CFLAGS_ADDON = -mfpu=vfpv3-d16 -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fvisibility=hidden -flto -D__ANDROID_API__=$(API)
|
||||
TARGET_CFLAGS_ADDON = -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Ofast -fdata-sections -ffunction-sections -fvisibility=hidden -flto -D__ANDROID_API__=$(API)
|
||||
TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
|
||||
TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
CROSS_PREFIX = arm-linux-androideabi
|
||||
|
@ -41,7 +41,7 @@ CROSS_PREFIX = arm-linux-androideabi
|
|||
# TARGET_HOST = x86-linux
|
||||
# TARGET_ABI = x86
|
||||
# TARGET_TOOLCHAIN = x86
|
||||
# TARGET_CFLAGS_ADDON = -Ofast -fdata-sections -ffunction-sections -fvisibility=hidden -flto -D__ANDROID_API__=$(API)
|
||||
# TARGET_CFLAGS_ADDON = -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -Ofast -funroll-loops -fdata-sections -ffunction-sections -fvisibility=hidden -flto -D__ANDROID_API__=$(API)
|
||||
# TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
|
||||
# TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
# CROSS_PREFIX = i686-linux-android
|
||||
|
@ -98,7 +98,7 @@ ICONV_URL_HTTP = https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$(ICONV_VERSION).
|
|||
INTL_DIR = $(ANDR_ROOT)/deps/libintl
|
||||
INTL_URL_GIT = https://github.com/j-jorge/libintl-lite.git
|
||||
|
||||
SQLITE3_VERSION = 3230100
|
||||
SQLITE3_VERSION = 3240000
|
||||
SQLITE3_DIR = $(ANDR_ROOT)/deps/sqlite
|
||||
SQLITE3_URL = https://www.sqlite.org/2018/sqlite-amalgamation-$(SQLITE3_VERSION).zip
|
||||
|
||||
|
@ -234,7 +234,7 @@ $(VORBIS_LIB): $(VORBIS_TIMESTAMP)
|
|||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
echo "changed timestamp for vorbis detected building..."; \
|
||||
cd ${VORBIS_DIR}; \
|
||||
${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \
|
||||
${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} TARGET_ABI=${TARGET_ABI} \
|
||||
NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \
|
||||
touch ${VORBIS_TIMESTAMP}; \
|
||||
touch ${VORBIS_TIMESTAMP_INT}; \
|
||||
|
|
|
@ -33,7 +33,7 @@ When a menu or inventory is displayed:
|
|||
Special settings
|
||||
----------------
|
||||
There are some settings especially useful for Android users. MultiCraft's config
|
||||
file can usually be found at /sdcard/Android/data/mobi.MultiCraft.
|
||||
file can usually be found at /sdcard/Android/data/mobi.MultiCraft/files.
|
||||
|
||||
* gui_scaling: this is a user-specified scaling factor for the GUI- In case
|
||||
main menu is too big or small on your device, try changing this
|
||||
|
@ -61,8 +61,8 @@ following software packages. The version number in parenthesis denotes the
|
|||
version that was tested at the time this README was drafted; newer/older
|
||||
versions may or may not work.
|
||||
|
||||
* android SDK (26.1.1)
|
||||
* android NDK (r16b)
|
||||
* android SDK (27+)
|
||||
* android NDK (r17b)
|
||||
* wget
|
||||
* g++-multilib
|
||||
* m4
|
||||
|
@ -91,7 +91,7 @@ Release build:
|
|||
|
||||
* Once your keystore is setup, enter build/android subdirectory and create a new
|
||||
file "ant.properties" there. Add following lines to that file:
|
||||
|
||||
|
||||
> key.store=<path to your keystore>
|
||||
> key.alias=MultiCraft
|
||||
|
||||
|
@ -104,10 +104,10 @@ Other things that may be nice to know
|
|||
------------
|
||||
* The environment for Android development tools is saved within Android build
|
||||
build folder. If you want direct access to it do:
|
||||
|
||||
|
||||
> make envpaths
|
||||
> . and_env
|
||||
|
||||
|
||||
After you've done this you'll have your path and path variables set correct
|
||||
to use adb and all other Android development tools
|
||||
|
||||
|
@ -122,7 +122,7 @@ Other things that may be nice to know
|
|||
> make clean_irrlicht
|
||||
|
||||
|
||||
After compiling you need to archive files in assets into three zips - Files.zip, games.zip and worlds.zip.
|
||||
After compiling you need to archive files in assets into three zips - Files.zip, games.zip and worlds.zip.
|
||||
games.zip must contain "games" folder.
|
||||
worlds.zip must contain "worlds" folder and "multicraf.conf" text file.
|
||||
Finally, remaining files must be packed into Files.zip.
|
||||
|
|
|
@ -38,13 +38,13 @@ LOCAL_SRC_FILES := deps/luajit/src/libluajit.a
|
|||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := multicraft
|
||||
LOCAL_MODULE := MultiCraft
|
||||
|
||||
ifdef GPROF
|
||||
GPROF_DEF=-DGPROF
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \
|
||||
LOCAL_CFLAGS := \
|
||||
-DJSONCPP_NO_LOCALE_SUPPORT \
|
||||
-DHAVE_TOUCHSCREENGUI \
|
||||
-DUSE_CURL=1 \
|
||||
|
@ -55,33 +55,27 @@ LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \
|
|||
$(GPROF_DEF) \
|
||||
-pipe
|
||||
|
||||
ifndef NDEBUG
|
||||
LOCAL_CFLAGS += -g -D_DEBUG -O0 -fno-omit-frame-pointer
|
||||
else
|
||||
|
||||
ifeq ($(TARGET_ABI),armeabi-v7a)
|
||||
LOCAL_CFLAGS += \
|
||||
-mfpu=vfpv3-d16 -march=armv7-a -Ofast \
|
||||
-fdata-sections -ffunction-sections -fvisibility=hidden -flto
|
||||
LOCAL_CXXFLAGS += $(LOCAL_CFLAGS)
|
||||
LOCAL_LDFLAGS = -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifdef GPROF
|
||||
PROFILER_LIBS := android-ndk-profiler
|
||||
LOCAL_CFLAGS += -pg
|
||||
LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ABI),x86)
|
||||
LOCAL_CFLAGS += \
|
||||
-fno-stack-protector -Ofast \
|
||||
-fdata-sections -ffunction-sections -fvisibility=hidden -flto
|
||||
LOCAL_CXXFLAGS += $(LOCAL_CFLAGS)
|
||||
LOCAL_LDFLAGS = -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
LOCAL_CFLAGS += -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -funroll-loops
|
||||
endif
|
||||
|
||||
ifndef NDEBUG
|
||||
LOCAL_CFLAGS := -g -D_DEBUG -O0 -fno-omit-frame-pointer
|
||||
endif
|
||||
|
||||
ifdef GPROF
|
||||
PROFILER_LIBS := android-ndk-profiler
|
||||
LOCAL_CFLAGS += -pg
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -Ofast -fdata-sections -ffunction-sections -fvisibility=hidden -flto
|
||||
LOCAL_CXXFLAGS := $(LOCAL_CFLAGS)
|
||||
LOCAL_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
jni/src \
|
||||
jni/src/script \
|
||||
|
@ -318,13 +312,13 @@ LOCAL_SRC_FILES += \
|
|||
LOCAL_SRC_FILES += jni/lib/jsoncpp/jsoncpp.cpp
|
||||
|
||||
# libiconv
|
||||
LOCAL_CFLAGS += -Wno-multichar -D_ANDROID -DLIBDIR -DBUILDING_LIBICONV
|
||||
LOCAL_CFLAGS += -D_ANDROID -DLIBDIR -DBUILDING_LIBICONV
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
deps/libiconv/include \
|
||||
deps/libiconv/lib \
|
||||
deps/libiconv/libcharset/include
|
||||
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
deps/libiconv/lib/iconv.c \
|
||||
deps/libiconv/libcharset/lib/localcharset.c
|
||||
|
|
|
@ -3,6 +3,6 @@ APP_ABI := ${TARGET_ABI}
|
|||
APP_STL := gnustl_static
|
||||
NDK_TOOLCHAIN_VERSION := 4.9
|
||||
APP_DEPRECATED_HEADERS := true
|
||||
APP_MODULES := multicraft
|
||||
APP_MODULES := MultiCraft
|
||||
|
||||
APP_CPPFLAGS += -fexceptions -frtti
|
||||
|
|
|
@ -5,5 +5,5 @@ NDK_TOOLCHAIN_VERSION := 4.9
|
|||
APP_DEPRECATED_HEADERS := true
|
||||
|
||||
APP_CLAFGS += ${TARGET_CFLAGS_ADDON}
|
||||
APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions
|
||||
APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions -frtti
|
||||
APP_LDFLAGS += ${TARGET_LDFLAGS_ADDON}
|
||||
|
|
|
@ -5,4 +5,4 @@ NDK_TOOLCHAIN_VERSION := 4.9
|
|||
APP_DEPRECATED_HEADERS := true
|
||||
APP_MODULES := Irrlicht
|
||||
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
APP_CPPFLAGS += -fexceptions -frtti
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
--- irrlicht/source/Irrlicht/Android/jni/Android.mk.orig 2016-02-15 05:33:03.000000000 +0200
|
||||
+++ irrlicht/source/Irrlicht/Android/jni/Android.mk 2016-02-15 05:34:34.913711815 +0200
|
||||
@@ -11,7 +11,17 @@
|
||||
@@ -11,7 +11,15 @@
|
||||
ifndef NDEBUG
|
||||
LOCAL_CFLAGS += -g -D_DEBUG
|
||||
else
|
||||
-LOCAL_CFLAGS += -fexpensive-optimizations -O3
|
||||
+ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
+LOCAL_CFLAGS += -mfpu=vfpv3-d16 -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fvisibility=hidden -flto
|
||||
+LOCAL_CXXFLAGS += $(LOCAL_CFLAGS)
|
||||
+LOCAL_LDFLAGS += -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
+ifeq ($(TARGET_ABI),armeabi-v7a)
|
||||
+LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb
|
||||
+endif
|
||||
+ifeq ($(TARGET_ARCH_ABI),x86)
|
||||
+LOCAL_CFLAGS += -mhard-float -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -fno-stack-protector
|
||||
+LOCAL_CXXFLAGS += -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden
|
||||
+LOCAL_LDFLAGS = -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
+LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
|
||||
+ifeq ($(TARGET_ABI),x86)
|
||||
+LOCAL_CFLAGS += -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -funroll-loops -fno-stack-protector
|
||||
+endif
|
||||
+LOCAL_CFLAGS += -Ofast -fdata-sections -ffunction-sections -fvisibility=hidden -flto
|
||||
+LOCAL_CXXFLAGS := $(LOCAL_CFLAGS)
|
||||
+LOCAL_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
endif
|
||||
|
||||
|
||||
LOCAL_C_INCLUDES := ../../../include
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
android:theme="@style/AppTheme">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="multicraft" />
|
||||
android:value="MultiCraft" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.view.WindowManager;
|
|||
|
||||
public class GameActivity extends NativeActivity {
|
||||
static {
|
||||
System.loadLibrary("multicraft");
|
||||
System.loadLibrary("MultiCraft");
|
||||
}
|
||||
|
||||
private int messageReturnCode;
|
||||
|
@ -124,4 +124,4 @@ public class GameActivity extends NativeActivity {
|
|||
return width;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -550,6 +550,12 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
|
|||
|
||||
bool ClientLauncher::create_engine_device()
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
// set correct resolution
|
||||
g_settings->setU16("screen_w", porting::getDisplaySize().X);
|
||||
g_settings->setU16("screen_h", porting::getDisplaySize().Y);
|
||||
#endif
|
||||
|
||||
// Resolution selection
|
||||
bool fullscreen = g_settings->getBool("fullscreen");
|
||||
u16 screen_w = g_settings->getU16("screen_w");
|
||||
|
|
|
@ -47,7 +47,6 @@ void android_main(android_app *app)
|
|||
Thread::setName("Main");
|
||||
|
||||
try {
|
||||
app_dummy();
|
||||
char *argv[] = {strdup(PROJECT_NAME), NULL};
|
||||
main(ARRLEN(argv) - 1, argv);
|
||||
free(argv[0]);
|
||||
|
@ -136,7 +135,7 @@ void initAndroid()
|
|||
/* in the start-up code */
|
||||
__android_log_print(ANDROID_LOG_ERROR, PROJECT_NAME_C,
|
||||
"Initializing GPROF profiler");
|
||||
monstartup("libmulticraft.so");
|
||||
monstartup("libMultiCraft.so");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -206,7 +205,7 @@ void initializePathsAndroid()
|
|||
cls_File, mt_getAbsPath, "getCacheDir");
|
||||
path_storage = getAndroidPath(cls_Env, NULL, cls_File, mt_getAbsPath,
|
||||
"getExternalStorageDirectory");
|
||||
path_user = path_storage + DIR_DELIM + "Android/data/mobi.MultiCraft/Files";
|
||||
path_user = path_storage + DIR_DELIM + "Android/data/mobi.MultiCraft/files";
|
||||
path_share = path_user;
|
||||
path_locale = path_user + DIR_DELIM + "locale";
|
||||
}
|
||||
|
|
|
@ -611,7 +611,7 @@ SRP_Result srp_create_salted_verification_key( SRP_HashAlgorithm alg,
|
|||
if (fill_buff() != SRP_OK) goto error_and_exit;
|
||||
*bytes_s = (unsigned char *)srp_alloc(size_to_fill);
|
||||
if (!*bytes_s) goto error_and_exit;
|
||||
memcpy(*bytes_s, &g_rand_buff + g_rand_idx, size_to_fill);
|
||||
memcpy(*bytes_s, &g_rand_buff[g_rand_idx], size_to_fill);
|
||||
g_rand_idx += size_to_fill;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue