Android: improved build system

master
MoNTE48 2019-07-20 15:29:22 +02:00 committed by Maksim
parent 77f80646f2
commit 68117f4e03
16 changed files with 655 additions and 458 deletions

3
.gitignore vendored
View File

@ -101,8 +101,11 @@ build/android/src/main/jniLibs
build/android/obj build/android/obj
build/android/local.properties build/android/local.properties
build/android/.gradle build/android/.gradle
build/android/native/build
build/android/native/deps
timestamp timestamp
.idea .idea
.externalNativeBuild
## iOS build files ## iOS build files
build/iOS/MultiCraft/MultiCraft.xcodeproj/xcuserdata build/iOS/MultiCraft/MultiCraft.xcodeproj/xcuserdata

View File

@ -26,20 +26,20 @@
# toolchain config for ARMv7 (Clang) # toolchain config for ARMv7 (Clang)
###################################################################################### ######################################################################################
API = 16 #API = 16
TARGET_HOST = arm-linux #TARGET_HOST = arm-linux
TARGET_ABI = armeabi-v7a #TARGET_ABI = armeabi-v7a
TARGET_ARCH = arm #TARGET_ARCH = arm
TARGET_TOOLCHAIN = arm-linux-androideabi #TARGET_TOOLCHAIN = arm-linux-androideabi
TARGET_CFLAGS_ADDON = -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Ofast -fdata-sections -ffunction-sections -fvisibility=hidden -fexceptions -D__ANDROID_API__=$(API) -fpic #TARGET_CFLAGS_ADDON = -mthumb -Ofast -fdata-sections -ffunction-sections -fvisibility=hidden -fexceptions -D__ANDROID_API__=$(API)
TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) -frtti #TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) -frtti
CROSS_PREFIX = arm-linux-androideabi #CROSS_PREFIX = arm-linux-androideabi
CROSS_CC = clang #CROSS_CC = clang
CROSS_CXX = clang++ #CROSS_CXX = clang++
HOST_CC = "gcc -m32" # required for LuaJIT #HOST_CC = "gcc -m32" # required for LuaJIT
COMPILER_VERSION = clang #COMPILER_VERSION = clang
APP_STL = c++_shared #APP_STL = c++_shared
APP_STL_LIB = libc++ #APP_STL_LIB = libc++
###################################################################################### ######################################################################################
# toolchain config for ARM64 (gcc, NDK r17c) # toolchain config for ARM64 (gcc, NDK r17c)
@ -64,20 +64,20 @@ APP_STL_LIB = libc++
# toolchain config for ARM64 (Clang) # toolchain config for ARM64 (Clang)
###################################################################################### ######################################################################################
#API = 21 API = 21
#TARGET_HOST = arm-linux TARGET_HOST = arm-linux
#TARGET_ABI = arm64-v8a TARGET_ABI = arm64-v8a
#TARGET_ARCH = arm64 TARGET_ARCH = arm64
#TARGET_TOOLCHAIN = aarch64-linux-android TARGET_TOOLCHAIN = aarch64-linux-android
#TARGET_CFLAGS_ADDON = -Ofast -fvisibility=hidden -fexceptions -D__ANDROID_API__=$(API) TARGET_CFLAGS_ADDON = -Ofast -fvisibility=hidden -fexceptions -D__ANDROID_API__=$(API)
#TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) -frtti TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) -frtti
#CROSS_PREFIX = aarch64-linux-android CROSS_PREFIX = aarch64-linux-android
#CROSS_CC = clang CROSS_CC = clang
#CROSS_CXX = clang++ CROSS_CXX = clang++
#HOST_CC = "gcc -m64" # required for LuaJIT HOST_CC = "gcc -m64" # required for LuaJIT
#COMPILER_VERSION = clang COMPILER_VERSION = clang
#APP_STL = c++_shared APP_STL = c++_shared
#APP_STL_LIB = libc++ APP_STL_LIB = libc++
###################################################################################### ######################################################################################
# toolchain config for x86 (gcc, NDK r17c) # toolchain config for x86 (gcc, NDK r17c)
@ -129,12 +129,12 @@ LEVELDB_TIMESTAMP = $(LEVELDB_DIR)/timestamp
LEVELDB_TIMESTAMP_INT = $(ANDR_ROOT)/deps/leveldb_timestamp LEVELDB_TIMESTAMP_INT = $(ANDR_ROOT)/deps/leveldb_timestamp
LEVELDB_URL = https://github.com/google/leveldb/archive/v$(LEVELDB_VERSION).zip LEVELDB_URL = https://github.com/google/leveldb/archive/v$(LEVELDB_VERSION).zip
OPENAL_VERSION = 1.19.1 OPENAL_VERSION = v1.19
OPENAL_DIR = $(ANDR_ROOT)/deps/openal-soft OPENAL_DIR = $(ANDR_ROOT)/deps/openal-soft
OPENAL_LIB = $(OPENAL_DIR)/libopenal.a OPENAL_LIB = $(OPENAL_DIR)/libopenal.a
OPENAL_TIMESTAMP = $(OPENAL_DIR)/timestamp OPENAL_TIMESTAMP = $(OPENAL_DIR)/timestamp
OPENAL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/openal_timestamp OPENAL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/openal_timestamp
OPENAL_URL = https://github.com/kcat/openal-soft/archive/openal-soft-$(OPENAL_VERSION).zip OPENAL_URL_GIT = https://github.com/kcat/openal-soft/
VORBIS_DIR = $(ANDR_ROOT)/deps/libvorbis-android VORBIS_DIR = $(ANDR_ROOT)/deps/libvorbis-android
VORBIS_LIB = $(VORBIS_DIR)/obj/local/$(TARGET_ABI)/libvorbis.a VORBIS_LIB = $(VORBIS_DIR)/obj/local/$(TARGET_ABI)/libvorbis.a
@ -142,14 +142,14 @@ VORBIS_TIMESTAMP = $(VORBIS_DIR)/timestamp
VORBIS_TIMESTAMP_INT = $(ANDR_ROOT)/deps/vorbis_timestamp VORBIS_TIMESTAMP_INT = $(ANDR_ROOT)/deps/vorbis_timestamp
VORBIS_URL_GIT = https://github.com/MoNTE48/libvorbis-android VORBIS_URL_GIT = https://github.com/MoNTE48/libvorbis-android
IRRLICHT_COMMIT = 237eb07bf4b6957f2e103adcaf835e6a2afe3486 IRRLICHT_COMMIT = ogl-es
IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht
IRRLICHT_LIB = $(IRRLICHT_DIR)/lib/Android/libIrrlicht.a IRRLICHT_LIB = $(IRRLICHT_DIR)/lib/Android/libIrrlicht.a
IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)/timestamp IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)/timestamp
IRRLICHT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/irrlicht_timestamp IRRLICHT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/irrlicht_timestamp
IRRLICHT_URL_HTTP = https://github.com/zaki/irrlicht/archive/$(IRRLICHT_COMMIT).zip IRRLICHT_URL_HTTP = https://github.com/zaki/irrlicht/archive/$(IRRLICHT_COMMIT).zip
CURL_VERSION = 7.65.1 CURL_VERSION = 7.65.3
CURL_DIR = $(ANDR_ROOT)/deps/curl CURL_DIR = $(ANDR_ROOT)/deps/curl
CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a
CURL_TIMESTAMP = $(CURL_DIR)/timestamp CURL_TIMESTAMP = $(CURL_DIR)/timestamp
@ -174,6 +174,13 @@ LUAJIT_TIMESTAMP = $(LUAJIT_DIR)/timestamp
LUAJIT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/luajit_timestamp LUAJIT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/luajit_timestamp
LUAJIT_URL_GIT = https://github.com/LuaJIT/LuaJIT.git LUAJIT_URL_GIT = https://github.com/LuaJIT/LuaJIT.git
GMP_VERSION = 6.1.2
GMP_DIR = $(ANDR_ROOT)/deps/gmp
GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.a
GMP_TIMESTAMP = $(GMP_DIR)/timestamp
GMP_TIMESTAMP_INT = $(ANDR_ROOT)/deps/gmp_timestamp
GMP_URL_HTTP = https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.xz
ASSETS_TIMESTAMP = $(ANDR_ROOT)/deps/assets_timestamp ASSETS_TIMESTAMP = $(ANDR_ROOT)/deps/assets_timestamp
###################################################################################### ######################################################################################
@ -187,7 +194,7 @@ ANDROID_SDK = $(shell grep '^sdk\.dir' local.properties | sed 's/^.*=[[:space:]]
ANDROID_NDK = $(shell grep '^ndk\.dir' local.properties | sed 's/^.*=[[:space:]]*//') ANDROID_NDK = $(shell grep '^ndk\.dir' local.properties | sed 's/^.*=[[:space:]]*//')
debug : local.properties debug : local.properties
export NDEBUG=; \ export NDEBUG=0; \
export BUILD_TYPE=debug; \ export BUILD_TYPE=debug; \
$(MAKE) apk $(MAKE) apk
@ -234,10 +241,7 @@ openal_download :
echo "openal sources missing, downloading..."; \ echo "openal sources missing, downloading..."; \
mkdir -p ${ANDR_ROOT}/deps; \ mkdir -p ${ANDR_ROOT}/deps; \
cd ${ANDR_ROOT}/deps ; \ cd ${ANDR_ROOT}/deps ; \
wget ${OPENAL_URL} || exit 1; \ git clone --branch ${OPENAL_VERSION} ${OPENAL_URL_GIT} openal-soft || exit 1; \
unzip openal-soft-${OPENAL_VERSION}.zip || exit 1; \
rm openal-soft-${OPENAL_VERSION}.zip || exit 1; \
mv openal-soft-openal-soft-${OPENAL_VERSION} openal-soft || exit 1; \
cd ${OPENAL_DIR}; \ cd ${OPENAL_DIR}; \
sed '/CMAKE_FIND_ROOT_PATH / s/^/#/' -i XCompile-Android.txt; \ sed '/CMAKE_FIND_ROOT_PATH / s/^/#/' -i XCompile-Android.txt; \
sed '/CMAKE_C_COMPILER/ s/-gcc"/-clang"/' -i XCompile-Android.txt; \ sed '/CMAKE_C_COMPILER/ s/-gcc"/-clang"/' -i XCompile-Android.txt; \
@ -426,7 +430,7 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP)
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \ export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \ export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
CC=${CROSS_CC} ./configure --enable-static --disable-shared --host=${TARGET_HOST} \ CC=${CROSS_CC} ./configure --enable-static --disable-shared --host=${TARGET_TOOLCHAIN} \
--prefix=${TOOLCHAIN} --with-png=no --with-harfbuzz=no || exit 1; \ --prefix=${TOOLCHAIN} --with-png=no --with-harfbuzz=no || exit 1; \
CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST}-freetype $(MAKE) || exit 1; \ CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST}-freetype $(MAKE) || exit 1; \
touch ${FREETYPE_TIMESTAMP}; \ touch ${FREETYPE_TIMESTAMP}; \
@ -440,83 +444,83 @@ clean_freetype :
$(RM) -rf ${FREETYPE_DIR} $(RM) -rf ${FREETYPE_DIR}
iconv_download : iconv_download :
@if [ ! -d ${ICONV_DIR} ] ; then \ @if [ ! -d ${ICONV_DIR} ] ; then \
echo "iconv sources missing, downloading..."; \ echo "iconv sources missing, downloading..."; \
mkdir -p ${ANDR_ROOT}/deps; \ mkdir -p ${ANDR_ROOT}/deps; \
cd ${ANDR_ROOT}/deps; \ cd ${ANDR_ROOT}/deps; \
wget ${ICONV_URL_HTTP} || exit 1; \ wget ${ICONV_URL_HTTP} || exit 1; \
tar -xzf libiconv-${ICONV_VERSION}.tar.gz || exit 1; \ tar -xzf libiconv-${ICONV_VERSION}.tar.gz || exit 1; \
rm libiconv-${ICONV_VERSION}.tar.gz; \ rm libiconv-${ICONV_VERSION}.tar.gz; \
mv libiconv-${ICONV_VERSION} libiconv; \ mv libiconv-${ICONV_VERSION} libiconv; \
cd libiconv; \ cd libiconv; \
patch -p1 < ${ANDR_ROOT}/patches/libiconv_android.patch; \ patch -p1 < ${ANDR_ROOT}/patches/libiconv_android.patch; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-iconv; \ export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-iconv; \
${ANDROID_NDK}/build/tools/make_standalone_toolchain.py \ ${ANDROID_NDK}/build/tools/make_standalone_toolchain.py \
--arch ${TARGET_ARCH} \ --arch ${TARGET_ARCH} \
--api ${API} \ --api ${API} \
--stl=${APP_STL_LIB} \ --stl=${APP_STL_LIB} \
--install-dir=$${TOOLCHAIN}; \ --install-dir=$${TOOLCHAIN}; \
./configure || exit 1; \ ./configure || exit 1; \
fi fi
clean_iconv : clean_iconv :
$(RM) -rf ${ICONV_DIR} $(RM) -rf ${ICONV_DIR}
irrlicht_download : irrlicht_download :
@if [ ! -d "deps/irrlicht" ] ; then \ @if [ ! -d "deps/irrlicht" ] ; then \
echo "irrlicht sources missing, downloading..."; \ echo "irrlicht sources missing, downloading..."; \
mkdir -p ${ANDR_ROOT}/deps; \ mkdir -p ${ANDR_ROOT}/deps; \
cd deps; \ cd deps; \
wget ${IRRLICHT_URL_HTTP} || exit 1; \ wget ${IRRLICHT_URL_HTTP} || exit 1; \
unzip ${IRRLICHT_COMMIT}.zip || exit 1; \ unzip ${IRRLICHT_COMMIT}.zip || exit 1; \
rm ${IRRLICHT_COMMIT}.zip; \ rm ${IRRLICHT_COMMIT}.zip; \
mv irrlicht-${IRRLICHT_COMMIT} irrlicht; \ mv irrlicht-${IRRLICHT_COMMIT} irrlicht; \
cd irrlicht; \ cd irrlicht; \
mkdir -p lib/Android; \ mkdir -p lib/Android; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-touchcount.patch || exit 1; \ patch -p1 < ${ANDR_ROOT}/patches/irrlicht-touchcount.patch || exit 1; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-back_button.patch || exit 1; \ patch -p1 < ${ANDR_ROOT}/patches/irrlicht-back_button.patch || exit 1; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-native_activity.patch || exit 1; \ patch -p1 < ${ANDR_ROOT}/patches/irrlicht-native_activity.patch || exit 1; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-roundingerror.patch || exit 1; \ patch -p1 < ${ANDR_ROOT}/patches/irrlicht-roundingerror.patch || exit 1; \
fi fi
$(IRRLICHT_TIMESTAMP) : irrlicht_download $(IRRLICHT_TIMESTAMP) : irrlicht_download
@LAST_MODIF=$$(find ${IRRLICHT_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @LAST_MODIF=$$(find ${IRRLICHT_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
touch ${IRRLICHT_TIMESTAMP}; \ touch ${IRRLICHT_TIMESTAMP}; \
fi fi
irrlicht : $(IRRLICHT_LIB) irrlicht : $(IRRLICHT_LIB)
$(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB) $(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB)
+@REFRESH=0; \ +@REFRESH=0; \
if [ ! -e ${IRRLICHT_TIMESTAMP_INT} ] ; then \ if [ ! -e ${IRRLICHT_TIMESTAMP_INT} ] ; then \
REFRESH=1; \ REFRESH=1; \
fi; \ fi; \
if [ ! -e ${IRRLICHT_LIB} ] ; then \ if [ ! -e ${IRRLICHT_LIB} ] ; then \
REFRESH=1; \ REFRESH=1; \
fi; \ fi; \
if [ ${IRRLICHT_TIMESTAMP} -nt ${IRRLICHT_TIMESTAMP_INT} ] ; then \ if [ ${IRRLICHT_TIMESTAMP} -nt ${IRRLICHT_TIMESTAMP_INT} ] ; then \
REFRESH=1; \ REFRESH=1; \
fi; \ fi; \
if [ $$REFRESH -ne 0 ] ; then \ if [ $$REFRESH -ne 0 ] ; then \
mkdir -p ${IRRLICHT_DIR}; \ mkdir -p ${IRRLICHT_DIR}; \
echo "changed timestamp for irrlicht detected building..."; \ echo "changed timestamp for irrlicht detected building..."; \
cd deps/irrlicht/source/Irrlicht/Android; \ cd deps/irrlicht/source/Irrlicht/Android; \
export APP_PLATFORM=${APP_PLATFORM}; \ export APP_PLATFORM=${APP_PLATFORM}; \
export TARGET_ABI=${TARGET_ABI}; \ export TARGET_ABI=${TARGET_ABI}; \
${ANDROID_NDK}/ndk-build \ ${ANDROID_NDK}/ndk-build \
NDEBUG=${NDEBUG} \ NDEBUG=${NDEBUG} \
APP_PLATFORM=${APP_PLATFORM} \ APP_PLATFORM=${APP_PLATFORM} \
TARGET_ABI=${TARGET_ABI} \ TARGET_ABI=${TARGET_ABI} \
APP_STL=${APP_STL} \ APP_STL=${APP_STL} \
COMPILER_VERSION=${COMPILER_VERSION} \ COMPILER_VERSION=${COMPILER_VERSION} \
TARGET_CPPFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}" \ TARGET_CPPFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}" \
TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}" \ TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}" \
NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Irrlicht.mk || exit 1; \ NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Irrlicht.mk || exit 1; \
touch ${IRRLICHT_TIMESTAMP}; \ touch ${IRRLICHT_TIMESTAMP}; \
touch ${IRRLICHT_TIMESTAMP_INT}; \ touch ${IRRLICHT_TIMESTAMP_INT}; \
else \ else \
echo "nothing to be done for irrlicht"; \ echo "nothing to be done for irrlicht"; \
fi fi
clean_irrlicht : clean_irrlicht :
@ -567,7 +571,7 @@ $(CURL_LIB): $(CURL_TIMESTAMP)
export CXX=${CROSS_CXX}; \ export CXX=${CROSS_CXX}; \
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \ export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \ export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \
./configure --host=${TARGET_HOST} --enable-static --disable-shared \ ./configure --host=${TARGET_TOOLCHAIN} --enable-static --disable-shared \
--disable-debug --disable-verbose --disable-dependency-tracking --disable-ftp \ --disable-debug --disable-verbose --disable-dependency-tracking --disable-ftp \
--disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict \ --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict \
--disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp \ --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp \
@ -658,6 +662,64 @@ $(LUAJIT_LIB): $(LUAJIT_TIMESTAMP)
clean_luajit: clean_luajit:
$(RM) -R deps/luajit $(RM) -R deps/luajit
$(GMP_TIMESTAMP) : gmp_download
@LAST_MODIF=$$(find ${GMP_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
touch ${GMP_TIMESTAMP}; \
fi
gmp_download :
@if [ ! -d "${GMP_DIR}" ] ; then \
echo "gmp sources missing, downloading..."; \
mkdir -p ${ANDR_ROOT}/deps; \
cd deps; \
mkdir gmp; \
wget ${GMP_URL_HTTP} || exit 1; \
tar -xJf gmp-${GMP_VERSION}.tar.xz -C gmp --strip-components=1 || exit 1; \
rm gmp-${GMP_VERSION}.tar.xz; \
fi
gmp : $(GMP_LIB)
$(GMP_LIB): $(GMP_TIMESTAMP)
@REFRESH=0; \
if [ ! -e ${GMP_TIMESTAMP_INT} ] ; then \
REFRESH=1; \
fi; \
if [ ! -e ${GMP_LIB} ] ; then \
REFRESH=1; \
fi; \
if [ ${GMP_TIMESTAMP} -nt ${GMP_TIMESTAMP_INT} ] ; then \
REFRESH=1; \
fi; \
if [ $$REFRESH -ne 0 ] ; then \
mkdir -p ${GMP_DIR}; \
echo "changed timestamp for gmp detected building..."; \
cd deps/gmp; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \
${ANDROID_NDK}/build/tools/make_standalone_toolchain.py \
--arch ${TARGET_ARCH} \
--api ${API} \
--stl=${APP_STL_LIB} \
--install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CC=${CROSS_CC}; \
export CXX=${CROSS_CXX}; \
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
export CXXFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \
./configure --host=${TARGET_TOOLCHAIN} --enable-static --disable-shared --prefix=/usr; \
$(MAKE) install DESTDIR=/${GMP_DIR} || exit 1; \
touch ${GMP_TIMESTAMP}; \
touch ${GMP_TIMESTAMP_INT}; \
$(RM) -rf $${TOOLCHAIN}; \
else \
echo "nothing to be done for gmp"; \
fi
clean_gmp:
$(RM) -R deps/gmp
assets : $(ASSETS_TIMESTAMP) assets : $(ASSETS_TIMESTAMP)
@REFRESH=0; \ @REFRESH=0; \
if [ ! -e ${ASSETS_TIMESTAMP}.old ] ; then \ if [ ! -e ${ASSETS_TIMESTAMP}.old ] ; then \
@ -718,9 +780,10 @@ assets : $(ASSETS_TIMESTAMP)
clean_assets : clean_assets :
@$(RM) -r ${APP_ROOT}/assets @$(RM) -r ${APP_ROOT}/assets
apk: local.properties $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_LIB) $(LUAJIT_LIB) \ apk: local.properties $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_LIB) $(LUAJIT_LIB) \
$(OPENAL_LIB) $(VORBIS_LIB) prep_srcdir iconv_download assets $(OPENAL_LIB) $(VORBIS_LIB) prep_srcdir iconv_download assets
+@${ANDROID_NDK}/ndk-build \ +@cd native; \
${ANDROID_NDK}ndk-build \
APP_STL=${APP_STL} COMPILER_VERSION=${COMPILER_VERSION} \ APP_STL=${APP_STL} COMPILER_VERSION=${COMPILER_VERSION} \
APP_PLATFORM=${APP_PLATFORM} TARGET_ABI=${TARGET_ABI} || exit 1; \ APP_PLATFORM=${APP_PLATFORM} TARGET_ABI=${TARGET_ABI} || exit 1; \
if [ ! -e ${APP_ROOT}/jniLibs ]; then \ if [ ! -e ${APP_ROOT}/jniLibs ]; then \

View File

@ -1,5 +1,5 @@
MultiCraft Android version MultiCraft: Android version
===================== ===========================
Controls Controls
-------- --------
@ -38,18 +38,6 @@ 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 * 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 main menu is too big or small on your device, try changing this
value. value.
* inventory_image_hack: if your inventory items are messed up, try setting
this to true
Known issues
------------
Not all issues are fixed by now:
* Unable to exit from volume menu -- don't use the volume menu, use Android's
volume controls instead.
* 512 MB RAM seems to be inadequate -- this depends on the server you join.
Try to play on more lightweight servers.
Requirements Requirements
------------ ------------
@ -61,11 +49,12 @@ following software packages. The version number in parenthesis denotes the
version that was tested at the time this README was drafted; newer/older version that was tested at the time this README was drafted; newer/older
versions may or may not work. versions may or may not work.
* android SDK (27+) * android SDK (28+)
* android NDK (r17b) * android NDK (r17c)
* wget * wget
* g++-multilib * g++-multilib
* m4 * m4
* gettext
Additionally, you'll need to have an Internet connection available on the Additionally, you'll need to have an Internet connection available on the
build system, as the Android build will download some source packages. build system, as the Android build will download some source packages.
@ -122,7 +111,9 @@ Other things that may be nice to know
> make clean_irrlicht > make clean_irrlicht
After compiling you need to archive files in assets into three zips - Files.zip, games.zip and worlds.zip. The new build system MultiCraft Android is still WIP, but it is fully functional and is designed to speed up and simplify the work, as well as adding the possibility of cross-platform build.
games.zip must contain "games" folder. The Makefile is no longer used and will be removed in future releases. Use the "Start" script, which will automatically load pre-assembled dependencies, prepare localization files and archive all necessary files.
worlds.zip must contain "worlds" folder and "multicraf.conf" text file. Then you can use "./gradlew assemblerelease" or "./graldew assembledebug" from the command line or use Android Studio and click the build button.
Finally, remaining files must be packed into Files.zip.
When using gradlew, the newest NDK will be downloaded and installed automatically. Or you can create a local.properties file and specify sdk.dir and ndk.dir yourself.
The script will automatically create an APK for all the architectures specified in build.gradle.

81
build/android/Start.sh Executable file
View File

@ -0,0 +1,81 @@
#!/bin/bash -e
if [ ! -d gradle ]; then
echo "Run this in build/android"
exit 1
fi
FOLDER=$(pwd)/src/main/assets
DEST=$(mktemp -d)
echo
echo "*** Starting build MultiCraft for Android... ***"
echo
echo "=> Getting precompiled dependencies:"
if [ ! -d native/deps ]
then
echo
git clone https://github.com/MultiCraft/deps native/deps
echo
echo "* Done!"
else
echo
echo "Already available, skipping..."
fi
echo
echo "=> Creating Assets:"
for dir in builtin textures; do
cp -r ../../$dir $DEST/$dir
done
mkdir -p $DEST/fonts
cp ../../fonts/Retron2000.ttf $DEST/fonts/ # no PNG fonts because freetype
echo
echo "* Converting locale files:"
pushd ../../po
for lang in *; do
[ ${#lang} -ne 2 ] && continue
mopath=$DEST/locale/$lang/LC_MESSAGES
mkdir -p $mopath
pushd $lang
for fn in *.po; do
msgfmt -o $mopath/${fn/.po/.mo} $fn
done
popd
done
popd
# remove broken languages
find $DEST -type d -name 'ja' -print0 | xargs -0 -- rm -r
find $DEST -type d -name 'ko' -print0 | xargs -0 -- rm -r
find $DEST -type d -name 'he' -print0 | xargs -0 -- rm -r
mkdir -p $FOLDER
echo
echo "** Creating Files.zip"
ZIPDEST=$FOLDER/Files.zip
rm -f $ZIPDEST
cd $DEST; zip -0qr $ZIPDEST -- *
cd $FOLDER; rm -rf $DEST
###########
cd ../../../../..;
echo "*** Creating games.zip"
ZIPDEST=$FOLDER/games.zip
rm -f $ZIPDEST
zip -0qr $ZIPDEST -- games
echo "**** Creating worlds.zip"
ZIPDEST=$FOLDER/worlds.zip
rm -f $ZIPDEST
zip -0qr $ZIPDEST -- worlds
echo
echo "*** All done! You can continue in Android Studio! ***"

View File

@ -8,8 +8,6 @@ buildscript {
classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0' classpath 'com.google.gms:google-services:4.3.0'
classpath 'io.fabric.tools:gradle:1.29.0' classpath 'io.fabric.tools:gradle:1.29.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
} }
} }
@ -23,7 +21,7 @@ allprojects {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion "29.0.0" buildToolsVersion "29.0.1"
defaultConfig { defaultConfig {
applicationId 'com.multicraft.game' applicationId 'com.multicraft.game'
@ -57,7 +55,7 @@ android {
abi { abi {
enable true enable true
reset() reset()
include "armeabi-v7a", "arm64-v8a", "x86" include "armeabi-v7a", "arm64-v8a" /*, "x86"*/
} }
} }
} }
@ -77,6 +75,10 @@ android.applicationVariants.all { variant ->
} }
} }
dependencies {
implementation project(":native")
}
dependencies { dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.firebase:firebase-core:17.0.0' implementation 'com.google.firebase:firebase-core:17.0.0'

View File

@ -1,2 +1,11 @@
<#if isLowMemory>
org.gradle.jvmargs=-Xmx4G -XX:MaxPermSize=2G -XX:+HeapDumpOnOutOfMemoryError
<#else>
org.gradle.jvmargs=-Xmx16G -XX:MaxPermSize=8G -XX:+HeapDumpOnOutOfMemoryError
</#if>
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.parallel.threads=8
org.gradle.configureondemand=true
android.enableJetifier=true android.enableJetifier=true
android.useAndroidX=true android.useAndroidX=true

Binary file not shown.

View File

@ -1,2 +1 @@
#Mon Apr 22 16:21:42 CEST 2019 distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

View File

@ -1,310 +0,0 @@
LOCAL_PATH := $(call my-dir)/..
#LOCAL_ADDRESS_SANITIZER:=true
include $(CLEAR_VARS)
LOCAL_MODULE := Irrlicht
LOCAL_SRC_FILES := deps/irrlicht/source/Irrlicht/Android/obj/local/$(APP_ABI)/libIrrlicht.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := LevelDB
LOCAL_SRC_FILES := deps/leveldb/out-static/libleveldb.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := Curl
LOCAL_SRC_FILES := deps/curl/lib/.libs/libcurl.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := Freetype
LOCAL_SRC_FILES := deps/freetype/objs/.libs/libfreetype.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OpenAL
LOCAL_SRC_FILES := deps/openal-soft/libopenal.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := Vorbis
LOCAL_SRC_FILES := deps/libvorbis-android/obj/local/$(APP_ABI)/libvorbis.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := LuaJIT
LOCAL_SRC_FILES := deps/luajit/src/libluajit.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := MultiCraft
LOCAL_CFLAGS += \
-DJSONCPP_NO_LOCALE_SUPPORT \
-DHAVE_TOUCHSCREENGUI \
-DUSE_CURL=1 \
-DUSE_SOUND=1 \
-DUSE_FREETYPE=1 \
-DUSE_GETTEXT=1 \
-DUSE_LEVELDB=1 \
$(GPROF_DEF) \
-pipe
ifdef GPROF
GPROF_DEF := -DGPROF
PROFILER_LIBS := android-ndk-profiler
LOCAL_CFLAGS += -pg
endif
LOCAL_C_INCLUDES := \
jni/src \
jni/src/script \
jni/lib/intl \
jni/lib/jsoncpp \
jni/src/cguittfont \
jni/lib/gmp \
deps/irrlicht/include \
deps/freetype/include \
deps/curl/include \
deps/openal-soft/include \
deps/libvorbis-android/jni/include \
deps/leveldb/include \
deps/luajit/src \
deps/libiconv/include \
deps/libiconv/libcharset/include
LOCAL_SRC_FILES := \
jni/src/ban.cpp \
jni/src/camera.cpp \
jni/src/cavegen.cpp \
jni/src/chat.cpp \
jni/src/client.cpp \
jni/src/clientenvironment.cpp \
jni/src/clientiface.cpp \
jni/src/clientmap.cpp \
jni/src/clientmedia.cpp \
jni/src/clientobject.cpp \
jni/src/clouds.cpp \
jni/src/collision.cpp \
jni/src/content_abm.cpp \
jni/src/content_cao.cpp \
jni/src/content_mapblock.cpp \
jni/src/content_mapnode.cpp \
jni/src/content_nodemeta.cpp \
jni/src/content_sao.cpp \
jni/src/convert_json.cpp \
jni/src/craftdef.cpp \
jni/src/database-dummy.cpp \
jni/src/database-files.cpp \
jni/src/database.cpp \
jni/src/debug.cpp \
jni/src/defaultsettings.cpp \
jni/src/drawscene.cpp \
jni/src/dungeongen.cpp \
jni/src/emerge.cpp \
jni/src/environment.cpp \
jni/src/face_position_cache.cpp \
jni/src/filecache.cpp \
jni/src/filesys.cpp \
jni/src/fontengine.cpp \
jni/src/game.cpp \
jni/src/genericobject.cpp \
jni/src/gettext.cpp \
jni/src/guiChatConsole.cpp \
jni/src/guiEngine.cpp \
jni/src/guiFileSelectMenu.cpp \
jni/src/guiFormSpecMenu.cpp \
jni/src/guiKeyChangeMenu.cpp \
jni/src/guiPasswordChange.cpp \
jni/src/guiTable.cpp \
jni/src/guiscalingfilter.cpp \
jni/src/guiVolumeChange.cpp \
jni/src/httpfetch.cpp \
jni/src/hud.cpp \
jni/src/imagefilters.cpp \
jni/src/intlGUIEditBox.cpp \
jni/src/inventory.cpp \
jni/src/inventorymanager.cpp \
jni/src/itemdef.cpp \
jni/src/itemstackmetadata.cpp \
jni/src/keycode.cpp \
jni/src/light.cpp \
jni/src/localplayer.cpp \
jni/src/log.cpp \
jni/src/main.cpp \
jni/src/map.cpp \
jni/src/map_settings_manager.cpp \
jni/src/mapblock.cpp \
jni/src/mapblock_mesh.cpp \
jni/src/mapgen.cpp \
jni/src/mapgen_flat.cpp \
jni/src/mapgen_fractal.cpp \
jni/src/mapgen_singlenode.cpp \
jni/src/mapgen_v5.cpp \
jni/src/mapgen_v6.cpp \
jni/src/mapgen_v7.cpp \
jni/src/mapgen_v7p.cpp \
jni/src/mapgen_valleys.cpp \
jni/src/mapnode.cpp \
jni/src/mapsector.cpp \
jni/src/mesh.cpp \
jni/src/mesh_generator_thread.cpp \
jni/src/metadata.cpp \
jni/src/mg_biome.cpp \
jni/src/mg_decoration.cpp \
jni/src/mg_ore.cpp \
jni/src/mg_schematic.cpp \
jni/src/minimap.cpp \
jni/src/mods.cpp \
jni/src/nameidmapping.cpp \
jni/src/nodedef.cpp \
jni/src/nodemetadata.cpp \
jni/src/nodetimer.cpp \
jni/src/noise.cpp \
jni/src/objdef.cpp \
jni/src/object_properties.cpp \
jni/src/particles.cpp \
jni/src/pathfinder.cpp \
jni/src/player.cpp \
jni/src/porting_android.cpp \
jni/src/porting.cpp \
jni/src/profiler.cpp \
jni/src/quicktune.cpp \
jni/src/raycast.cpp \
jni/src/reflowscan.cpp \
jni/src/remoteplayer.cpp \
jni/src/rollback_interface.cpp \
jni/src/serialization.cpp \
jni/src/server.cpp \
jni/src/serverenvironment.cpp \
jni/src/serverlist.cpp \
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/tool.cpp \
jni/src/treegen.cpp \
jni/src/version.cpp \
jni/src/voxel.cpp \
jni/src/voxelalgorithms.cpp \
jni/src/util/areastore.cpp \
jni/src/util/auth.cpp \
jni/src/util/base64.cpp \
jni/src/util/directiontables.cpp \
jni/src/util/enriched_string.cpp \
jni/src/util/numeric.cpp \
jni/src/util/pointedthing.cpp \
jni/src/util/serialize.cpp \
jni/src/util/sha1.cpp \
jni/src/util/string.cpp \
jni/src/util/srp.cpp \
jni/src/util/timetaker.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/inputhandler.cpp \
jni/src/client/tile.cpp \
jni/src/util/sha256.c \
jni/src/client/joystick_controller.cpp \
jni/src/irrlicht_changes/static_text.cpp
# Network
LOCAL_SRC_FILES += \
jni/src/network/connection.cpp \
jni/src/network/networkpacket.cpp \
jni/src/network/clientopcodes.cpp \
jni/src/network/clientpackethandler.cpp \
jni/src/network/serveropcodes.cpp \
jni/src/network/serverpackethandler.cpp
# lua api
LOCAL_SRC_FILES += \
jni/src/script/common/c_content.cpp \
jni/src/script/common/c_converter.cpp \
jni/src/script/common/c_internal.cpp \
jni/src/script/common/c_types.cpp \
jni/src/script/cpp_api/s_async.cpp \
jni/src/script/cpp_api/s_base.cpp \
jni/src/script/cpp_api/s_client.cpp \
jni/src/script/cpp_api/s_entity.cpp \
jni/src/script/cpp_api/s_env.cpp \
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_node.cpp \
jni/src/script/cpp_api/s_nodemeta.cpp \
jni/src/script/cpp_api/s_player.cpp \
jni/src/script/cpp_api/s_security.cpp \
jni/src/script/cpp_api/s_server.cpp \
jni/src/script/lua_api/l_areastore.cpp \
jni/src/script/lua_api/l_base.cpp \
jni/src/script/lua_api/l_camera.cpp \
jni/src/script/lua_api/l_client.cpp \
jni/src/script/lua_api/l_craft.cpp \
jni/src/script/lua_api/l_env.cpp \
jni/src/script/lua_api/l_inventory.cpp \
jni/src/script/lua_api/l_item.cpp \
jni/src/script/lua_api/l_itemstackmeta.cpp\
jni/src/script/lua_api/l_localplayer.cpp \
jni/src/script/lua_api/l_mainmenu.cpp \
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_nodemeta.cpp \
jni/src/script/lua_api/l_nodetimer.cpp \
jni/src/script/lua_api/l_noise.cpp \
jni/src/script/lua_api/l_object.cpp \
jni/src/script/lua_api/l_particles.cpp \
jni/src/script/lua_api/l_rollback.cpp \
jni/src/script/lua_api/l_server.cpp \
jni/src/script/lua_api/l_settings.cpp \
jni/src/script/lua_api/l_sound.cpp \
jni/src/script/lua_api/l_http.cpp \
jni/src/script/lua_api/l_storage.cpp \
jni/src/script/lua_api/l_util.cpp \
jni/src/script/lua_api/l_vmanip.cpp \
jni/src/script/scripting_client.cpp \
jni/src/script/scripting_server.cpp \
jni/src/script/scripting_mainmenu.cpp
# Freetype2
LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp
# GMP
LOCAL_SRC_FILES += jni/lib/gmp/mini-gmp.c
# libIntl
LOCAL_SRC_FILES += jni/lib/intl/libintl.cpp
# Threading
LOCAL_SRC_FILES += \
jni/src/threading/event.cpp \
jni/src/threading/mutex.cpp \
jni/src/threading/semaphore.cpp \
jni/src/threading/thread.cpp
# JSONCPP
LOCAL_SRC_FILES += jni/lib/jsoncpp/jsoncpp.cpp
LOCAL_SRC_FILES += \
deps/libiconv/lib/iconv.c \
deps/libiconv/libcharset/lib/localcharset.c
LOCAL_STATIC_LIBRARIES := Irrlicht LevelDB Freetype Curl LuaJIT OpenAL Vorbis android_native_app_glue $(PROFILER_LIBS)
LOCAL_LDLIBS := -lEGL -lGLESv1_CM -lGLESv2 -landroid -lOpenSLES
include $(BUILD_SHARED_LIBRARY)
ifdef GPROF
$(call import-module,android-ndk-profiler)
endif
$(call import-module,android/native_app_glue)

View File

@ -5,6 +5,8 @@ NDK_TOOLCHAIN_VERSION := ${COMPILER_VERSION}
APP_MODULES := Irrlicht APP_MODULES := Irrlicht
APP_CPPFLAGS := ${TARGET_CPPFLAGS_ADDON} APP_CPPFLAGS := ${TARGET_CPPFLAGS_ADDON}
APP_CFLAGS := $(APP_CPPFLAGS)
APP_CXXFLAGS := $(APP_CPPFLAGS)
ifeq ($(COMPILER_VERSION),4.9) ifeq ($(COMPILER_VERSION),4.9)
APP_CPPFLAGS += -flto APP_CPPFLAGS += -flto

View File

@ -0,0 +1,37 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
externalNativeBuild {
ndkBuild {
arguments "-j12",
"APP_STL=c++_shared",
"COMPILER_VERSION=clang",
"APP_SHORT_COMMANDS=true"
}
}
}
externalNativeBuild {
ndkBuild {
path file("jni/Android.mk")
}
}
// supported architectures
splits {
abi {
enable true
reset()
include "armeabi-v7a", "arm64-v8a" /*, "x86"*/
}
}
buildTypes {
debug {
debuggable = false
}
}
}

