summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--COMPILING.md79
-rw-r--r--SetFlags.cmake8
-rw-r--r--android/.gitignore6
-rw-r--r--android/CMakeLists.txt4
4 files changed, 84 insertions, 13 deletions
diff --git a/COMPILING.md b/COMPILING.md
index c1366d893..deddaeb1b 100644
--- a/COMPILING.md
+++ b/COMPILING.md
@@ -98,6 +98,85 @@ make -j`nproc`
This will build Cuberite in release mode, which is better for almost all cases. For more `cmake` options, or for building in debug mode, see the section below.
+Android
+-------
+
+It is required that users obtain the latest copies of:
+
+ * The Android Native Development Kit (NDK): https://developer.android.com/ndk/downloads
+ * Lua: https://www.lua.org/download.html (download a binary)
+
+Windows users may optionally install the Ninja build system (https://github.com/ninja-build/ninja/releases) for improved build speeds.
+
+### Getting the sources ###
+
+```
+git clone --recursive https://github.com/cuberite/cuberite.git
+```
+
+### Configuration ###
+
+From the `android` subdirectory:
+
+```
+cmake . -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=16 -DCMAKE_BUILD_TYPE=Release -DCMAKE_ANDROID_ARCH_ABI=armeabi -DCMAKE_ANDROID_NDK=""
+```
+where `CMAKE_ANDROID_NDK` should be the absolute path to where the Android NDK is installed.
+
+#### Generators to use ####
+
+On Linux, the default Make is suggested. No additional parameters are required for this option.
+
+Windows users may make use of Visual Studio to compile for Android, but CMake requires the presence of Nvidia CodeWorks/Nsight Tegra, which can be a hassle to install.
+
+The easiest generator to use seems to be the NDK-bundled Make, to be specified:
+ * `-G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=""`
+where `CMAKE_MAKE_PROGRAM` should be the absolute path to the `make` program, found under the `prebuilt/windows-*/bin` subdirectory in the NDK folder.
+
+The next easiest generator is Ninja, which additionally offers multithreaded builds, to be specified:
+ * `-G "Ninja"`
+
+#### Additional ABI options ####
+
+For additional ABI options, visit: https://cmake.org/cmake/help/latest/variable/CMAKE_ANDROID_ARCH_ABI.html
+
+Please note that certain ABIs require specific [API levels](#api-level-requirements).
+
+#### API level requirements ####
+
+The minimum API level is 16 in the verbatim copy of this folder, due to the inclusion of position independent compilation. Additonally, API level 21 or higher is needed for 64 bit ABIs as earlier versions have no support for this architecture.
+
+To lower these requirements to run on very old devices, it is necessary to select a compatible ABI, and disable position independent code generation.
+
+### Building ###
+
+From the `android` subdirectory:
+
+```
+cmake --build .
+```
+
+If the build succeeded, an Android-launchable binary will have been generated under the `Server` directory. However, since this directory does not have any supporting files, they must be copied from the parent folder's `Server` directory.
+
+To use it in the official Android app, compress the aforementioned `Server` directory into a Zip file, and transfer it to the phone on which the app is installed.
+
+#### Using the compile script on Linux ####
+
+Linux users are entitled to use the compile script, which provides some easy to use options and also contains instructions for using the binaries in the official Android app.
+
+When running the compile script, make sure to have the necessary build tools installed and run the compile script as following:
+
+```
+NDK="path/to/ndk/root" CMAKE="path/to/cmake/executable" android/compile.sh <abi|all|clean>
+```
+
+The NDK variable must be set to the path to the NDK root, CMAKE to a call of the cmake binary used for compiling. If the cmake binary is in the PATH, a simple `CMAKE=cmake` is enough. As last parameter you either have to enter a correct ABI (see https://cmake.org/cmake/help/latest/variable/CMAKE_ANDROID_ARCH_ABI.html) or either all or clean. Clean will cause the script to remove the android-build directory, all will compile and zip all Cuberite for all 7 ABIs and create a zip archive of the android/Server direcory for use in the official Android app. If you are unsure which ABI is required for your phone, open the official Android app and navigate to "Settings" and "Install". It will show you the required ABI. Additional parameters may be given through enviroment variables, namely TYPE="" as Release or Debug (defaults to Release) and THREADS="4" as the number of threads used for compilation (defaults to 4).
+
+### Running the executables on a device ###
+
+Note the locations to which the Zip files were transferred. Open the official Android app, and select "Settings", then "Install", and finally select the Zip files.
+
+Cuberite for Android is now ready to use.
CMake on Unix-based platforms
-----------------------------
diff --git a/SetFlags.cmake b/SetFlags.cmake
index 7ccba4f72..18d5be236 100644
--- a/SetFlags.cmake
+++ b/SetFlags.cmake
@@ -87,10 +87,10 @@ macro(set_flags)
add_flags_cxx("-pthread")
endif()
elseif (ANDROID)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++14")
- set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++14")
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++14")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11")
+ set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11")
add_flags_cxx("-fsigned-char")
else()
diff --git a/android/.gitignore b/android/.gitignore
index a9446f022..f23a2c19b 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -1,5 +1 @@
-/Cuberite/
-/CMakeFiles/
-/lua_native-prefix/
-/tolua_native-prefix/
-CMakeCache.txt \ No newline at end of file
+/Cuberite/ \ No newline at end of file
diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt
index 849b24d04..4f863d114 100644
--- a/android/CMakeLists.txt
+++ b/android/CMakeLists.txt
@@ -1,7 +1,3 @@
-# Build command:
-# cmake . -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=16 -DCMAKE_BUILD_TYPE=Release -DCMAKE_ANDROID_ARCH_ABI=armeabi -DNATIVE_TOLUA_GENERATOR="" -DCMAKE_ANDROID_NDK=""
-# -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="" may also be required on Windows
-
cmake_minimum_required (VERSION 3.7)
project(Cuberite)