vcpkg记录
This commit is contained in:
75
Languages/cpp/Vcpkg.txt
Normal file
75
Languages/cpp/Vcpkg.txt
Normal file
@@ -0,0 +1,75 @@
|
||||
常用库安装
|
||||
curl[ssl,http2,http3,openssl,websockets,zstd,ssh,psl,idn2,brotli]
|
||||
|
||||
vcpkg.exe install boost:x64-mingw-dynamic --allow-unsupported
|
||||
Please use the following command when you need to remove all boost ports/components:
|
||||
vcpkg remove boost-uninstall:x64-mingw-dynamic --recurse"
|
||||
|
||||
x.安装
|
||||
git clone https://github.com/microsoft/vcpkg
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.bat (其他平台用对应的脚本)
|
||||
|
||||
x.如何更新
|
||||
git pull
|
||||
重新./bootstrap-vcpkg.bat
|
||||
|
||||
x.查询有哪些库 https://vcpkg.io/en/index.html
|
||||
|
||||
在 triplets/下面设置
|
||||
.\vcpkg.exe install openssl --triplet x86-windows
|
||||
--triplet 后面的内容就是triplets/下的列表
|
||||
set(VCPKG_PLATFORM_TOOLSET v141)
|
||||
有效设置
|
||||
Visual Studio 2022 平台工具集为 v143。
|
||||
Visual Studio 2019 平台工具集为 v142。
|
||||
Visual Studio 2017 平台工具集为 v141。
|
||||
Visual Studio 2015 平台工具集为 v140。
|
||||
|
||||
x.安装库
|
||||
vcpkg install spdlog (默认x86)
|
||||
vcpkg install spdlog:x64-windows
|
||||
vcpkg install spdlog:x64-windows-static
|
||||
|
||||
x.更新库
|
||||
vcpkg update 或者 vcpkg upgrade 列出
|
||||
upgrade 会列出,但是不升级,使用 -no-dry-run
|
||||
|
||||
vcpkg upgrade spdlog:x64-windows --no-dry-run
|
||||
可以指定多个库参数
|
||||
|
||||
x.查询库
|
||||
vcpkg search spdlog
|
||||
|
||||
x.列出已安装的库
|
||||
vcpkg list
|
||||
|
||||
x.导出一个库
|
||||
vcpkg export spdlog:x64-windows --zip or --7zip
|
||||
–raw 以不打包的目录格式导出
|
||||
–nuget 以nuget包形式导出
|
||||
–ifw 我也不知道这是啥格式
|
||||
–zip 以zip压缩包形式导出
|
||||
–7zip 以7z压缩包形式导出
|
||||
|
||||
x.到处所有已安装的库。
|
||||
--x-all-installed
|
||||
|
||||
导出位置在 vcpkg 目录下
|
||||
|
||||
x.集成到 visual studio (全局)
|
||||
vcpkg integrate install
|
||||
vcpkg integrate remove
|
||||
|
||||
x.集成到 visual studio (某个项目)
|
||||
vcpkg integrate project 生成 nuget 配置文件,同时会给一个安装命令。
|
||||
在 vs 中打开[工具]->nuget->控制台,输入安装命令。
|
||||
|
||||
x.集成到 CMake
|
||||
设置 CMAKE_TOOLCHAIN_FILE {vcpkg_root}/scripts/buildsystems/vcpkg.cmake
|
||||
|
||||
x.例如 VSCode 编辑器
|
||||
settings.json中:
|
||||
"cmake.configureSettings": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
},
|
||||
Reference in New Issue
Block a user