View File

@ -0,0 +1,327 @@
LOCAL_PATH := $(call my-dir)/..
#LOCAL_ADDRESS_SANITIZER:=true
include $(CLEAR_VARS)
LOCAL_MODULE := Irrlicht
LOCAL_SRC_FILES := deps/Android/Irrlicht/${COMPILER_VERSION}/$(APP_ABI)/libIrrlicht.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := LevelDB
LOCAL_SRC_FILES := deps/Android/LevelDB/${COMPILER_VERSION}/$(APP_ABI)/libleveldb.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := Curl
LOCAL_SRC_FILES := deps/Android/Curl/${COMPILER_VERSION}/$(APP_ABI)/libcurl.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := Freetype
LOCAL_SRC_FILES := deps/Android/Freetype/${COMPILER_VERSION}/$(APP_ABI)/libfreetype.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OpenAL
LOCAL_SRC_FILES := deps/Android/OpenAL-Soft/${COMPILER_VERSION}/$(APP_ABI)/libopenal.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := Vorbis
LOCAL_SRC_FILES := deps/Android/Vorbis/${COMPILER_VERSION}/$(APP_ABI)/libvorbis.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := LuaJIT
LOCAL_SRC_FILES := deps/Android/LuaJIT/${COMPILER_VERSION}/$(APP_ABI)/libluajit.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := gmp
LOCAL_SRC_FILES := deps/Android/gmp/${COMPILER_VERSION}/$(APP_ABI)/libgmp.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := MultiCraft
LOCAL_CFLAGS += \
-DJSONCPP_NO_LOCALE_SUPPORT \
-DHAVE_TOUCHSCREENGUI \
-DUSE_CURL=1 \
-DUSE_SOUND=1 \
-DUSE_FREETYPE=1 \
-DUSE_GETTEXT=1 \
-DUSE_LEVELDB=1 \
-DUSE_LUAJIT=1 \
$(GPROF_DEF)
ifdef NDEBUG
LOCAL_CFLAGS += -DNDEBUG=1
endif
ifdef GPROF
GPROF_DEF := -DGPROF
PROFILER_LIBS := android-ndk-profiler
LOCAL_CFLAGS += -pg
endif
LOCAL_C_INCLUDES := \
../../../src \
../../../src/script \
../../../lib/intl \
../../../lib/jsoncpp \
../../../src/cguittfont \
deps/Android/Irrlicht/include \
deps/Android/Freetype/include \
deps/Android/Curl/include \
deps/Android/OpenAL-Soft/include \
deps/Android/Vorbis/include \
deps/Android/LevelDB/include \
deps/Android/LuaJIT/src \
deps/Android/libiconv/include \
deps/Android/libiconv/libcharset/include
LOCAL_SRC_FILES := \
../../../src/ban.cpp \
../../../src/camera.cpp \
../../../src/cavegen.cpp \
../../../src/chat.cpp \
../../../src/client.cpp \
../../../src/clientenvironment.cpp \
../../../src/clientiface.cpp \
../../../src/clientmap.cpp \
../../../src/clientmedia.cpp \
../../../src/clientobject.cpp \
../../../src/clouds.cpp \
../../../src/collision.cpp \
../../../src/content_abm.cpp \
../../../src/content_cao.cpp \
../../../src/content_mapblock.cpp \
../../../src/content_mapnode.cpp \
../../../src/content_nodemeta.cpp \
../../../src/content_sao.cpp \
../../../src/convert_json.cpp \
../../../src/craftdef.cpp \
../../../src/database-dummy.cpp \
../../../src/database-files.cpp \
../../../src/database.cpp \
../../../src/debug.cpp \
../../../src/defaultsettings.cpp \
../../../src/drawscene.cpp \
../../../src/dungeongen.cpp \
../../../src/emerge.cpp \
../../../src/environment.cpp \
../../../src/face_position_cache.cpp \
../../../src/filecache.cpp \
../../../src/filesys.cpp \
../../../src/fontengine.cpp \
../../../src/game.cpp \
../../../src/genericobject.cpp \
../../../src/gettext.cpp \
../../../src/guiChatConsole.cpp \
../../../src/guiEngine.cpp \
../../../src/guiFileSelectMenu.cpp \
../../../src/guiFormSpecMenu.cpp \
../../../src/guiKeyChangeMenu.cpp \
../../../src/guiPasswordChange.cpp \
../../../src/guiTable.cpp \
../../../src/guiscalingfilter.cpp \
../../../src/guiVolumeChange.cpp \
../../../src/httpfetch.cpp \
../../../src/hud.cpp \
../../../src/imagefilters.cpp \
../../../src/intlGUIEditBox.cpp \
../../../src/inventory.cpp \
../../../src/inventorymanager.cpp \
../../../src/itemdef.cpp \
../../../src/itemstackmetadata.cpp \
../../../src/keycode.cpp \
../../../src/light.cpp \
../../../src/localplayer.cpp \
../../../src/log.cpp \
../../../src/main.cpp \
../../../src/map.cpp \
../../../src/map_settings_manager.cpp \
../../../src/mapblock.cpp \
../../../src/mapblock_mesh.cpp \
../../../src/mapgen.cpp \
../../../src/mapgen_flat.cpp \
../../../src/mapgen_fractal.cpp \
../../../src/mapgen_singlenode.cpp \
../../../src/mapgen_v5.cpp \
../../../src/mapgen_v6.cpp \
../../../src/mapgen_v7.cpp \
../../../src/mapgen_v7p.cpp \
../../../src/mapgen_valleys.cpp \
../../../src/mapnode.cpp \
../../../src/mapsector.cpp \
../../../src/mesh.cpp \
../../../src/mesh_generator_thread.cpp \
../../../src/metadata.cpp \
../../../src/mg_biome.cpp \
../../../src/mg_decoration.cpp \
../../../src/mg_ore.cpp \
../../../src/mg_schematic.cpp \
../../../src/minimap.cpp \
../../../src/mods.cpp \
../../../src/nameidmapping.cpp \
../../../src/nodedef.cpp \
../../../src/nodemetadata.cpp \
../../../src/nodetimer.cpp \
../../../src/noise.cpp \
../../../src/objdef.cpp \
../../../src/object_properties.cpp \
../../../src/particles.cpp \
../../../src/pathfinder.cpp \
../../../src/player.cpp \
../../../src/porting_android.cpp \
../../../src/porting.cpp \
../../../src/profiler.cpp \
../../../src/quicktune.cpp \
../../../src/raycast.cpp \
../../../src/reflowscan.cpp \
../../../src/remoteplayer.cpp \
../../../src/rollback_interface.cpp \
../../../src/serialization.cpp \
../../../src/server.cpp \
../../../src/serverenvironment.cpp \
../../../src/serverlist.cpp \
../../../src/serverobject.cpp \
../../../src/shader.cpp \
../../../src/sky.cpp \
../../../src/socket.cpp \
../../../src/sound.cpp \
../../../src/sound_openal.cpp \
../../../src/staticobject.cpp \
../../../src/subgame.cpp \
../../../src/tileanimation.cpp \
../../../src/tool.cpp \
../../../src/treegen.cpp \
../../../src/version.cpp \
../../../src/voxel.cpp \
../../../src/voxelalgorithms.cpp \
../../../src/util/areastore.cpp \
../../../src/util/auth.cpp \
../../../src/util/base64.cpp \
../../../src/util/directiontables.cpp \
../../../src/util/enriched_string.cpp \
../../../src/util/numeric.cpp \
../../../src/util/pointedthing.cpp \
../../../src/util/serialize.cpp \
../../../src/util/sha1.cpp \
../../../src/util/string.cpp \
../../../src/util/srp.cpp \
../../../src/util/timetaker.cpp \
../../../src/touchscreengui.cpp \
../../../src/database-leveldb.cpp \
../../../src/settings.cpp \
../../../src/wieldmesh.cpp \
../../../src/client/clientlauncher.cpp \
../../../src/client/inputhandler.cpp \
../../../src/client/tile.cpp \
../../../src/util/sha256.c \
../../../src/client/joystick_controller.cpp \
../../../src/irrlicht_changes/static_text.cpp
LOCAL_CFLAGS += #-Werror=shorten-64-to-32
# Network
LOCAL_SRC_FILES += \
../../../src/network/connection.cpp \
../../../src/network/networkpacket.cpp \
../../../src/network/clientopcodes.cpp \
../../../src/network/clientpackethandler.cpp \
../../../src/network/serveropcodes.cpp \
../../../src/network/serverpackethandler.cpp
# Threading
LOCAL_SRC_FILES += \
../../../src/threading/event.cpp \
../../../src/threading/mutex.cpp \
../../../src/threading/semaphore.cpp \
../../../src/threading/thread.cpp
# lua api
LOCAL_SRC_FILES += \
../../../src/script/common/c_content.cpp \
../../../src/script/common/c_converter.cpp \
../../../src/script/common/c_internal.cpp \
../../../src/script/common/c_types.cpp \
../../../src/script/cpp_api/s_async.cpp \
../../../src/script/cpp_api/s_base.cpp \
../../../src/script/cpp_api/s_client.cpp \
../../../src/script/cpp_api/s_entity.cpp \
../../../src/script/cpp_api/s_env.cpp \
../../../src/script/cpp_api/s_inventory.cpp \
../../../src/script/cpp_api/s_item.cpp \
../../../src/script/cpp_api/s_mainmenu.cpp \
../../../src/script/cpp_api/s_node.cpp \
../../../src/script/cpp_api/s_nodemeta.cpp \
../../../src/script/cpp_api/s_player.cpp \
../../../src/script/cpp_api/s_security.cpp \
../../../src/script/cpp_api/s_server.cpp \
../../../src/script/lua_api/l_areastore.cpp \
../../../src/script/lua_api/l_base.cpp \
../../../src/script/lua_api/l_camera.cpp \
../../../src/script/lua_api/l_client.cpp \
../../../src/script/lua_api/l_craft.cpp \
../../../src/script/lua_api/l_env.cpp \
../../../src/script/lua_api/l_inventory.cpp \
../../../src/script/lua_api/l_item.cpp \
../../../src/script/lua_api/l_itemstackmeta.cpp\
../../../src/script/lua_api/l_localplayer.cpp \
../../../src/script/lua_api/l_mainmenu.cpp \
../../../src/script/lua_api/l_mapgen.cpp \
../../../src/script/lua_api/l_metadata.cpp \
../../../src/script/lua_api/l_minimap.cpp \
../../../src/script/lua_api/l_nodemeta.cpp \
../../../src/script/lua_api/l_nodetimer.cpp \
../../../src/script/lua_api/l_noise.cpp \
../../../src/script/lua_api/l_object.cpp \
../../../src/script/lua_api/l_particles.cpp \
../../../src/script/lua_api/l_rollback.cpp \
../../../src/script/lua_api/l_server.cpp \
../../../src/script/lua_api/l_settings.cpp \
../../../src/script/lua_api/l_sound.cpp \
../../../src/script/lua_api/l_http.cpp \
../../../src/script/lua_api/l_storage.cpp \
../../../src/script/lua_api/l_util.cpp \
../../../src/script/lua_api/l_vmanip.cpp \
../../../src/script/scripting_client.cpp \
../../../src/script/scripting_server.cpp \
../../../src/script/scripting_mainmenu.cpp
# Freetype2
LOCAL_SRC_FILES += ../../../src/cguittfont/xCGUITTFont.cpp
# libIntl
LOCAL_SRC_FILES += ../../../lib/intl/libintl.cpp
# JSONCPP
LOCAL_SRC_FILES += ../../../lib/jsoncpp/jsoncpp.cpp
# iconv
LOCAL_SRC_FILES += \
deps/Android/libiconv/lib/iconv.c \
deps/Android/libiconv/libcharset/lib/localcharset.c
# GMP
ifneq ($(APP_ABI),arm64-v8a)
LOCAL_C_INCLUDES += ../../../lib/gmp
LOCAL_SRC_FILES += ../../../lib/gmp/mini-gmp.c
else
LOCAL_CFLAGS += -DUSE_SYSTEM_GMP=1
LOCAL_C_INCLUDES += deps/Android/gmp/include
LOCAL_STATIC_LIBRARIES := gmp
endif
LOCAL_STATIC_LIBRARIES += Irrlicht LevelDB Curl Freetype OpenAL Vorbis LuaJIT android_native_app_glue $(PROFILER_LIBS)
LOCAL_LDLIBS := -lEGL -lGLESv1_CM -lGLESv2 -landroid -lOpenSLES
include $(BUILD_SHARED_LIBRARY)
ifdef GPROF
$(call import-module,android-ndk-profiler)
endif
$(call import-module,android/native_app_glue)

