GithubHelp home page GithubHelp logo

yourchanges / android-platform-ndk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crystax/android-platform-ndk

0.0 2.0 0.0 26.91 MB

Makefile 6.22% Awk 0.22% HTML 0.12% Ruby 1.06% Shell 4.79% Python 0.32% Batchfile 0.15% C 20.65% C++ 64.37% PHP 0.01% Assembly 0.14% Groff 0.05% TeX 1.00% DIGITAL Command Language 0.02% Perl 0.77% Yacc 0.06% Objective-C 0.04% Objective-C++ 0.01%

android-platform-ndk's Introduction

Android Native Development Kit (NDK)

The NDK allows Android application developers to include native code in their Android application packages, compiled as JNI shared libraries.

See the Getting Started Guide for an introduction.

See the changelist for a list of changes since the previous release.

Finally, discussions related to the Android NDK happen on the android-ndk Google Group.

Building the NDK

Note: This document is for developers of the NDK, not developers that use the NDK.

Both Linux and Windows host binaries are built on Linux machines. Windows host binaries are built via MinGW cross compiler. Systems without a working MinGW compiler can use build/tools/build-mingw64-toolchain.sh to generate their own and be added to the PATH for build scripts to discover.

Building binaries for Mac OS X requires at least 10.8.

Target headers and binaries are built on Linux.

Components

The NDK consists of three parts: host binaries, target prebuilts, and others (build system, docs, samples, tests).

Host Binaries

  • toolchains/ contains GCC, Clang, and Renderscript toolchains.
    • $TOOLCHAIN/config.mk contains ARCH and ABIS this toolchain can handle.
    • $TOOLCHAIN/setup.mk contains toolchain-specific default CFLAGS/LDFLAGS when this toolchain is used.
  • prebuilt/$HOST_ARCH/ contains various tools to make the build system hermetic.
    • make, awk, sed, perl, python, yasm, and for Windows: cmp.exe and echo.exe
  • prebuilt/common contains the scan-build and scan-view scripts used by static analyzer via NDK_ANALYZE=1.
  • ndk-depends and ndk-stack should probably go in prebuilt/ to avoid collisions between host variants.

Target Headers and Binaries

  • platforms/android-N/arch-$ARCH_NAME/ contains headers and libraries for each API level.
    • The build system sets --sysroot to one of these directories based on user-specified APP_ABI and APP_PLATFORM.
  • sources/cxx-stl/$STL/$ABI/ contains the headers and libraries for the various C++ STLs.
  • prebuilt/android-$ARCH/gdbserver/ contains gdbserver.

Others

  • build/ contains the ndk-build system and scripts to rebuild NDK.
  • docs/
  • samples/
  • sources/ contains modules useful in samples and apps via $(call import-module, $MODULE)
  • tests/

Prerequisites

  • AOSP NDK Repository

    • Check out the branch master-ndk

      repo init -u https://android.googlesource.com/platform/manifest \
          -b master-ndk
      
      # Googlers, use
      repo init -u \
          persistent-https://android.git.corp.google.com/platform/manifest \
          -b master-ndk
    • The only difference between the NDK branch and master is that the NDK repository already has the toolchain repository checked out and patched.

  • Additional Linux Dependencies (available from apt):

    • texinfo
    • gcc-mingw32
    • wine
    • bison
    • flex
    • dmake
    • libtool
    • pbzip2
  • Mac OS X also requires Xcode.

Host/Target prebuilts

For Linux or Darwin:

$ python checkbuild.py --no-package

For Windows, from Linux:

$ python checkbuild.py --system windows

Packaging

The simplest way to package an NDK on Linux is to just omit the --no-package flag when running checkbuild.py. This will take a little longer though, so it may not be desired for day to day development.

To package the NDK for Windows or Darwin (or if more control over the packaging process is needed), invoke build/tools/package-release.sh directly. This process will be improved in a future commit.

Best Practices for Incremental Builds

  • Do not run build/tools/dev-cleanup.sh which erases all prebuilts.
  • Remove the individual prebuilt directory if new build deletes files. This is rare.
  • Package NDK from prebuilt tarballs in $PREBUILT_PATH. It runs build/tools/build-docs.sh which produces no tarball in $PREBUILT_PATH.
  • Unpack and compare against the previous package.

android-platform-ndk's People

Contributors

billnapier avatar brettchabot avatar capachino avatar danalbert avatar ddougherty avatar digit-android avatar dmitriplotnikov avatar dmsck avatar drwulf avatar dsandler avatar egnor avatar enh-google avatar fadden avatar fredquintana avatar gkasten avatar jackpal avatar loganchien avatar marcone avatar mdhorn avatar mingwandroid avatar mritter-g avatar mstorsjo avatar nico avatar pixelflinger avatar reed-at-google avatar scottamain avatar swarnagit2024 avatar thedmail avatar tommynnguyen avatar zuav avatar

Watchers

 avatar  avatar

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.