当前位置:网站首页>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)
边栏推荐
猜你喜欢
365 days challenge LeetCode1000 topic - Day 051 special binary sequence partition
i18n 国际化
作为常用的荧光标记试剂Cy5 亚磷酰胺(CAS号:182873-67-2)有哪些特点了?
Chapter3 numpy创建数组
VMware不正常关机
2021-07-21
三箭资本濒临破产?市场陷入1907年恐慌之中?加密监管不可避免
【问题记录】pip 安装报错 Failed to establish a new connection
Zabbix 5.0 监控教程(五)
马斯克被因狗狗币被索赔2580亿美元 操纵价格牟利?狗狗币已下跌92%
随机推荐
整数溢出机制 C
JSON beautification plugin for Chrome
作为常用的荧光标记试剂Cy5 亚磷酰胺(CAS号:182873-67-2)有哪些特点了?
C专家编程 第9章 再论数组 9.4 数组片段的下标
网路编程_socket返回值
最优化方法——0.618法matlab实现
Exchange VLAN experiment
开发工程师必备————【Day05】UDP协议;进程的并发与并行
Linux安装Redis
【洛谷】P1456 Monkey King
多商户商城系统功能拆解23讲-平台端分销等级
Talk about those marketing tools - coupons
【信号去噪】基于Sage-Husa自适应卡尔曼滤波器实现海浪磁场噪声抑制及海浪磁场噪声的产生附matlab代码
C专家编程 第10章 再论指针 10.2 指针数组就是Iliffle向量
新型双功能螯合剂NOTA及其衍生物CAS号:147597-66-8p-SCN-Bn-NOTA
Day021 图书管理系统(对象和数组)
Promoting practice with competitions-Like the 84th biweekly game reflection and the 305th weekly game supplementary questions
权限系统就该这么设计(万能通用),稳的一批!
redis集群详解
【扫雷--1】