备份
This commit is contained in:
18
.claude/settings.local.json
Normal file
18
.claude/settings.local.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(cmd.exe:*)",
|
||||
"Bash(build_all.bat)",
|
||||
"Bash(powershell.exe:*)",
|
||||
"Bash(\"C:/Program Files/CMake/bin/cmake.exe\" -S . -B build_x86 -A Win32)",
|
||||
"Bash(\"C:/Program Files/CMake/bin/cmake.exe\" --build build_x86 --config Debug --target EzUI)",
|
||||
"Bash(\"C:/Program Files/CMake/bin/cmake.exe\" --build build_x86 --config Release --target EzUI)",
|
||||
"Bash(\"C:/Program Files/CMake/bin/cmake.exe\" -S . -B build_x64 -A x64)",
|
||||
"Bash(\"C:/Program Files/CMake/bin/cmake.exe\":*)",
|
||||
"Bash(\"C:/Program Files/CMake/bin/cmake.exe\" --build build_x64 --config Release --target EzUI)",
|
||||
"Bash(file:*)",
|
||||
"Bash(./test_build.bat)",
|
||||
"Bash(./verify_scripts.bat:*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,7 +1,10 @@
|
||||
/build
|
||||
/build_x64
|
||||
/build_x86
|
||||
/demo
|
||||
/_temp
|
||||
/_bin
|
||||
/lib
|
||||
/temp
|
||||
/bin
|
||||
/.vs
|
||||
|
||||
111
BUILD.md
Normal file
111
BUILD.md
Normal file
@@ -0,0 +1,111 @@
|
||||
# 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`
|
||||
168
CLAUDE.md
168
CLAUDE.md
@@ -6,30 +6,66 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
|
||||
EzUI 是一个基于原生 Win32 消息机制和 Direct2D 的 C++ 桌面 UI 框架,提供类似 Web 前端的 CSS 样式系统和弹性布局。
|
||||
|
||||
## 构建命令
|
||||
**核心特性:**
|
||||
- 基于 Win32 消息机制,轻量无依赖
|
||||
- Direct2D 硬件加速渲染,支持高 DPI
|
||||
- CSS 风格样式系统,支持伪类和选择器
|
||||
- 弹性布局系统,支持自动尺寸和停靠
|
||||
- 事件冒泡机制,灵活的事件处理
|
||||
- 控件组合与继承,一切皆控件
|
||||
|
||||
```bash
|
||||
build_x86.bat # 构建 32 位静态库
|
||||
build_x64.bat # 构建 64 位静态库
|
||||
## 快速开始
|
||||
|
||||
```cpp
|
||||
#include "EzUI/UIManager.h"
|
||||
#include "EzUI/Window.h"
|
||||
#include "EzUI/Application.h"
|
||||
|
||||
using namespace ezui;
|
||||
|
||||
class TestForm : public Window {
|
||||
private:
|
||||
UIManager umg;
|
||||
public:
|
||||
TestForm() : Window(800, 600) {
|
||||
umg.LoadXmlData("<vbox><label text=\"hello world\"></label></vbox>");
|
||||
umg.SetupUI(this);
|
||||
}
|
||||
};
|
||||
|
||||
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int nCmdShow) {
|
||||
Application app;
|
||||
TestForm form;
|
||||
form.SetText(L"窗口标题");
|
||||
form.Show(nCmdShow);
|
||||
return app.Exec();
|
||||
}
|
||||
```
|
||||
|
||||
CMake 构建:
|
||||
## 构建命令
|
||||
|
||||
**批处理脚本 (快速构建):**
|
||||
```bash
|
||||
cmake -B build # 默认静态库
|
||||
cmake --build build
|
||||
build_x86.bat # 生成 32 位并构建 Debug/Release
|
||||
build_x64.bat # 生成 64 位并构建 Debug/Release
|
||||
build_all.bat # 同时构建 32 位和 64 位
|
||||
```
|
||||
|
||||
# 动态库
|
||||
cmake -B build -DBUILD_SHARED_LIBS=ON
|
||||
**CMake 完整构建流程:**
|
||||
```bash
|
||||
# 配置阶段
|
||||
cmake -S . -B build -A Win32 # 32 位配置
|
||||
cmake -S . -B build -A x64 # 64 位配置
|
||||
cmake -S . -B build -DBUILD_SHARED_LIBS=ON # 构建动态库
|
||||
cmake -S . -B build -DBUILD_DEMO=OFF # 不构建 demo 项目
|
||||
|
||||
# 仅构建库(不构建 demo)
|
||||
cmake -B build -DBUILD_DEMO=OFF
|
||||
|
||||
# 编译为静态库
|
||||
cmake --build build/vs2022_x86 --target EzUI --config Debug
|
||||
cmake --build build/vs2022_x86 --target EzUI --config Release
|
||||
cmake --build build/vs2022_x64 --target EzUI --config Debug
|
||||
cmake --build build/vs2022_x64 --target EzUI --config Release
|
||||
# 编译阶段
|
||||
cmake --build build --config Debug # Debug 版本
|
||||
cmake --build build --config Release # Release 版本
|
||||
|
||||
# 单独构建 EzUI 库
|
||||
cmake --build build --target EzUI --config Debug
|
||||
cmake --build build --target EzUI --config Release
|
||||
```
|
||||
|
||||
## 核心架构
|
||||
@@ -42,13 +78,39 @@ cmake --build build/vs2022_x64 --target EzUI --config Release
|
||||
|
||||
### 控件系统
|
||||
所有控件继承自 `Control` 基类,核心控件包括:
|
||||
- 基础控件:`Label`, `Button`, `TextBox`, `PictureBox`
|
||||
- 选择控件:`CheckBox`, `RadioButton`, `ComboBox`
|
||||
- 数据控件:`TableView`, `TreeView`, `ListView` 系列
|
||||
- 布局容器:`HLayout`, `VLayout`, `HListView`, `VListView`, `TileListView`, `TabLayout`, `PagedListView`
|
||||
- 功能控件:`ScrollBar`, `Menu`, `NotifyIcon`, `ProgressBar`, `Spacer`, `IFrame`, `ShadowBox`
|
||||
- 表格控件:`TableView`
|
||||
- 动画:`Animation` - 类似 Qt 的过渡动画系统
|
||||
|
||||
**基础控件:**
|
||||
- `Label` - 文本标签
|
||||
- `Button` - 标准按钮
|
||||
- `TextBox` - 文本输入框(支持多行)
|
||||
- `PictureBox` - 图片显示(支持 GIF 动画)
|
||||
|
||||
**选择控件:**
|
||||
- `CheckBox` - 复选框
|
||||
- `RadioButton` - 单选按钮
|
||||
- `ComboBox` - 下拉选择框
|
||||
|
||||
**数据控件:**
|
||||
- `TableView` - 表格视图
|
||||
- `TreeView` - 树形视图
|
||||
- `ListView` 系列:`HListView`(横向列表)、`VListView`(纵向列表)、`TileListView`(瓦片式)、`PagedListView`(分页列表)
|
||||
|
||||
**布局容器:**
|
||||
- `HLayout` / `HBox` - 水平布局容器
|
||||
- `VLayout` / `VBox` - 垂直布局容器
|
||||
- `TabLayout` - 选项卡切换容器
|
||||
- `Spacer` - 弹性/固定间距占位符
|
||||
|
||||
**功能控件:**
|
||||
- `ScrollBar` / `HScrollBar` / `VScrollBar` - 滚动条
|
||||
- `Menu` - 菜单系统
|
||||
- `NotifyIcon` - 系统托盘图标
|
||||
- `ProgressBar` - 进度条
|
||||
- `IFrame` - 内嵌框架(类似 HTML iframe)
|
||||
- `ShadowBox` - 阴影容器
|
||||
|
||||
**动画系统:**
|
||||
- `Animation` - 类似 Qt 的属性过渡动画
|
||||
|
||||
### 布局系统
|
||||
- **尺寸优先级**:比例尺寸 (`SetRateWidth/Height`) > 绝对尺寸 (`SetFixedSize`) > 控件内容大小
|
||||
@@ -58,16 +120,22 @@ cmake --build build/vs2022_x64 --target EzUI --config Release
|
||||
|
||||
### 样式与渲染
|
||||
- `UIManager` - UI 样式与资源管理,支持 XML 布局加载
|
||||
- `UISelector` - CSS 选择器匹配系统
|
||||
- `Direct2DRender` - Direct2D 绘图实现
|
||||
- `RenderTypes` - 颜色、对齐方式等绘图类型
|
||||
- `UISelector` - CSS 选择器匹配系统(支持类选择器、ID 选择器、组合选择器)
|
||||
- `Direct2DRender` - Direct2D 绘图实现,支持硬件加速
|
||||
- `RenderTypes` - 颜色、对齐方式等绘图类型定义
|
||||
- `UIDef` - 框架内使用的宏定义集合
|
||||
- `EzUI.h` - 框架主接口头文件,定义事件类、枚举、全局资源等核心结构
|
||||
|
||||
**CSS 样式特性:**
|
||||
- 伪类支持:`:hover`、`:active`、`:checked`、`:disabled`
|
||||
- 样式属性:width、height、background-color、border、color、font 等
|
||||
- 选择器类型:标签选择器、类选择器、ID 选择器、组合选择器
|
||||
|
||||
### 事件系统
|
||||
- 支持事件冒泡机制,可实现事件捕获与穿透
|
||||
- `NotifyFlags` 控制控件哪些事件需要通知窗口
|
||||
- `Event` 枚举定义所有事件类型,支持位运算组合
|
||||
- `Event` 枚举定义所有事件类型(鼠标、键盘、绘制等),支持位运算组合
|
||||
- 事件穿透控制:通过 `m_hitTestEnabled` 控制命中测试
|
||||
- Debug 模式下按 F11 可查看布局信息和控件边界
|
||||
|
||||
### 线程模型
|
||||
@@ -79,24 +147,50 @@ cmake --build build/vs2022_x64 --target EzUI --config Release
|
||||
- 控件树内存由父控件自动管理:`Attach`/`Detach`
|
||||
- 图片资源通过 `PtrManager` 自动释放
|
||||
- XML 布局加载后由 `UIManager` 管理生命周期
|
||||
- `add_resource_package` 函数支持资源打包为 `.res` 文件
|
||||
- 资源打包系统:通过 `add_resource_package` CMake 函数将资源打包为 `.res` 文件
|
||||
|
||||
**资源打包流程:**
|
||||
1. 在 demo 的 CMakeLists.txt 中调用 `add_resource_package(target source_dir output_file)`
|
||||
2. 构建时会自动运行 `ResPackage.exe` 工具
|
||||
3. 生成的 `.res` 文件可以在运行时通过 `Resource.h` 中的函数加载
|
||||
4. 支持本地文件和资源文件的自动加载(通过 `add_resource_package` 函数)
|
||||
|
||||
### 调试技巧
|
||||
- 在 Debug 模式下运行时,按下 `F11` 可实时查看布局信息,高亮显示控件边界
|
||||
|
||||
## Demo 项目
|
||||
|
||||
- `helloWorld` - 基础示例
|
||||
- `QQ` - 仿 QQ 登录界面(含资源打包)
|
||||
- `kugou` - 酷狗音乐播放器(含 VLC 依赖和资源打包)
|
||||
- `ResPackage` - 资源打包工具
|
||||
- `Adminstor` / `DemoUi` - 管理界面示例
|
||||
- `helloWorld` - 基础示例,演示最简单的窗口创建
|
||||
- `ResPackage` - 资源打包工具,用于将资源文件打包为 `.res` 格式
|
||||
- `QQ` - 仿 QQ 登录界面,展示资源打包和 XML 布局加载
|
||||
- `kugou` - 酷狗音乐播放器,演示 VLC 集成和复杂 UI 交互(需要额外依赖)
|
||||
- `TableViewDemo` - 表格控件演示,展示 LayeredWindow + VLayout + TableView + 右键菜单的组合使用
|
||||
|
||||
**CMake Demo 目标:**
|
||||
- 所有 demo 都使用 `add_executable(... WIN32 ...)` 创建
|
||||
- 通过 `add_resource_package(target source_dir output_file)` 自动打包资源
|
||||
- 资源文件通过 `source_group` 组织到 VS 的 "res" 筛选项下
|
||||
|
||||
## 开发约定
|
||||
|
||||
- 头文件位于 `include/EzUI/` 目录
|
||||
- 源文件位于 `sources/` 目录
|
||||
**目录结构:**
|
||||
- 头文件:`include/EzUI/` 目录
|
||||
- 源文件:`sources/` 目录
|
||||
- Demo 项目:`demo/` 目录
|
||||
|
||||
**核心理念:**
|
||||
- 一切皆控件,纯代码组合 UI
|
||||
- 使用 CSS 驱动视觉,结构与样式分离
|
||||
- XML 解析使用 `tinyxml` 库
|
||||
- XML 布局通过 `UIManager::LoadXmlFile()` 或 `LoadXmlData()` 加载
|
||||
|
||||
**CMake 自定义命令:**
|
||||
- `add_resource_package(target source_dir output_file)` - 打包资源文件为 `.res` 格式
|
||||
- `target` 需要与 `add_executable` 的项目名匹配
|
||||
- 资源会在构建时自动打包,程序通过 `Resource.h` 提供的函数访问
|
||||
- 需要先构建 `ResPackage` 工具(位于 `demo/ResPackage`)
|
||||
|
||||
**窗口绘制机制:**
|
||||
- `Window` / `BorderlessWindow`:Windows 自动发送 `WM_PAINT` 消息
|
||||
- `LayeredWindow`:需手动发送 `WM_PAINT` 消息进行绘制(支持实时重绘)
|
||||
- `PopupWindow`:失焦自动关闭,适用于菜单等临时窗口
|
||||
|
||||
|
||||
@@ -15,17 +15,29 @@ add_definitions(-D_UNICODE -DUNICODE)
|
||||
project(EzUI)
|
||||
|
||||
file(GLOB src ./include/EzUI/*.* ./sources/*.* )
|
||||
# 添加一个选项,供用户选择构建静态库或动态库
|
||||
option(BUILD_SHARED_LIBS "Build shared library instead of static library" OFF)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(EzUI SHARED ${src})
|
||||
else()
|
||||
add_library(EzUI STATIC ${src})
|
||||
target_compile_definitions(EzUI PUBLIC EZUI_STATIC)
|
||||
endif()
|
||||
|
||||
# 始终编译为静态库
|
||||
add_library(EzUI STATIC ${src})
|
||||
target_compile_definitions(EzUI PUBLIC EZUI_STATIC)
|
||||
target_include_directories(EzUI PRIVATE ./include/EzUI)
|
||||
set_target_properties(EzUI PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
# 设置库文件输出目录和命名规则
|
||||
# 平台标识:根据架构判断 Win32 或 x64
|
||||
set(PLATFORM_TAG $<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,x64,Win32>)
|
||||
|
||||
# 设置输出目录为 lib
|
||||
set_target_properties(EzUI PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/lib"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/lib"
|
||||
)
|
||||
|
||||
# 设置库文件命名规则为 EzUI_$(Configuration)_$(Platform).lib
|
||||
set_target_properties(EzUI PROPERTIES
|
||||
OUTPUT_NAME "EzUI_$<CONFIG>_${PLATFORM_TAG}"
|
||||
)
|
||||
|
||||
# 定义函数: 添加资源打包任务并关联到指定项目
|
||||
function(add_resource_package TARGET_NAME INPUT_DIR OUTPUT_FILE)
|
||||
set (ProjectName ${TARGET_NAME}_EzUI_ResourcePackager)
|
||||
|
||||
71
build_all.bat
Normal file
71
build_all.bat
Normal file
@@ -0,0 +1,71 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "CMAKE_EXE="
|
||||
where cmake >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
set "CMAKE_EXE=cmake"
|
||||
echo Found CMake in PATH
|
||||
) else if exist "C:\Program Files\CMake\bin\cmake.exe" (
|
||||
set "CMAKE_EXE=C:\Program Files\CMake\bin\cmake.exe"
|
||||
echo Found CMake at C:\Program Files\CMake\bin\cmake.exe
|
||||
) else (
|
||||
echo Error: CMake not found!
|
||||
echo Please install CMake or add it to PATH.
|
||||
echo Download: https://cmake.org/download/
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ======================================
|
||||
echo EzUI Build Script
|
||||
echo Building: x86/x64 Debug/Release
|
||||
echo ======================================
|
||||
echo.
|
||||
|
||||
echo [1/6] Configuring x86...
|
||||
"%CMAKE_EXE%" -S . -B build_x86 -A Win32
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [2/6] Building x86 Debug...
|
||||
"%CMAKE_EXE%" --build build_x86 --config Debug --target EzUI
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [3/6] Building x86 Release...
|
||||
"%CMAKE_EXE%" --build build_x86 --config Release --target EzUI
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [4/6] Configuring x64...
|
||||
"%CMAKE_EXE%" -S . -B build_x64 -A x64
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [5/6] Building x64 Debug...
|
||||
"%CMAKE_EXE%" --build build_x64 --config Debug --target EzUI
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [6/6] Building x64 Release...
|
||||
"%CMAKE_EXE%" --build build_x64 --config Release --target EzUI
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo.
|
||||
echo ======================================
|
||||
echo Build completed successfully!
|
||||
echo ======================================
|
||||
echo.
|
||||
echo Output files:
|
||||
echo lib\EzUI_Debug_Win32.lib
|
||||
echo lib\EzUI_Release_Win32.lib
|
||||
echo lib\EzUI_Debug_x64.lib
|
||||
echo lib\EzUI_Release_x64.lib
|
||||
echo.
|
||||
pause
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo.
|
||||
echo ======================================
|
||||
echo Build failed!
|
||||
echo ======================================
|
||||
pause
|
||||
exit /b 1
|
||||
@@ -1,4 +1,50 @@
|
||||
chcp 65001
|
||||
@echo off
|
||||
cmake -S . -B build_x64 -A x64 -DBUILD_EZUI=OFF
|
||||
setlocal
|
||||
|
||||
set "CMAKE_EXE="
|
||||
where cmake >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
set "CMAKE_EXE=cmake"
|
||||
) else if exist "C:\Program Files\CMake\bin\cmake.exe" (
|
||||
set "CMAKE_EXE=C:\Program Files\CMake\bin\cmake.exe"
|
||||
) else (
|
||||
echo Error: CMake not found!
|
||||
echo Please install CMake or add it to PATH.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo ======================================
|
||||
echo Building EzUI x64
|
||||
echo ======================================
|
||||
echo.
|
||||
|
||||
echo [1/3] Configuring x64...
|
||||
"%CMAKE_EXE%" -S . -B build_x64 -A x64
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [2/3] Building x64 Debug...
|
||||
"%CMAKE_EXE%" --build build_x64 --config Debug --target EzUI
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [3/3] Building x64 Release...
|
||||
"%CMAKE_EXE%" --build build_x64 --config Release --target EzUI
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo.
|
||||
echo ======================================
|
||||
echo x64 build completed!
|
||||
echo Output:
|
||||
echo lib\EzUI_Debug_x64.lib
|
||||
echo lib\EzUI_Release_x64.lib
|
||||
echo ======================================
|
||||
pause
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo.
|
||||
echo ======================================
|
||||
echo Build failed!
|
||||
echo ======================================
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
@@ -1,4 +1,50 @@
|
||||
chcp 65001
|
||||
@echo off
|
||||
cmake -S . -B build_x86 -A Win32 -DBUILD_EZUI=OFF
|
||||
setlocal
|
||||
|
||||
set "CMAKE_EXE="
|
||||
where cmake >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
set "CMAKE_EXE=cmake"
|
||||
) else if exist "C:\Program Files\CMake\bin\cmake.exe" (
|
||||
set "CMAKE_EXE=C:\Program Files\CMake\bin\cmake.exe"
|
||||
) else (
|
||||
echo Error: CMake not found!
|
||||
echo Please install CMake or add it to PATH.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo ======================================
|
||||
echo Building EzUI x86
|
||||
echo ======================================
|
||||
echo.
|
||||
|
||||
echo [1/3] Configuring x86...
|
||||
"%CMAKE_EXE%" -S . -B build_x86 -A Win32
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [2/3] Building x86 Debug...
|
||||
"%CMAKE_EXE%" --build build_x86 --config Debug --target EzUI
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [3/3] Building x86 Release...
|
||||
"%CMAKE_EXE%" --build build_x86 --config Release --target EzUI
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo.
|
||||
echo ======================================
|
||||
echo x86 build completed!
|
||||
echo Output:
|
||||
echo lib\EzUI_Debug_Win32.lib
|
||||
echo lib\EzUI_Release_Win32.lib
|
||||
echo ======================================
|
||||
pause
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo.
|
||||
echo ======================================
|
||||
echo Build failed!
|
||||
echo ======================================
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
26
clean.bat
Normal file
26
clean.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
@echo off
|
||||
echo ======================================
|
||||
echo Cleaning build output...
|
||||
echo ======================================
|
||||
echo.
|
||||
|
||||
if exist build_x86 (
|
||||
echo Removing build_x86...
|
||||
rmdir /s /q build_x86
|
||||
)
|
||||
|
||||
if exist build_x64 (
|
||||
echo Removing build_x64...
|
||||
rmdir /s /q build_x64
|
||||
)
|
||||
|
||||
if exist lib (
|
||||
echo Removing lib...
|
||||
rmdir /s /q lib
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ======================================
|
||||
echo Clean completed!
|
||||
echo ======================================
|
||||
pause
|
||||
48
configure_vs.bat
Normal file
48
configure_vs.bat
Normal file
@@ -0,0 +1,48 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "CMAKE_EXE="
|
||||
where cmake >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
set "CMAKE_EXE=cmake"
|
||||
) else if exist "C:\Program Files\CMake\bin\cmake.exe" (
|
||||
set "CMAKE_EXE=C:\Program Files\CMake\bin\cmake.exe"
|
||||
) else (
|
||||
echo Error: CMake not found!
|
||||
echo Please install CMake or add it to PATH.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo ======================================
|
||||
echo Configuring for Visual Studio
|
||||
echo ======================================
|
||||
echo.
|
||||
|
||||
echo [1/2] Configuring x86...
|
||||
"%CMAKE_EXE%" -S . -B build_x86 -A Win32
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo [2/2] Configuring x64...
|
||||
"%CMAKE_EXE%" -S . -B build_x64 -A x64
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo.
|
||||
echo ======================================
|
||||
echo Configuration completed!
|
||||
echo ======================================
|
||||
echo.
|
||||
echo You can now open:
|
||||
echo - build_x86\EzUI.sln (x86)
|
||||
echo - build_x64\EzUI.sln (x64)
|
||||
echo.
|
||||
pause
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo.
|
||||
echo ======================================
|
||||
echo Configuration failed!
|
||||
echo ======================================
|
||||
pause
|
||||
exit /b 1
|
||||
@@ -93,3 +93,11 @@ set_property(TARGET QQ PROPERTY FOLDER "demo")
|
||||
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/kugou/extract${ARCH_NAME}.bat" "$<TARGET_FILE_DIR:kugou>"
|
||||
COMMENT "Running extract.bat to conditionally extract dll.zip"
|
||||
)
|
||||
|
||||
# TableView Demo - LayeredWindow + VLayout + TableView + 右键菜单
|
||||
project(TableViewDemo)
|
||||
file(GLOB src TableViewDemo/*.*)
|
||||
add_executable(TableViewDemo WIN32 ${src})
|
||||
target_include_directories(TableViewDemo PRIVATE ${include})
|
||||
target_link_libraries(TableViewDemo PRIVATE EzUI)
|
||||
set_property(TARGET TableViewDemo PROPERTY FOLDER "demo")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user