编译 Boost for android的库方法

What we need:
Boost (http://switch.dl.sourceforge.net/project/boost/boost/1.56.0/boost_1_56_0.7z)
A compiler (Visual C++ 2010)
Android NDK (http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip)

Download and extract Boost (ex: D:\boost; you can extract only boost, libs, tools subdirs and the files in the main dir).



Download and unzip Android NDK (ex: D:\android-ndk-r10b).




Go to  Boost_dir\tools\build\src and create a new file, 

 user-config.jam


Open that file with a text editor and add:

 import os ;  
 androidNDKRoot = D:/android-ndk-r10 ;
  using gcc : android :  
    $(androidNDKRoot)/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-g++ :  
    <compileflags>--sysroot=$(androidNDKRoot)/platforms/android-9/arch-arm  
    <compileflags>-mthumb  
    <compileflags>-Os  
    <compileflags>-fno-strict-aliasing  
    <compileflags>-O2  
    <compileflags>-DNDEBUG  
    <compileflags>-g  
    <compileflags>-lstdc++  
    <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.8/include  
    <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include  
    <compileflags>-D__GLIBC__   
    <compileflags>-D__arm__  
    <archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-ar  
    <ranlib>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-ranlib  
      ;


Save and close that file.

Open Visual Studio Command Prompt.

Go to boost dir (cd  D:\boost).

Execute: 

 bootstrap




Execute:

 b2 ^  
 --without-python ^  
 --prefix=.\out\ ^
 --build-dir=.\build ^  
 variant=release ^  
 link=static runtime-link=static ^  
 toolset=gcc-android target-os=linux ^  
 threading=multi --stagedir=android stage


If everything went well, you will have the libs in "android" folder.

转载于:https://my.oschina.net/jjyuangu/blog/611030

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值