生成文件命名规则:boost中有许多库,有的库需要编译、而有的库不需要编译,只需包含头文件就可以使用。编译生成的文件名字普遍较长,同一个库根据编译链接选项不同,又可以生成多个不同名字的文件。生成的文件名字是很长,可是这样带的信息才多,也就容易识别出用途。其实生成文件的名字遵循一定的规则,有着固定的格式。识别这种格式,能帮助我们更高效地使用boost库。生成文件名字格式如:

BOOST_LIB_PREFIX + BOOST_LIB_NAME + "-" + BOOST_LIB_TOOLSET + "-" + BOOST_LIB_THREAD_OPT + "-" + BOOST_LIB_RT_OPT + "-" + BOOST_LIB_VERSION

这些定义为:

  BOOST_LIB_PREFIX: 静态库为 "lib" (否则无,是用动态链接库)

  BOOST_LIB_NAME: 库的基本名称 ( 比方说 boost_regex).

  BOOST_LIB_TOOLSET: 编译工具集名称 ( 比如:vc6, vc7, bcb5 )

  BOOST_LIB_THREAD_OPT: 多线程为 "-mt" ,否则为空

  BOOST_LIB_RT_OPT: 指示使用的运行库的后缀,

组合下面的一个或者更多字符:

s 静态运行库,指的是静态链接到运行时库(不出现表示动态).

g 调试/诊断 runtime (release if not present).

d 调试版本 (不出现表示 release 版 ).

p STLPort 版本.

注:对 vc 来说,gd 总是一起出现

  BOOST_LIB_VERSION: Boost 版本, Boost 版本 x.y 表示为 x_y形式.
 
 编译:为了简化boost库的编译,boost库中带了一个用来编译的工具,名字是bjam.exe或者b2.exe.

1:运行boost下的bootstap.bat脚本就会自动生上述的两个编译工具,并且拷贝到boost目录下. 也可以进入tools/build目录下找到类似的脚本或者项目源码来编译.

2: bjam.exe的参数

Feature

Allowed values

Notes

variant

debug,release

link

shared,static

Determines if Boost.Build creates shared or static libraries

threading

single,multi

Cause the produced binaries to be thread-safe. This requires proper support in the source code itself.

address-model

32,64

Explicitly request either 32-bit or 64-bit code generation. This typically requires that your compiler is appropriately configured. Please refer to the section called “C++ Compilers” and your compiler documentation in case of problems.

toolset

(Depends on configuration)

The C++ compiler to use. See the section called “C++ Compilers” for a detailed list.

(Vs2008)msvc-8.0 (vs2010)msvc-10.0

include

(Arbitrary string)

Additional include paths for C and C++ compilers.

define

(Arbitrary string)

Additional macro definitions for C and C++ compilers. The string should be either SYMBOL or SYMBOL=VALUE

cxxflags

(Arbitrary string)

Custom options to pass to the C++ compiler.

cflags

(Arbitrary string)

Custom options to pass to the C compiler.

linkflags

(Arbitrary string)

Custom options to pass to the C++ linker.

runtime-link

shared,static

Determines if shared or static version of C and C++ runtimes should be used.

--build-dir=<builddir>

编译的临时文件会放在builddir里(这样比较好管理,编译完就可以把它删除了)

--stagedir=<stagedir>

存放编译后库文件的路径,默认是stage

--build-type=complete

编译所有版本,不然只会编译一小部分版本(确切地说是相当于:variant=release, threading=multi;link=shared|static;runtime-link=shared)

variant=debug|release

决定编译什么版本(对应文件中的d 调试版本 不出现表示 release 版)

link=static|shared

决定使用静态库还是动态库。(对应文件中的BOOST_LIB_PREFIX )

threading=single|multi

决定使用单线程还是多线程库。(对应文件中的BOOST_LIB_THREAD_OPT)

runtime-link=static|shared

决定是静态还是动态链接C/C++标准库。(对应文件中的BOOST_LIB_THREAD_OPT)

--with-<library>

只编译指定的库,如输入--with-regex就只编译regex库了。

--show-libraries

显示需要编译的库名称

bjam.exe --toolset=msvc-10.0 --with-date_time runtimelink=static link=static stage 
意思是要生静态库,该静态库静态链接C运行时库
生成的文件名字是:libboost_date_time-vc100-mt-sgd-1_48.lib(debug version),libboost_date_time-vc100-mt-s-1_48.lib(release version) 两个文件.

bjam.exe --toolset=msvc-10.0 --with-date_time runtimelink=shared link=static stage
意思是要生静态库,该静态库动态链接C运行时库
生成的文件名字是:libboost_date_time-vc100-mt-gd-1_48.lib(debug verion),libboost_date_time-vc100-mt-1_48.lib(release version) 两个文件.