View File

@ -1,35 +1,35 @@
APP_PLATFORM := ${APP_PLATFORM} APP_PLATFORM := ${APP_PLATFORM}
APP_ABI := ${TARGET_ABI} APP_ABI := ${TARGET_ABI}
APP_STL := ${APP_STL} APP_STL := ${APP_STL}
NDK_TOOLCHAIN_VERSION := ${COMPILER_VERSION} NDK_TOOLCHAIN_VERSION := $(COMPILER_VERSION)
APP_MODULES := MultiCraft APP_MODULES := MultiCraft
APP_CPPFLAGS := -Ofast -fvisibility=hidden -fpic -fexceptions -Wno-deprecated-declarations APP_CPPFLAGS := -Ofast -fvisibility=hidden -fexceptions -Wno-deprecated-declarations -Wno-extra-tokens
ifeq ($(COMPILER_VERSION),4.9) ifeq ($(COMPILER_VERSION),4.9)
APP_CPPFLAGS += -flto APP_CPPFLAGS += -flto
endif endif
ifeq ($(TARGET_ABI),armeabi-v7a) ifeq ($(APP_ABI),armeabi-v7a)
APP_CPPFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb APP_CPPFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb
endif endif
ifeq ($(TARGET_ABI),x86) ifeq ($(APP_ABI),x86)
APP_CPPFLAGS += -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -funroll-loops APP_CPPFLAGS += -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -funroll-loops
endif endif
ifndef NDEBUG ifndef NDEBUG
APP_CPPFLAGS := -g -D_DEBUG -O0 -fno-omit-frame-pointer APP_CPPFLAGS := -g -D_DEBUG -O0 -fno-omit-frame-pointer -fexceptions
endif endif
APP_CFLAGS := $(APP_CPPFLAGS) APP_CFLAGS := $(APP_CPPFLAGS) #-Werror=shorten-64-to-32
APP_CXXFLAGS := $(APP_CPPFLAGS) -frtti APP_CXXFLAGS := $(APP_CPPFLAGS) -frtti
APP_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections,--icf=safe APP_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
ifeq ($(COMPILER_VERSION),clang) ifeq ($(COMPILER_VERSION),clang)
APP_CFLAGS += $(APP_CPPFLAGS) -Wno-parentheses-equality APP_CFLAGS += $(APP_CPPFLAGS) -Wno-parentheses-equality
APP_CXXFLAGS += $(APP_CPPFLAGS) -std=gnu++17 APP_CXXFLAGS += $(APP_CPPFLAGS) -std=gnu++17
ifeq ($(TARGET_ABI),arm64-v8a) ifeq ($(APP_ABI),arm64-v8a)
APP_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections APP_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections
endif endif
endif endif

View File

@ -0,0 +1 @@
<manifest package="com.multicraft" />

View File

@ -0,0 +1 @@
include ':native'

View File

@ -8,7 +8,6 @@ import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
@ -21,16 +20,8 @@ import static com.multicraft.game.AdManager.stopAd;*/
public class GameActivity extends NativeActivity { public class GameActivity extends NativeActivity {
static { static {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { System.loadLibrary("c++_shared");
if (TextUtils.join(", ", Build.SUPPORTED_ABIS).contains("64")) { System.loadLibrary("MultiCraft");
//System.loadLibrary("c++_shared"); // uncomment when upgrading to Clang
System.loadLibrary("MultiCraft");
} else {
System.loadLibrary("MultiCraft");
}
} else {
System.loadLibrary("MultiCraft");
}
} }
private int messageReturnCode; private int messageReturnCode;