
下载源码
tbb是有开源版和商业版,开源版代码放在了github上面。到仓库的release页面可用下载源码
https://github.com/oneapi-src/oneTBB/releases
选择最新的发布版本即可
CMake构建
这一步使用CMake构建VS解决方案,可以使用命令行或者GUI形式。
命令行模式
命令行模式需要将cmake配置到环境变量,在目录下打开powershell或者gitbash控制台。
1
2
3
4
|
# 新建build目录存放VS解决方案
mkdir build
cd build
cmake -G "Visual Studio 16 2019" ../oneTBB-2021.2.0
|
执行命令后,如有以下配置和构建结束的提示,说明已经构建成功。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
PS F:\3rdparty\TBB\build> cmake -G "Visual Studio 16 2019" ../oneTBB-2021.2.0
-- The CXX compiler identification is MSVC 19.28.29914.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - not found
-- Found Threads: TRUE
-- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
-- HWLOC target HWLOC::hwloc_2 doesn't exist. The tbbbind_2_0 target cannot be created
-- HWLOC target HWLOC::hwloc_2_4 doesn't exist. The tbbbind_2_4 target cannot be created
-- The C compiler identification is MSVC 19.28.29914.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: F:/3rdparty/TBB/build
PS F:\3rdparty\TBB\build>
|
GUI模式
GUI模式则使用CMake软件程序完成上述构建,遵循以下截图步骤操作即可





VS编译安装
在上一步使用CMake完成构建后会生成VS解决方案,使用VS打开,
编译
安装
切换release重复编译-安装步骤。
安装完成后,安装目录下已生成相关库文件。
本文由芒果浩明发布,转载请注明出处。
本文链接:https://blog.mangoeffect.net/cpp/build-intel-tbb-with-msvc-on-windows.html
