boost库生成文件命名和编译
生成文件命名规则: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库生成文件命名和编译的更多相关文章
- (九)boost库之文件处理filesystem
(九)boost库之文件处理filesystem filesystem库是一个可移植的文件系统操作库,它在底层做了大量的工作,使用POSIX标准表示文件系统的路径,使C++具有了类似脚本语言的功能 ...
- 使用boost库生成 随机数 随机字符串
#include <iostream> #include <boost/random/random_device.hpp> #include "boost/rando ...
- boost库在windows下的编译和使用
因为跨平台的原因,现在要使用到boost库,boost库非常大,现在处于摸索阶段. 首先来说boost库在window下的安装和使用. 一.下载 首先从boost官方主页http://www.boos ...
- 使用boost库获取文件夹下所有文件名字
最近整理项目发现一个曾经找了好久的有用的代码片段,就是获取文件夹下所有文件的名字,和当前文件的绝对路径. 记录一下. 使用的是boost库, #include <boost/filesystem ...
- c++使用boost库遍历文件夹
1.只在当前目录下遍历 #include <boost/filesystem.hpp> string targetPath="/home/test/target"; b ...
- Boost库编译后命名方式
Boost官网的<Geting Started On Windows>(http://www.boost.org/doc/libs/1_38_0/more/getting_started/ ...
- windows下编译和安装boost库
boost是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库. 获取方式 boost提供源码形式的安装包,可以从boost官方网站下载,目前最新版本是1.59.0. 本机上正好有boos ...
- Boost库编译安装
一.Boost库介绍 Boost库是一个经过千锤百炼.可移植.提供源代码的C++库,作为标准库的后备,是C++标准化进程的发动机之一.Boost库由C++标准委员会库工作组成员发起,其 ...
- vs配置boost库
步骤: 1.在boost官网下载boost版本,以1.59.0为例. 2.解压,解压后可看到文件夹下有个bootstrap.bat文件. 注意: 如果有以下error: 'cl' 不是内部或外部命令, ...
随机推荐
- ddrmenu
<%@ Register TagPrefix="dnn" TagName="MENU" Src="~/DesktopModules/DDRMen ...
- HyperLink的使用
<asp:HyperLink ID="Hyperlink2" NavigateUrl='<%# string.Format("AddOrganizition. ...
- Python 之re正则表达式
- Render2
https://blog.csdn.net/wf19930209/article/details/81109388
- CAD把一个命令当着一个函数调用,不执行(com接口VB语言)
主要用到函数说明: MxDrawXCustomFunction::Mx_SendStringToExecuteFun 把一个命令当着一个函数调用,不执行,详细说明如下: 参数 说明 CString s ...
- JAR包中读取资源文件
我们常常在代码中读取一些资源文件(比如图片,音乐,文本等等).在单独运行的时候这些简单的处理当然不会有问题.但是,如果我们把代码打成一个jar包以后,即使将资源文件一并打包,这些东西也找不出来了.看看 ...
- 常见的Xshell运行命令
最近接触到了Xshell这个软件,使用这个软件我们来进行连接Linux系统,进去之后我们可能会两眼一抹黑,小编就带大家来学些常见的shell命令. 首先我们要跟大家从最简单的聊起,我们进入Xshell ...
- CF36E Two Paths (欧拉回路+构造)
题面传送门 题目大意:给你一张可能有重边的不保证联通的无向图,现在要在这个图上找出两条路径,恰好能覆盖所有边一次,根据边的编号输出方案,无解输出-1 一道很不错的欧拉路径变形题 首先要知道关于欧拉路径 ...
- hdu2003 求绝对值【C++】
求绝对值 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...
- noip模拟赛 c
分析:一道比较难的爆搜题.首先要把9个块的信息存下来,记录每个块上下左右位置的颜色,然后记录每一排每一列能否操作,之后就是bfs了.在bfs的时候用一个数记录状态,第i位表示原来的第i个块现在在哪个位 ...