Giter VIP home page Giter VIP logo

boost-for-android's Introduction

Build and/or simply download the Boost C++ Libraries for the Android platform, with Google's Ndk.

Tested with Boost 1.67.0 and Google's Ndk 17b (current versions as of June 2018).

Works with clang (llvm) - as of ndk 16 google no longer supports gcc.

Creates binaries for multiple abis (armeabi-v7a, x86 ...).

Tested with a development machine running OpenSuse Tumbleweed Linux.

Prebuilt

You can just use the prebuilt binaries if you don't need to customize the build, or don't have access to a unix like development machine.

Build Yourself

  • Download the boost source and extract to a directory of the form ..../major.minor.patch eg /home/declan/Documents/zone/mid/lib/boost/1.67.1

    Note: After the extarction ..../boost/1.67.1 should then be the direct parent dir of "bootstrap.sh", "boost-build.jam" etc

> ls /home/declan/Documents/zone/mid/lib/boost/1.67.1
boost  boost-build.jam  boostcpp.jam  boost.css  boost.png  ....
  • Clone this repo:
> git clone https://github.com/dec1/Boost-for-Android.git ./boost_for_android
  • Modify the paths (where the ndk is) and variables (which abis you want to build for, which compiler to use etc) in doIt.sh, and execute it. If the build succeeds then the boost binaries should then be available in the dir boost_for_android/build
> cd boost_for_android
> ./doIt.sh
  • You may need to have libncurses.so.5 available on you development machine. Install via your os package manager (eg Yast) if necessary.

  • Note: If for some reason the build fails you may want to manually clear the /tmp/ndk-your_username dir (which gets cleared automatically after a successful build).

Test App

Also included is a test app which can be opened by Android Studio. If you build and run this app it should show the date and time as calculated by boost chrono (indicating that you have built, linked to and called the boost library correctly). To use the test app make sure to adjust the values in the local.properties file.

Note: The test app uses CMake for Android

Header-only Boost Libraries

Many of the boost libraries (eg. algorithm) can be used as "header only" ie do not require compilation . So you may get away with not building boost if you only want to use these. To see which of the libraries do require building you can switch to the dir where you extracted the boost download and call:

> ./bootstrap.sh --show-libraries 

which for example with boost 1.67 produces the output:

The Boost libraries requiring separate building and installation are:
    - atomic
    - chrono
    - container
    - context
    - contract
    - coroutine
    - date_time
    - exception
    - fiber
    - filesystem
    - graph
    - graph_parallel
    - iostreams
    - locale
    - log
    - math
    - mpi
    - program_options
    - python
    - random
    - regex
    - serialization
    - signals
    - stacktrace
    - system
    - test
    - thread
    - timer
    - type_erasure
    - wave

Crystax

Crystax is an excellent alternative to Google's Ndk. It ships with prebuilt boost binaries, and dedicated build scripts. These binaries will however not work with Goolge's Ndk. If for some reason you can't or don't want to use Crystax then you can't use their boost binaries or build scripts, which is why this project exists.

Contributions

  • Many thanks to crystax for their version of build-boost.sh which I adapted to make it work with the google ndk.
  • Thanks to google for the files dev-defaults.sh, ndk-common.sh, prebuilt-common.sh.
  • Thanks to Ryan Pavlik for his fork with some improvements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.