项目作者: nkh-lab

项目描述 :
Using Boost C++ libraries under AOSP.
高级语言:
项目地址: git://github.com/nkh-lab/aosp-boost.git
创建时间: 2020-02-12T14:51:36Z
项目社区:https://github.com/nkh-lab/aosp-boost

开源协议:

下载


Project for integration Boost libraries into AOSP.

Project supports static and shared libraries linkage and includes:

  • repo manifests - to get Boost source codes from git@github.com/boostorg/"">https://git@github.com/boostorg/
  • Android Soong build scripts - to compile Boost libraries in AOSP tree
  • usage examples

Fetching Boost sources to AOSP tree and compiling them

  1. Add project to AOSP tree

Add this project to your AOSP manifest and use repo sync to download it or simply clone it via git clone:

  1. mkdir -p vendor/nkh-lab
  2. $ cd vendor/nkh-lab
  3. $ git clone https://github.com/nkh-lab/aosp-boost.git
  1. Fetch required version of Boost source codes

This is performed by selecting the appropriate manifest file from the manifests folder.

Manifest file can be copied to your AOSP repo local_manifests folder: (e.g.: .repo/local_manifests/aosp-boost-1_72_0.xml) or linked:

  1. $ mkdir -p .repo/local_manifests
  2. $ cd .repo/local_manifests
  3. $ ln -s ../../vendor/nkh-lab/aosp-boost/manifests/boost-1_72_0.xml boost-1_72_0.xml

or included from other manifest:

  1. <manifest>
  2. ...
  3. <include name="aosp-boost-1_72_0.xml" ></include>
  4. ...
  5. </manifest>

After manifest applying use repo sync to fetch Boost source codes.

  1. Apply Boost build script to AOSP tree

Copy or use symlink:

  1. $ cd external/boost
  2. $ ln -s ../../vendor/nkh-lab/aosp-boost/make/boost-1_72_0.bp Android.bp
  1. Compile

All is ready to compile now, just source environment, lunch your target and compile Boost sources:

  1. $ cd external/boost/
  2. $ mm

NCAR Android Automotive Emulator Project can be used as a reference or example to see how the mentioned steps were applied to a real AOSP project.

“Hello Boost” AOSP usage example

This project contains a simple example of using the Boost libraries in AOSP, which can be found at examples/hello_boost.

Given example can be compiled via mm make command (run it after setting environment and target):

  1. $ cd examples/hello_boost
  2. $ mm

or added to whole AOSP build by adding corresponding include in target config file, e.g to
device/linaro/hikey/hikey960/device-hikey960.mk for HiKey960 build:

  1. include vendor/nkh-lab/aosp-boost/examples/hello_boost.mk

or

  1. $(call inherit-product-if-exists, vendor/nkh-lab/aosp-boost/examples/hello_boost.mk)

Below is shell output from running hello_boost_shared and hello_boost_static example binaries:

  1. $ adb shell
  2. generic_x86:/ # hello_boost_shared
  3. Hello Boost
  4. Hello from boost::thread
  5. [2021-09-27 14:43:44.200203] [0xf6c75478] [trace] A trace severity message
  6. [2021-09-27 14:43:44.200690] [0xf6c75478] [debug] A debug severity message
  7. [2021-09-27 14:43:44.200720] [0xf6c75478] [info] An informational severity message
  8. [2021-09-27 14:43:44.200743] [0xf6c75478] [warning] A warning severity message
  9. [2021-09-27 14:43:44.200764] [0xf6c75478] [error] An error severity message
  10. [2021-09-27 14:43:44.200786] [0xf6c75478] [fatal] A fatal severity message
  11. generic_x86:/ #
  12. generic_x86:/ #
  13. generic_x86:/ # hello_boost_static
  14. Hello Boost
  15. Hello from boost::thread
  16. [2021-09-27 14:43:54.157263] [0xf5108478] [trace] A trace severity message
  17. [2021-09-27 14:43:54.157636] [0xf5108478] [debug] A debug severity message
  18. [2021-09-27 14:43:54.157662] [0xf5108478] [info] An informational severity message
  19. [2021-09-27 14:43:54.157684] [0xf5108478] [warning] A warning severity message
  20. [2021-09-27 14:43:54.157704] [0xf5108478] [error] An error severity message
  21. [2021-09-27 14:43:54.157723] [0xf5108478] [fatal] A fatal severity message