bjam.exe --toolset=msvc-10.0 --with-date_time runtimelink=shared link=shared stage
意思是要生动态库,该动态库动态链接C运行时库
生成的文件名字是:boost_date_time-vc100-mt-gd-1_48.lib(debug version),boost_date_time-vc100-mt-1_48.lib(release version) 两个文件.
生成的dll名字是:boost_date_time-vc100-mt-gd-1_48.dll(debug version),boost_date_time-vc100-mt-1_48.dll(release version)

编译选项方面还有install等参数.

boost库生成文件命名和编译的更多相关文章

  1. (九)boost库之文件处理filesystem

    (九)boost库之文件处理filesystem   filesystem库是一个可移植的文件系统操作库,它在底层做了大量的工作,使用POSIX标准表示文件系统的路径,使C++具有了类似脚本语言的功能 ...

  2. 使用boost库生成 随机数 随机字符串

    #include <iostream> #include <boost/random/random_device.hpp> #include "boost/rando ...

  3. boost库在windows下的编译和使用

    因为跨平台的原因,现在要使用到boost库,boost库非常大,现在处于摸索阶段. 首先来说boost库在window下的安装和使用. 一.下载 首先从boost官方主页http://www.boos ...

  4. 使用boost库获取文件夹下所有文件名字

    最近整理项目发现一个曾经找了好久的有用的代码片段,就是获取文件夹下所有文件的名字,和当前文件的绝对路径. 记录一下. 使用的是boost库, #include <boost/filesystem ...

  5. c++使用boost库遍历文件夹

    1.只在当前目录下遍历 #include <boost/filesystem.hpp> string targetPath="/home/test/target"; b ...

  6. Boost库编译后命名方式

    Boost官网的<Geting Started On Windows>(http://www.boost.org/doc/libs/1_38_0/more/getting_started/ ...

  7. windows下编译和安装boost库

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

  8. Boost库编译安装

    一.Boost库介绍         Boost库是一个经过千锤百炼.可移植.提供源代码的C++库,作为标准库的后备,是C++标准化进程的发动机之一.Boost库由C++标准委员会库工作组成员发起,其 ...

  9. vs配置boost库

    步骤: 1.在boost官网下载boost版本,以1.59.0为例. 2.解压,解压后可看到文件夹下有个bootstrap.bat文件. 注意: 如果有以下error: 'cl' 不是内部或外部命令, ...

随机推荐

  1. 微信小程序 "request:fail 发生了 SSL 错误无法建立与该服务器的安全连接。"

    android机子可以真机预览,ios机子报这个错误 检测域名 苹果ATS检测 https://cloud.tencent.com/product/ssl#userDefined10 以上都通过 ht ...

  2. C# 窗体 切换、重复显示等遗留问题解决(第五天)

    一.解决同一窗体多次点击重复显示BUG (1)点击弹出学校窗体 #region 弹出学校窗体 /// <summary> /// 弹出学校窗体 /// </summary> / ...

  3. dubbo之路由规则

    向注册中心写入路由规则:(通常由监控中心或治理中心的页面完成) RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader ...

  4. nginx-配置反向代理实例

    nginx反向代理配置及优化 2009-05-26 作者:守住每一天blog:liuyu.blog.51cto.combbs:bbs.linuxtone.orgmsn:liuyubj520#hotma ...

  5. 解决springmvc返回json中文乱码

    在pringmvc中通过设置@ResponseBody返回json乱码问题,这个问题上网找了很久,发现答案真是人云亦云,奉上我的解决方案: 解决方案一:需要导入 jackson-core-asl-1. ...

  6. CSS3:变换和动画

    <html> <style> .container{ -webkit-perspective: 800; -webkit-perspective-origin: 50% 40% ...

  7. mysql_基础1

    初学mysql,感觉挺有意思的. mysql指令的一些参数: promrt修改提示符:   PROMPT \D mysql的语法规范: 一些函数: 创建数据库: SHOW CREATE DATABAS ...

  8. springboot配置多数据源(JdbcTemplate方式)

    在实际开发中可能会遇到需要配置多个数据源的情况,比如:需要使用多个host.需要使用多种数据库(MySql.Oracle.SqlServer…) 如果使用springboot开发,可做如下配置: Co ...

  9. 表单enctype属性传值问题

    form表单的enctype设置为multipart/form-data后,表单中除了文件后台能拿到,其他值后台都拿不到. 知识点: 一.application/x-www-form-urlencod ...

  10. Django - ORM实现用户登陆

    1.路由分发cmdb(app)下urls.py中,建立url与函数对应关系 2.login.html代码: 3.views.py中,login函数,确认是否登陆成功 备注:从前端 获取用户名,密码,在 ...