增加编译说明

This commit is contained in:
Gy Hu 2022-12-27 10:07:14 +08:00
parent 65625a573e
commit 6a5e174f27

View File

@ -29,7 +29,44 @@ Visual Studio code
cmake cmake
vcpkg vcpkg
#### 构建步骤
以下是在vscode中操作vs中的操作类似。
1.安装vcpkgcmakevscode
2.安装相应的库如果安装的版本不同则根据vcpkg安装成功后提示的find_package修改CMakeLists.txt内容即可。或者自己编译。
```
vcpkg install mongoose
vcpkg install nlohmann-json
```
3.vscode 配置CMakePresets.json,主要设置CMAKE_C_COMPILER 和CMAKE_CXX_COMPILER 为cl.exe.参考如下
```
{
"name": "x86-release",
"displayName": "x86-release",
"description": "Sets Ninja generator, build and install directory",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"architecture":{
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_TOOLCHAIN_FILE": {
"value": "C:/soft/vcpkg/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
}
},
"environment": {
}
}
```
4.vscode中右键configure all projects,在Terminal中点击Run Task如没有先配置build任务然后运行即可
#### 更新说明 #### 更新说明
2022-12-26 增加3.8.1.26版本支持。 2022-12-26 增加3.8.1.26版本支持。