当前位置:网站首页>VS2019 compiles boost_1_79, generates 32-bit and 64-bit static libraries
VS2019 compiles boost_1_79, generates 32-bit and 64-bit static libraries
2022-08-09 03:12:00 【chexlong】
1 编译准备
环境:WIN10+VS2019+Boost_1_79
目标:编译生成32位和64位boost静态库
源码下载:Boost Downloads
If the download speed from the official website is slow,It can also be downloaded from the source code file uploaded by the author(The original file downloaded from the official website)boost_1_79最新版源码(win和linux)-C++文档类资源-CSDN下载
2 编译Win32 Boost静态库
解压boost_1_79_0.zip
打开VS2019的32位命令行工具,如下图
Enter into the decompression aboveboost库目录中
执行如下命令生成32位b2工具文件,编译boost库
.\bootstrap.bat
使用如下命令查看boostAll supported libraries
b2 --show-libraries
可以看到,BoostMany library categories,Not all libraries are required in project development,Compile according to the actual situation,编译命令如下:
b2 stage --toolset=msvc-14.2 --without-graph --without-graph_parallel --without-mpi --without-nowide --without-program_options --without-test --without-python --without-wave --stagedir=“.\build\x86” link=static runtime-link=shared runtime-link=static threading=multi debug release
命令参数含义:
stage/install:stage表示只生成库(dll和lib),install还会生成包含头文件的include目录.
toolset:指定编译器,可选的如msvc-14.2(VS2019编译器)等.
without/with:选择不编译/编译哪些库.
stagedir/prefix:stage时使用stagedir,install时使用prefix,表示编译生成文件的路径.
build-dir:编译生成的中间文件的路径.默认在根目录下,目录名为bin.v2,等编译完成后可将这个目录全部删除,所以不需要去设置.
link:生成动态链接库/静态链接库.生成动态链接库需使用shared方式,生成静态链接库需使用static方式.
runtime-link:动态/静态链接C/C++运行时库.
threading:单/多线程编译.分别指定single/multi方式.
debug/release:编译debug/release版本.
开始编译
最后在.\build\x86\lib 目录下,Generate the required static library(Only part of it is shown in the screenshot)
3 编译Win64 Boost静态库
将编译32All intermediate files generated by the bit library are deleted,i.e. delete the folderbin.v2
打开VS2019的64位命令行工具,如下图
执行如下命令生成64位b2工具文件,编译boost库
.\bootstrap.bat
然后执行如下命令,进行编译
b2 stage --toolset=msvc-14.2 --without-graph --without-graph_parallel --without-mpi --without-nowide --without-program_options --without-test --without-python --without-wave --stagedir=“.\build\x64” link=static runtime-link=shared runtime-link=static threading=multi address-model=64 debug release
与编译32Bit program commands differ:
a)Static library generation directory,放到.\build\x64里边;
b)显式使用address-model=64属性,才能生成64位的静态库,Otherwise generated by default32位库.
最后在.\build\x64\lib 目录下,生成所需的64位静态库(Only part of it is shown in the screenshot)
边栏推荐
猜你喜欢
【剑指offer】二进制中1的个数&&2的幂
Exchange VLAN experiment
CI/CD:持续集成/持续部署(难舍难分)
SQL注入(4)
三箭资本濒临破产?市场陷入1907年恐慌之中?加密监管不可避免
23 Lectures on Disassembly of Multi-merchant Mall System Functions-Platform Distribution Level
智能计数器控制板的功能及应用有哪些?
DSPE-PEG-OH,DSPE-PEG-Hydroxyl,磷脂-聚乙二醇-羟基仅供科研实验使用
Kaggle(六)特征衍生技术 特征聚合
浅聊一下那些营销工具—优惠券
随机推荐
Embedded system driver advanced [3] - __ID matching and device tree matching under platform bus driver development
2022-08-08 The fifth group Gu Xiangquan study notes day31-collection-junit unit test
如何应对网络攻击?
BigDecimal 详解
2021-07-21
C专家编程 第10章 再论指针 10.2 指针数组就是Iliffle向量
Arrays and slices
【剑指offer】二进制中1的个数&&2的幂
【物理应用】基于El-centro地震波作用下隔震与非隔震支座下的顶层位移、速度、加速度的对比情况附matlab代码
渗透测试-域环境下的信息收集
ARM开发(二)ARM体系结构——ARM,数据和指令类型,处理器工作模式,寄存器,状态寄存器,流水线,指令集,汇编小练习题
powershell execution strategy
unshift() :将一个或多个元素添加到数组的开头
三箭资本濒临破产?市场陷入1907年恐慌之中?加密监管不可避免
Hcip MPLS experiment
C专家编程 第8章 为什么程序员无法分清万圣节和圣诞节 8.10 轻松一下---国际C语言混乱代码大赛
ros入门(安装)
SQL注入(3)
交换VLAN实验
最优化方法——0.618法matlab实现