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. 《JS权威指南学习总结--7.10 数组类型》

    内容要点: 一.数组类型 判断它是否为数组通常非常有用.在ES5中,可以使用Array.isArray()函数来做这件事情: Array.isArray([]); //=>true Array. ...

  2. Makefile:130: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.

    修改了snmp里面的包Makefile,出现了如下问题: Makefile:130: *** missing separator (did you mean TAB instead of 8 spac ...

  3. LeetCode OJ 122. Best Time to Buy and Sell Stock II

    Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...

  4. urllib2 之info 学习

    之前介绍了根据old_url获取真实url的geturl的方法,而根据urlopen返回的应答对象的info方法可以获取服务器发送头部headers的内容,并且通过字典形式反馈出来,同样测试代码如下: ...

  5. G - 小晴天老师系列——可恶的墨水瓶

    G - 小晴天老师系列——可恶的墨水瓶 Time Limit: 2000/1000MS (Java/Others)    Memory Limit: 128000/64000KB (Java/Othe ...

  6. 如何用Navicat for MySQL 将mysql中的数据库导出,导入。

    数据库导出 1.双击要导出的数据库,右键选转储SQL文件...,选择要保存的文件夹. 2.点击开始后,开始导出. 数据库导入 1.新建数据库,数据库的名字必须和导入的数据库文件一致. 2.在新建的数据 ...

  7. 元素NULL判断

    元素取值val() val()方法主要用来获取form元素的值像input select textarea.在对select取值的时候当没有option被选定时val()会返回null,至少一个opt ...

  8. MySQL 多表查询分页

    SELECT v.*, vt.id vid, vt.vote_id, vt. option, vt.poll FROM vote v JOIN vote_option vt ON v.id = vt. ...

  9. php学习的第8天

    晚上老师布置啦17题算数问题的作业 我一看 感觉挺容易的 动手就开始做啦起来 不知不觉也9点多啊 终于做好前部题目 发现这我3个月前也遇到类似的题目 那是我还一题都做一题用上1个钟左右 好多也做不出 ...

  10. 在CentOS7部署zookeeper集群以及简单API使用

    一.部署zookeeper集群 zookeeper是一个针对大型分布式系统的协调系统,提供的功能有统一名称服务.分布式同步等. 1.上传zk安装包 2.解压     tar -xzvf zookeep ...