Files
EzUI/BUILD.md
2026-02-20 12:18:52 +08:00

112 lines
2.5 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.

# EzUI 构建说明
## 前置要求
### 必需工具
1. **CMake** (版本 3.0 或更高)
- 下载地址https://cmake.org/download/
- 安装后建议将 CMake 添加到系统 PATH 环境变量
- 脚本会自动在以下位置查找 CMake
- 系统 PATH 中的 `cmake`
- `C:\Program Files\CMake\bin\cmake.exe`
2. **Visual Studio 2022** (包含 C++ 构建工具)
- 社区版即可免费使用
- 下载地址https://visualstudio.microsoft.com/downloads/
- 安装时需要选择"使用 C++ 的桌面开发"工作负载
### 可选工具
- **Git** - 用于版本控制(如需从 GitHub 克隆代码)
## 快速构建
### 构建所有配置
```bash
build_all.bat
```
这将自动构建以下所有配置:
- x86 Debug → `lib\EzUI_Debug_Win32.lib`
- x86 Release → `lib\EzUI_Release_Win32.lib`
- x64 Debug → `lib\EzUI_Debug_x64.lib`
- x64 Release → `lib\EzUI_Release_x64.lib`
### 单独构建 x86
```bash
build_x86.bat
```
### 单独构建 x64
```bash
build_x64.bat
```
## Visual Studio 开发
如果需要在 Visual Studio 中开发和调试:
```bash
configure_vs.bat
```
这将生成 CMake 解决方案文件,然后可以打开:
- `build_x86\EzUI.sln` (x86 项目)
- `build_x64\EzUI.sln` (x64 项目)
## 清理构建输出
```bash
clean.bat
```
这将删除以下目录:
- `build_x86/` - x86 构建目录
- `build_x64/` - x64 构建目录
- `lib/` - 静态库输出目录
## 手动 CMake 命令
如果你想使用 CMake 命令行:
```bash
# 配置 x86
cmake -S . -B build_x86 -A Win32
# 配置 x64
cmake -S . -B build_x64 -A x64
# 编译 x86 Debug
cmake --build build_x86 --config Debug --target EzUI
# 编译 x86 Release
cmake --build build_x86 --config Release --target EzUI
# 编译 x64 Debug
cmake --build build_x64 --config Debug --target EzUI
# 编译 x64 Release
cmake --build build_x64 --config Release --target EzUI
```
## 输出文件
所有静态库文件将输出到 `lib/` 目录,命名规则为:
| 配置 | 平台 | 输出文件 |
|------|------|----------|
| Debug | x86 | `lib\EzUI_Debug_Win32.lib` |
| Release | x86 | `lib\EzUI_Release_Win32.lib` |
| Debug | x64 | `lib\EzUI_Debug_x64.lib` |
| Release | x64 | `lib\EzUI_Release_x64.lib` |
## 构建配置说明
- **始终编译为静态库**:不再支持动态库选项
- **输出目录**:所有库文件统一输出到 `lib/` 目录
- **命名规则**`EzUI_$(Configuration)_$(Platform).lib`
- **字符编码**:使用 UTF-8 编译 (`/utf-8`)
- **Unicode**:启用 Unicode 支持
- **预处理器定义**:静态库会自动定义 `EZUI_STATIC`