Files
update-client/Docs/02-编译环境和第三方依赖说明.md
T

76 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SimCAE Hub 客户端编译环境和第三方依赖说明
本文说明 `update-client` 的 Qt/C++ 客户端编译环境。客户端保留 Launcher / Updater / Bootstrap 机制,依赖 Qt、CMake 和 OpenSSL。
## 1. 通用要求
| 依赖 | 要求 |
| --- | --- |
| CMake | 建议 3.20 或更高版本 |
| C++ | C++17 |
| Qt | Qt 5,至少需要 Core、Network、Gui、Widgets |
| OpenSSL | 用于 Manifest RSA-SHA256 验签 |
| 编译器 | Windows 推荐 Visual Studio 2022 x64Linux 推荐 gcc/g++ |
项目已提供 CMake Preset
| Preset | 平台 | 用途 |
| --- | --- | --- |
| `x64-debug` | Windows | Debug 编译 |
| `x64-release` | Windows | Release 编译 |
| `linux-x64-debug` | Linux | Debug 编译 |
| `linux-x64-release` | Linux | Release 编译 |
## 2. Windows 环境
建议安装:
1. Visual Studio 2022,勾选 Desktop development with C++。
2. Qt 5 x64,版本可以与当前团队环境保持一致。
3. CMake。
4. OpenSSL x64。
如果 Qt 没有加入环境变量,可以在编译前指定 `CMAKE_PREFIX_PATH``Qt5_DIR`。示例:
```powershell
$env:CMAKE_PREFIX_PATH = "C:\Qt\5.15.2\msvc2019_64"
```
如果 Qt 安装在别的位置,只改这一行。
OpenSSL 可以放在 `update-client/thirdparty/OpenSSL-Win64`,也可以在配置时通过 `SIMCAE_OPENSSL_ROOT` 指向自定义目录。
## 3. Linux 环境
Ubuntu 示例:
```bash
sudo apt update
sudo apt install -y build-essential cmake qtbase5-dev qttools5-dev qttools5-dev-tools libssl-dev
```
Linux 下通常直接使用系统 OpenSSL;如需指定自定义 OpenSSL,可用 CMake 变量配置。
## 4. 编译输出
Windows Release 可执行文件输出目录:
`update-client/out/bin/Release`
Windows CMake 构建目录:
`update-client/out/build/x64-release`
Linux Release 可执行文件输出目录以当前 CMake Preset 和构建脚本为准,SDK 打包时通过 `--source-dir` 指定。
实际打包 SDK 前,应确认 Release 输出目录中至少包含:
1. `Launcher`
2. `Updater`
3. `Bootstrap`
4. 可选的示例 `MainApp`
最终客户软件包里的 `config/app_config.json``config/manifest_public_key.pem` 由服务端在发布包上传时生成;`server_config.json` 会编译进 EXE 作为兜底地址,不需要进入 SDK 包。
SDK 打包见 `../打包成SDK.md`,客户端运行链路和接入限制见 `01-客户端接入打包部署指南.md`