android sdk linux cmkae,android-cmake 配置

改编自 http://android-cmake.googlecode.com/hg/documentation.html

Android CMake Installation This file gives instructions on how to properly setup your NDK for cmake.

Requirements * android ndk r5b * android sdk * ant -- for command line build of android projects These instructions will work on Linux, but may work on Mac OSX or Windows with slight modification. android-ndk-r5b can be found here: http://developer.android.com/sdk/ndk/index.html Read its documentation, specifically the Standalone Toolchain. Assumming you read the documentation, follow steps for creating a standalone toolchain. export NDK=~/android-ndk-r5b $NDK/build/tools/make-standalone-toolchain.sh --platform=android-5 \ --install-dir=$HOME/android-toolchain

//notes:对于4.0,--platform=android-14 android-sdk can be found here: http://developer.android.com/sdk/index.html Please install that, and add it to your path. ANDROID_SDK=~/android-sdk-linux_86 export PATH=$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$PATH Lets try the hello-cmake sample.

Ubuntu Quick Start Lets assume you have ANDROID_CMAKE pointing to the android-cmake directory. Export a working directory, this will be where the script downloads the ndk to WORK=$HOME

(如果没有,执行如下命令下载 hg clone https://code.google.com/p/android-cmake/ $HOME/android/android-cmake)

This will pull down the ndk r5, and setup a NDK standalone toolchain:

cd $ANDROID_CMAKE/scripts

./get_ndk_toolchain_linux.sh $WORK

//对于其他版本android,需要修改get_ndk_toolchain_linux.sh。例如其中的ndk包的名称。对于4.0,为ball=android-ndk-r7b-linux-x86.tar.bz2

//ln -fs $destination/android-toolchain /opt/android-toolchain,一定要成功,否者可能出问题

Add the toolchain location to your bashrc or otherwise export it to your env:

echo export ANDTOOLCHAIN=$ANDROID_CMAKE/toolchain/android.toolchain.cmake >> $HOME/.bashrc

Now when you re-source your bashrc, you can run cmake with the toolchain:

cd $MY_CMAKE_PROJECT

mkdir build

cd build

cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN ..

alias trick Add these lines to your

bashrc: export ANDTOOLCHAIN=$ANDROID_CMAKE/toolchain/android.toolchain.cmake alias android-cmake='cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN ' Then to run cmake for android do: cd $MY_CMAKE_PROJECT mkdir build cd build android-cmake ..

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值