Changes between Version 21 and Version 22 of AndroidBuildApp
- Timestamp:
- Jan 15, 2015, 12:09:05 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AndroidBuildApp
v21 v22 2 2 = How To Build BOINC Apps for Android = 3 3 4 This document describes how to build BOINC apps for Android devices.4 This document describes how to build BOINC apps for Android. 5 5 6 == Requirements == 6 We assume the app is written in C/C++. 7 It must be cross-compiled on a non-Android system 8 (Linux, Windows, or Mac; the instructions here are for Linux). 9 The BOINC API library (libboincapi) must also be cross-compiled and linked. 10 The result of this is a "native mode" executable 11 for a particular architecture (ARM, MIPS, or Intel) on Android. 7 12 8 * Android NDK: http://developer.android.com/tools/sdk/ndk/index.html 9 * BOINC on Android build script: [http://boinc.berkeley.edu/trac/browser/boinc-v2/android] 13 Various build systems can be used for this purpose: 10 14 11 == Used versions == 15 * The GNU tools (configure/make). 16 * Eclipse 17 * Android Studio 12 18 13 Development target: 14 * ARM architecture featuring ABI v5 15 * NDK-level 4 (Android 1.6) 19 In this document we'll use the GNU tools. 16 20 17 Tested with: 18 * ARM ABI v7 device (Samsung Galaxy SII) 19 * Android platform 2.3.4 21 == Cookbook == 20 22 21 == Compatibility with BOINC on Android == 23 In the following, we'll assume that on your build system: 22 24 23 BOINC on Android runs on all Android devices, regardless of their CPU architecture. 24 Possible architectures are ARM, x86 and MIPS. 25 ARM is the dominant platform on Android. 25 * the BOINC source tree is at '''~/boinc'''. 26 * the source code for your application is at '''~/my_app'''. 26 27 27 Even within ARM, higher ABIs or specific CPU capabilities might only be available 28 on a subset of volunteer's devices. 28 Download and install the latest Android Native Development Kit (NDK): 29 http://developer.android.com/tools/sdk/ndk/index.html 29 30 30 The client reports CPU architecture and capabilities, i.e. VFP and NEON support, to the project server. 31 Set an environment variable NDKROOT to point to the NDK directory, e.g. 32 {{{ 33 export NDKROOT="$HOME/android-ndk-r10d" 34 }}} 31 35 32 == BOINC platform name == 36 Prepare the Android toolchain by doing 37 {{{ 38 ~/boinc/android/build_androidtc_arm.sh 39 }}} 33 40 34 BOINC on Android uses the following BOINC platform identifier:35 "arm-android-linux-gnu"36 "x86-android-linux-gnu"37 "mipsel-android-linux-gnu"38 41 39 == Setup NDK toolchain == 42 Now build your app as follows: 43 {{{ 44 cd ~/my_app 45 ~/boinc/android/boinc_build_app_arm.sh 46 }}} 40 47 41 To set up a custom cross compilation toolchain, see AndroidBuildClient. 48 Note: this assumes we're building an ARM executable. 49 If you want to build MIPS or Intel, substitute "mips" or "intel" in the above commands. 42 50 43 == Build script == 51 HOW TO BUILD BOINC LIBS? 44 52 45 Take a look at the build scripts in the BOINC software repository. 46 They give you an idea of what steps are required and which cross compilation tools to use. 47 48 There are also scripts available, which build required software components, 49 i.e. curl and openSSL, or BOINC libs. 53 HOW TO LINK WITH BOINC LIBS? 50 54 51 55 == Building FPU versions == … … 68 72 into separate small libraries that you link into the single executable, 69 73 and use C++ namespaces to separate similar function calls. 70 Refer to the boinc/client/Makefile.am and client/whetstone.cpp, and client/cs_benchmark.cpp files 71 for an example of how to do this. 74 Refer to the boinc/client/Makefile.am and client/whetstone.cpp, and client/cs_benchmark.cpp files 75 for an example of how to do this. 76 77 == Deploying Android app versions == 78 79 BOINC on Android uses the following BOINC platform identifier: 80 "arm-android-linux-gnu" 81 "x86-android-linux-gnu" 82 "mipsel-android-linux-gnu" 83 84 (how to use plan classes if you have separate FPU versions) 85 The client reports CPU architecture and capabilities, i.e. VFP and NEON support, to the project server. 72 86 73 87 == Position-independent executables (PIE) == … … 118 132 119 133 Note that the AndroidBOINC build script sets up the required environment 120 variables for the standard c++ library as well as the Android SYSROOT.134 variables for the standard C++ library as well as the Android SYSROOT. 121 135 122 136 -llog refers to the library required to use Logcat from native code. 123 137 Logcat is used for debugging purposes and is not required for the app's functionality. 124