diff --git a/.gitignore b/.gitignore index 66c4a28..8586f5b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ *.dll *.out *.exe - +*.res ############################## diff --git a/doc/01-开发与构建.md b/doc/01-开发与构建.md index 27a1422..a2d3b1e 100644 --- a/doc/01-开发与构建.md +++ b/doc/01-开发与构建.md @@ -3,11 +3,11 @@ ! ------------------------------------------------------------- ! Doc Type : Markdown ! Doc Name : 01-开发与构建.md - ! Doc Authors : 曾奥然 - ! Contributors : Nul None + ! Doc Authors : 曾奥然 + ! Contributors : Mikachu2333 ! | ! Created On : <2024-12-27> - ! Last Modified : <2025-08-22> + ! Last Modified : <2025-10-11> ! ---------------------------------------------------------- --> # 开发 chsrc diff --git a/doc/image/chsrc.svg b/doc/image/chsrc.svg new file mode 100644 index 0000000..fc00ba6 --- /dev/null +++ b/doc/image/chsrc.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/justfile b/justfile index 2bacf86..3902916 100644 --- a/justfile +++ b/justfile @@ -3,11 +3,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -------------------------------------------------------------- # Build File : justfile -# File Authors : Aoran Zeng -# Contributors : Nul None +# File Authors : Aoran Zeng +# Contributors : Mikachu2333 # | # Created On : <2025-06-18> -# Last Modified : <2025-07-21> +# Last Modified : <2025-10-11> # # 该文件主要用于在原生Windows上执行项目的基本任务,而不借助于 # GNU make 以及相应的 MSYS2、Cygwin 环境 @@ -53,7 +53,7 @@ CFLAGS_chk_Clang := if os() == 'windows' { } else {''} -CFLAGS_base := '-Iinclude -Ilib ' + CFLAGS_chk_Clang +CFLAGS_base := '-Iinclude -Ilib -Isrc/framework ' + CFLAGS_chk_Clang WARN := '-Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-missing-braces -Wno-misleading-indentation' + ' ' + \ '-Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare' @@ -104,9 +104,9 @@ alias c := clean default: build-in-dev-mode build-in-dev-mode: - @echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}} - @{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}} - @echo Finished: Build in DEV mode + @echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}} + @{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}} + @echo Finished: Build in DEV mode build-in-debug-mode: @echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}} @@ -115,7 +115,10 @@ build-in-debug-mode: build-in-release-mode: @echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}} - @{{CC}} src/chsrc-main.c {{CFLAGS_release_mode}} -o {{ReleaseMode-Target-Name}} + {{ if os() == 'windows' { '@if exist src\\res\\chsrc.res del src\\res\\chsrc.res' } else { '' } }} + {{ if os() == 'windows' { '@windres src\\res\\win_res.rc -O coff -o src\\res\\chsrc.res -Iinclude -Ilib -Isrc\\framework -Isrc\\res' } else { '' } }} + {{ if os() == 'windows' { '@' + CC + ' src/chsrc-main.c src/res/chsrc.res ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name } else { '@' + CC + ' src/chsrc-main.c ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name } }} + {{ if os() == 'windows' { '@del src\\res\\chsrc.res' } else { '' } }} @echo Finished: Build in RELEASE mode debug: build-in-debug-mode diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 98318a7..0325b75 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -30,8 +30,8 @@ * 然的加入,逐渐成长为互相支持的伙伴。 * ------------------------------------------------------------*/ -#define Chsrc_Version "0.2.3" -#define Chsrc_Release_Date "2025/10/06" +#include "version.h" + #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" #define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc" diff --git a/src/framework/version.h b/src/framework/version.h new file mode 100644 index 0000000..4e5181c --- /dev/null +++ b/src/framework/version.h @@ -0,0 +1,23 @@ +/** ------------------------------------------------------------ + * Copyright © 2023-2025 曾奥然, 郭恒 + * SPDX-License-Identifier: MIT + * ------------------------------------------------------------- + * Lib Authors : 曾奥然 + * Contributors : Mikachu2333 + * | + * Created On : <2025-10-10> + * Last Modified : <2025-10-10> + + * !!!警告!!! + * 发布前请修改此处的内容 + * ------------------------------------------------------------*/ + +#define Chsrc_Version "0.2.3" +#define Chsrc_Release_Date "2025/10/06" + +// 以下宏仅用于 Windows +#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) + #define CHSRC_VERSION_MAJOR 0 + #define CHSRC_VERSION_MINOR 2 + #define CHSRC_VERSION_PATCH 3 +#endif diff --git a/src/res/logo.ico b/src/res/logo.ico new file mode 100644 index 0000000..44c0dc6 Binary files /dev/null and b/src/res/logo.ico differ diff --git a/src/res/win_res.rc b/src/res/win_res.rc new file mode 100644 index 0000000..b2f0414 --- /dev/null +++ b/src/res/win_res.rc @@ -0,0 +1,44 @@ +// chsrc.rc - Windows Resource Script +// SPDX-License-Identifier: GPL-3.0-or-later + +#include +#include "version.h" + +// 图标资源 +IDI_ICON1 ICON DISCARDABLE "logo.ico" + +// 版本信息 +VS_VERSION_INFO VERSIONINFO + FILEVERSION CHSRC_VERSION_MAJOR,CHSRC_VERSION_MINOR,CHSRC_VERSION_PATCH,0 + PRODUCTVERSION CHSRC_VERSION_MAJOR,CHSRC_VERSION_MINOR,CHSRC_VERSION_PATCH,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Github RubyMetric" + VALUE "FileDescription", "Change Source everywhere for every software" + VALUE "FileVersion", Chsrc_Version + VALUE "InternalName", "chsrc" + VALUE "LegalCopyright", "Copyright (c) 2023-2025 RubyMetric" + VALUE "OriginalFilename", "chsrc.exe" + VALUE "ProductName", "chsrc" + VALUE "ProductVersion", Chsrc_Release_Date + VALUE "Comments", "MIT License" + VALUE "LegalTrademarks", "" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0804, 1200, 0x0409, 1200 // 简体中文和英语 + END +END