summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authortreeform <starplant@gmail.com>2019-09-17 14:00:06 -0700
committerAndreas Rumpf <rumpf_a@web.de>2019-09-17 23:00:06 +0200
commit910ed5888ee0d21a385b6e34df978350f5e40503 (patch)
treecb5eebf52eb11773be31f1bcd81139eb768aea58 /doc
parent618316beb9fb1fe8065d952fc1dd31e1848ac69d (diff)
downloadNim-910ed5888ee0d21a385b6e34df978350f5e40503.tar.gz
Add -d:androidNDK to fix echo on Android NDK builds. (#12203)
* Add -d:echoToAndroidLog to fix echo.

* Change to androidNDK and add docs.

* Some word changes to docs.
Diffstat (limited to 'doc')
-rw-r--r--doc/nimc.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/nimc.rst b/doc/nimc.rst
index a7cee7f59..2bec61fd9 100644
--- a/doc/nimc.rst
+++ b/doc/nimc.rst
@@ -281,6 +281,20 @@ The MinGW-w64 toolchain can be installed as follows::
   CentOS: yum install mingw32-gcc | mingw64-gcc - requires EPEL
   OSX: brew install mingw-w64
 
+Cross compilation for Android
+=============================
+
+There are two ways to compile for Android: terminal programs (Termux) and with the NDK (Android Native Development Kit).
+
+First one is to treat Android as a simple linux and use `Termux <https://wiki.termux.com>`_ to connect and run the nim compiler directly on android as if it was linux. These programs are console only apps
+that can’t be distributed in the Play Store.
+
+Use regular ``nim c`` inside termux to make Android terminal apps.
+
+Android apps are written in Java, to use Nim inside an Android app you need a small Java stub that calls out to a native library written in Nim using the `NDK <https://developer.android.com/ndk>`_. You can also use `native-acitivty <https://developer.android.com/ndk/samples/sample_na>`_ to have the Java stub be auto generated for you.
+
+Use ``nim c -c --cpu:arm --os:android -d:androidNDK`` to generate the C source files you need to include in your Android Studio project. Add the generated C files to CMake build script. Then do the final compile with Android Studio which uses gradle to call CMake to compile the project.
+
 Cross compilation for Nintendo Switch
 =====================================