Changes between Version 21 and Version 22 of AndroidBuildApp


Ignore:
Timestamp:
Jan 15, 2015, 12:09:05 PM (10 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AndroidBuildApp

    v21 v22  
    22= How To Build BOINC Apps for Android =
    33
    4 This document describes how to build BOINC apps for Android devices.
     4This document describes how to build BOINC apps for Android.
    55
    6 == Requirements ==
     6We assume the app is written in C/C++.
     7It must be cross-compiled on a non-Android system
     8(Linux, Windows, or Mac; the instructions here are for Linux).
     9The BOINC API library (libboincapi) must also be cross-compiled and linked.
     10The  result of this is a "native mode" executable
     11for a particular architecture (ARM, MIPS, or Intel) on Android.
    712
    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]
     13Various build systems can be used for this purpose:
    1014
    11 == Used versions ==
     15 * The GNU tools (configure/make).
     16 * Eclipse
     17 * Android Studio
    1218
    13 Development target:
    14  * ARM architecture featuring ABI v5
    15  * NDK-level 4 (Android 1.6)
     19In this document we'll use the GNU tools.
    1620
    17 Tested with:
    18  * ARM ABI v7 device (Samsung Galaxy SII)
    19  * Android platform 2.3.4
     21== Cookbook ==
    2022
    21 == Compatibility with BOINC on Android ==
     23In the following, we'll assume that on your build system:
    2224
    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'''.
    2627
    27 Even within ARM, higher ABIs or specific CPU capabilities might only be available
    28 on a subset of volunteer's devices.
     28Download and install the latest Android Native Development Kit (NDK):
     29http://developer.android.com/tools/sdk/ndk/index.html
    2930
    30 The client reports CPU architecture and capabilities, i.e. VFP and NEON support, to the project server.
     31Set an environment variable NDKROOT to point to the NDK directory, e.g.
     32{{{
     33export NDKROOT="$HOME/android-ndk-r10d"
     34}}}
    3135
    32 == BOINC platform name ==
     36Prepare the Android toolchain by doing
     37{{{
     38~/boinc/android/build_androidtc_arm.sh
     39}}}
    3340
    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"
    3841
    39 ==  Setup NDK toolchain ==
     42Now build your app as follows:
     43{{{
     44cd ~/my_app
     45~/boinc/android/boinc_build_app_arm.sh
     46}}}
    4047
    41 To set up a custom cross compilation toolchain, see AndroidBuildClient.
     48Note: this assumes we're building an ARM executable.
     49If you want to build MIPS or Intel, substitute "mips" or "intel" in the above commands.
    4250
    43 == Build script ==
     51HOW TO BUILD BOINC LIBS?
    4452
    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.
     53HOW TO LINK WITH BOINC LIBS?
    5054
    5155== Building FPU versions ==
     
    6872into separate small libraries that you link into the single executable,
    6973and 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.
     74Refer to the boinc/client/Makefile.am and client/whetstone.cpp, and client/cs_benchmark.cpp files
     75for an example of how to do this.
     76
     77== Deploying Android app versions ==
     78
     79BOINC 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)
     85The client reports CPU architecture and capabilities, i.e. VFP and NEON support, to the project server.
    7286
    7387== Position-independent executables (PIE) ==
     
    118132
    119133Note that the AndroidBOINC build script sets up the required environment
    120 variables for the standard c++ library as well as the Android SYSROOT.
     134variables for the standard C++ library as well as the Android SYSROOT.
    121135
    122136-llog refers to the library required to use Logcat from native code.
    123137Logcat is used for debugging purposes and is not required for the app's functionality.
    124