mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-09 18:02:52 +08:00
e84b33c5ca
- 新增 CMakeLists.txt 文件,定义项目构建规则、依赖和编译选项。 - 更新 README.md 文档,推荐使用 CMake 进行构建,并说明新旧构建方式。 - 保留原有的 Makefile 支持以保持向后兼容。
55 lines
1.2 KiB
CMake
55 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(PathEditor C)
|
|
|
|
# Compile flags and definitions
|
|
add_compile_options(-Wall -O2 -fexec-charset=UTF-8)
|
|
add_compile_definitions(_WIN32 UNICODE _UNICODE)
|
|
|
|
# Include directories
|
|
include_directories(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib/include
|
|
)
|
|
|
|
# Source files
|
|
set(SOURCES
|
|
src/main.c
|
|
src/utils.c
|
|
src/registry.c
|
|
src/callbacks.c
|
|
src/ui.c
|
|
src/globals.c
|
|
)
|
|
|
|
# Resource file
|
|
set(RESOURCES
|
|
ico/resources.rc
|
|
)
|
|
|
|
# Library directories
|
|
link_directories(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib
|
|
)
|
|
|
|
# Create WIN32 executable (automatically adds -mwindows and handles .rc files)
|
|
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${RESOURCES})
|
|
|
|
# Link libraries
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
|
iup
|
|
iupcd
|
|
gdi32
|
|
comdlg32
|
|
comctl32
|
|
uuid
|
|
ole32
|
|
advapi32
|
|
)
|
|
|
|
# Copy DLLs to the build directory after building
|
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/libs/iup-3.31_Win64_dllw6_lib/"
|
|
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
|
COMMENT "Copying DLLs to build directory..."
|
|
) |