mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-09 18:02:52 +08:00
chore: 迁移构建系统并清理遗留的二进制文件
- 删除 bin/ 目录下遗留的 DLL 和可执行文件,它们现在由 CMake 构建过程自动复制 - 更新 CMakeLists.txt,明确设置 C17 标准并优化编译选项 - 更新 Inno Setup 安装脚本,使其从 build/ 目录获取构建产物 - 更新 main.c 中的编译说明,反映当前基于 CMake 的构建流程
This commit is contained in:
+14
-9
@@ -1,17 +1,22 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(PathEditor C)
|
project(PathEditor C)
|
||||||
|
|
||||||
# Compile flags and definitions
|
# 设置 C 标准
|
||||||
|
set(CMAKE_C_STANDARD 17)
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_C_EXTENSIONS OFF) # 禁用特定编译器的扩展(如 gnu17),强制使用标准 C17
|
||||||
|
|
||||||
|
# 编译选项和宏定义
|
||||||
add_compile_options(-Wall -O2 -fexec-charset=UTF-8)
|
add_compile_options(-Wall -O2 -fexec-charset=UTF-8)
|
||||||
add_compile_definitions(_WIN32 UNICODE _UNICODE)
|
add_compile_definitions(_WIN32 UNICODE _UNICODE)
|
||||||
|
|
||||||
# Include directories
|
# 头文件包含目录
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib/include
|
${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib/include
|
||||||
)
|
)
|
||||||
|
|
||||||
# Source files
|
# 源代码文件
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
src/main.c
|
src/main.c
|
||||||
src/utils.c
|
src/utils.c
|
||||||
@@ -21,20 +26,20 @@ set(SOURCES
|
|||||||
src/globals.c
|
src/globals.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# Resource file
|
# 资源文件
|
||||||
set(RESOURCES
|
set(RESOURCES
|
||||||
ico/resources.rc
|
ico/resources.rc
|
||||||
)
|
)
|
||||||
|
|
||||||
# Library directories
|
# 库文件目录
|
||||||
link_directories(
|
link_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib
|
${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create WIN32 executable (automatically adds -mwindows and handles .rc files)
|
# 创建 WIN32 可执行文件 (自动添加 -mwindows 并处理 .rc 资源文件)
|
||||||
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${RESOURCES})
|
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${RESOURCES})
|
||||||
|
|
||||||
# Link libraries
|
# 链接依赖库
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
iup
|
iup
|
||||||
iupcd
|
iupcd
|
||||||
@@ -46,10 +51,10 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
|
|||||||
advapi32
|
advapi32
|
||||||
)
|
)
|
||||||
|
|
||||||
# Copy DLLs to the build directory after building
|
# 编译完成后,将 DLL 文件复制到构建输出目录
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib/"
|
"${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib/"
|
||||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||||
COMMENT "Copying DLLs to build directory..."
|
COMMENT "Copying DLLs to build directory..."
|
||||||
)
|
)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Vendored
+2
-2
@@ -37,8 +37,8 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
|
|||||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "d:\Code\doing_exercises\programs\PathEditor\bin\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "d:\Code\doing_exercises\programs\PathEditor\build\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
Source: "d:\Code\doing_exercises\programs\PathEditor\bin\*.dll"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "d:\Code\doing_exercises\programs\PathEditor\build\*.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
|
|||||||
+4
-3
@@ -11,9 +11,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
编译命令:
|
!编译命令:
|
||||||
Remove-Item -Path "obj\*.o" -Force -ErrorAction SilentlyContinue && mingw32-make
|
cmake -B build -G "MinGW Makefiles"
|
||||||
打包命令:
|
cmake --build build
|
||||||
|
!打包命令:
|
||||||
build_installer.bat
|
build_installer.bat
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user