1.起因:

手上有一个用到了boost的asio库和thread库的工程要编译到手机上(Android版本和ios版本),本文只介绍如何编译到Android版本,ios版本之后再介绍,也许就不介绍了(注:因为mac下官方有教程如何编译)

2.准备工作

2.1 下载boost库,我这里用到的是1.58.0

2.2 下载NDK(注:Google官方地址,需要翻墙),根据情况自己选择下载版本,我这里用的是android-ndk-r10d-windows-x86_64.exe

2.3 安装visual studio 2012或者2013, 我用的是vs2013

3.开始编译

3.1 解压boost压缩文件

3.2 在命令行下进入上步文件夹下,然后运行bootstrap.bat,这里会生成project-config.jam文件

3.3 修改project-config.jam文件,修改内容如下

import option ;

androidNDKRoot = E:/android/android-ndk-r10d ; # put the relevant path
using gcc : android
:
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++
:
<archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar
<compileflags>-fexceptions
<compileflags>-frtti
<compileflags>-fpic
<compileflags>-ffunction-sections
<compileflags>-funwind-tables
<compileflags>-D__ARM_ARCH_5__
<compileflags>-D__ARM_ARCH_5T__
<compileflags>-D__ARM_ARCH_5E__
<compileflags>-D__ARM_ARCH_5TE__
<compileflags>-Wno-psabi
<compileflags>-march=armv5te
<compileflags>-mtune=xscale
<compileflags>-msoft-float
<compileflags>-mthumb
<compileflags>-Os
<compileflags>-std=c++11
<compileflags>-fomit-frame-pointer
<compileflags>-fno-strict-aliasing
<compileflags>-finline-limit=64
<compileflags>-I$(androidNDKRoot)/platforms/android-9/arch-arm/usr/include
<compileflags>-Wa,--noexecstack
<compileflags>-DANDROID
<compileflags>-D__ANDROID__
<compileflags>-DNDEBUG
<compileflags>-O2
<compileflags>-g
<compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/include
<compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include
# @Moss - Above are the 'oficial' android flags
<architecture>arm
<compileflags>-fvisibility=hidden
<compileflags>-fvisibility-inlines-hidden
<compileflags>-fdata-sections
<cxxflags>-D__arm__
<cxxflags>-D_REENTRANT
<cxxflags>-D_GLIBCXX__PTHREADS
; option.set keep-going : false ;

3.4 创建批处理命令,内容如下

b2 --without-context --without-coroutine --without-program_options --without-container --without-iostreams --without-locale --without-signals --without-wave --without-timer --without-mpi --without-log --without-test --without-atomic --without-chrono --without-filesystem --without-graph --without-graph_parallel --without-math --without-python --without-random link=static threading=multi threadapi=pthread target-os=linux toolset=gcc-android

b2 参数说明

  • --without 表示不编译这个项目
  • --with 表示要编译这个项目

3.5 运行3.4创建的批处理,应该就能生成静态库文件,可以在项目中使用了

后记:如果还是有问题,详细查看我之前的步骤,欢迎大家来和我讨论

windows下编译Android版本的boost库文件的更多相关文章

  1. ubuntu下编译android jni到so库的mk文件配置

    项目根目录下的Android.mk文件 LOCAL_PATH:= $(call my-dir)include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional L ...

  2. 在Windows下编译Emacs

    在Windows下编译Emacs Windows下编译好的Emacs主要有两个版本,一个来自http://nqmacs.sourceforge.net/,另一个来自http://www.crasseu ...

  3. windows下编译和安装boost库

    boost是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库. 获取方式 boost提供源码形式的安装包,可以从boost官方网站下载,目前最新版本是1.59.0. 本机上正好有boos ...

  4. 如何在WINDOWS下编译BOOST C++库 .

    如何在WINDOWS下编译BOOST C++库 cheungmine 2008-6-25   写出来,怕自己以后忘记了,也为初学者参考.使用VC8.0和boost1.35.0.   1)下载boost ...

  5. osg for android学习之一:windows下编译(亲测通过)【转】

    1. 首先需要一个OSG for android的环境 (1)NDK 现在Eclipse 对NDK已经相当友好了,已经不需要另外cygwin的参与,具体可以参考 Android NDK开发篇(一):新 ...

  6. 编译 Android 版本的 Opus 音频编解码库的方法

    Opus 音频编解码库是 Speex 音频编解码库的下一代版本,从编解码性能以及质量上来讲都有了长足的进步.Opus 的编译非常简单,但是官方并未给出详细的 Android 版本编译指南,查找了大量资 ...

  7. linux下编译qt5.6.0静态库——configure配置

    linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...

  8. linux下编译qt5.6.0静态库——configure配置(超详细,有每一个模块的说明)(乌合之众)

    linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...

  9. 一步步实现windows版ijkplayer系列文章之四——windows下编译ijkplyer版ffmpeg

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

随机推荐

  1. 编写高质量iOS代码的52个有效方法2-1

    一.变量的定义位置(用{}声明示例变量或者用@property属性声明实例变量) 1.用{}声明示例变量: 此方法生命的实例变量,编译器在编译时,会自动计算其偏移量(表示该变量距离存放对象的内存区域的 ...

  2. vs2013+opencv2.4.11+Qt5.5.1配置

    注意本教程配置环境:win7 32位 如果只配置vs2013+opencv2.4.11,参考http://jingyan.baidu.com/article/ff411625b1311a12e4823 ...

  3. C语言中字符串

    #include <stdio.h> int main(){ char s[] = "ABCD"; char *p; for(p=s; p<s+4; p++) { ...

  4. 转delphi中nil的用法

    转自:http://blog.csdn.net/haiou327/article/details/6666124 delphi中nil的用法 和C++中的NULL一样的意思,指空值,它和0值不一样-- ...

  5. java虚拟机存储区

    方法区和堆区是数据共享区. 栈区:数据不共享.方法参数.局部变量.参与运算的中间结果.返回值等等都在栈区中. 堆区:数据共享.存放对象. 方法区存放类型信息,类型信息包括:字段信息.方法信息.该类型的 ...

  6. ios 中Category类别(扩展类)小结

    类别 类别是一种为现有的类添加新方法的方式.利用Objective-C的动态运行时(runtime)分配机制,可以为现有的类添加新方法,这种为现有的类添加新方法的方式称为类别catagory,他可以为 ...

  7. js中两个感叹号的原理与用法分析(转载记录没找到原帖)

    var foo; alert(!foo);//undifined情况下,一个感叹号返回的是true; alert(!goo);//null情况下,一个感叹号返回的也是true; var o={flag ...

  8. Html 嵌入 swf

    1. object + embed       传统的方法 优点:浏览器兼容性好,是 Macromedia 一直以来的官方方法缺点:a.embed 标签是不符合 W3C 的规范的,无法通过验证.当然, ...

  9. oc 是否允许远程通知

    UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSett ...

  10. 测试sql性能方法

    SET STATISTICS io ON         SET STATISTICS time ON         go          ---你要测试的sql语句          selec ...