mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-30 18:45:55 +08:00
fix: 修复PR#5 review意见
- CMakeLists.txt: 启用RC语言, 移除冗余_WIN32, 添加DLL复制 - CLAUDE.md: 更新构建命令为CMake - README.md: 移除硬编码MinGW路径和Makefile引用 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -9,17 +9,17 @@ Path Editor 是一个 Windows 系统环境变量 PATH 编辑器,使用 C 语
|
||||
## 构建与运行
|
||||
|
||||
```bash
|
||||
# 编译(需要 MinGW-w64 在 PATH 中)
|
||||
mingw32-make
|
||||
# 配置(需要 MinGW-w64 和 CMake 3.15+ 在 PATH 中)
|
||||
cmake -B build -G "MinGW Makefiles"
|
||||
|
||||
# 清理构建产物
|
||||
mingw32-make clean
|
||||
# 编译
|
||||
cmake --build build
|
||||
|
||||
# 运行(必须以管理员身份)
|
||||
bin/PathEditor.exe
|
||||
```
|
||||
|
||||
编译器为 MinGW-w64 GCC,使用 `windres` 编译资源文件(图标)。IUP 3.31 库已包含在 `libs/` 目录下,无需额外安装。
|
||||
编译器为 MinGW-w64 GCC。CMake 自动处理 `windres` 资源文件编译和 IUP DLL 复制。IUP 3.31 库已包含在 `libs/` 目录下,无需额外安装。
|
||||
|
||||
## 打包
|
||||
|
||||
|
||||
+23
-2
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(PathEditor LANGUAGES C)
|
||||
project(PathEditor LANGUAGES C RC)
|
||||
|
||||
set(IUP_DIR "${CMAKE_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib")
|
||||
|
||||
@@ -22,7 +22,7 @@ target_link_libraries(PathEditor
|
||||
iup iupcd gdi32 comdlg32 comctl32 uuid ole32 advapi32
|
||||
)
|
||||
|
||||
target_compile_definitions(PathEditor PRIVATE _WIN32 UNICODE _UNICODE)
|
||||
target_compile_definitions(PathEditor PRIVATE UNICODE _UNICODE)
|
||||
|
||||
target_compile_options(PathEditor PRIVATE -Wall -O2 -fexec-charset=UTF-8)
|
||||
|
||||
@@ -31,3 +31,24 @@ target_link_options(PathEditor PRIVATE -mwindows)
|
||||
set_target_properties(PathEditor PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin"
|
||||
)
|
||||
|
||||
add_custom_command(TARGET PathEditor POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${IUP_DIR}/iup.dll"
|
||||
"${IUP_DIR}/iupcd.dll"
|
||||
"${IUP_DIR}/freetype6.dll"
|
||||
"${IUP_DIR}/ftgl.dll"
|
||||
"${IUP_DIR}/zlib1.dll"
|
||||
"${IUP_DIR}/iupcontrols.dll"
|
||||
"${IUP_DIR}/iupim.dll"
|
||||
"${IUP_DIR}/iupimglib.dll"
|
||||
"${IUP_DIR}/iup_mglplot.dll"
|
||||
"${IUP_DIR}/iup_plot.dll"
|
||||
"${IUP_DIR}/iup_scintilla.dll"
|
||||
"${IUP_DIR}/iupgl.dll"
|
||||
"${IUP_DIR}/iupglcontrols.dll"
|
||||
"${IUP_DIR}/iupole.dll"
|
||||
"${IUP_DIR}/iuptuio.dll"
|
||||
"${CMAKE_SOURCE_DIR}/bin/"
|
||||
COMMENT "Copying IUP runtime DLLs to bin/"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,6 @@ PathEditor/
|
||||
│ └── installer.iss # Inno Setup 安装包脚本
|
||||
├── ManagePath.bat # 备用的命令行 PATH 管理脚本
|
||||
├── CMakeLists.txt # CMake 构建配置
|
||||
├── Makefile # GNU Make 构建配置(备用)
|
||||
└── CLAUDE.md # Claude Code 项目指南
|
||||
```
|
||||
|
||||
@@ -62,7 +61,7 @@ PATH 值使用 `REG_EXPAND_SZ` 类型,支持 `%SystemRoot%` 等环境变量展
|
||||
| 工具 | 说明 |
|
||||
|------|------|
|
||||
| Windows 操作系统 | 需 Windows API 支持 |
|
||||
| MinGW-w64 (GCC) | 编译器,路径 `D:\settings\Language\C\mingw64` |
|
||||
| MinGW-w64 (GCC) | 编译器,确保 `gcc` 在 PATH 中 |
|
||||
| CMake 3.15+ | 构建工具 |
|
||||
| IUP 3.31 | GUI 库(已包含在 `libs/` 中) |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user