Merge pull request #307 from Mikachu2333/feat/win_rc_support

为win的exe文件增添附加的属性,便于区分版本
This commit is contained in:
曾奥然
2025-10-15 17:10:18 +08:00
committed by GitHub
8 changed files with 93 additions and 14 deletions

2
.gitignore vendored
View File

@@ -22,7 +22,7 @@
*.dll
*.out
*.exe
*.res
##############################

View File

@@ -3,11 +3,11 @@
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 01-开发与构建.md
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
! |
! Created On : <2024-12-27>
! Last Modified : <2025-08-22>
! Last Modified : <2025-10-11>
! ---------------------------------------------------------- -->
# 开发 chsrc

9
doc/image/chsrc.svg Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 500 500" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g>
<path d="M13.392,207.176L130.909,79.868L369.203,79.868L486.608,207.055L486.608,210.821L255.801,459.814L244.311,459.814L13.392,210.7L13.392,207.176ZM250.056,118.434C186.007,118.434 134.008,170.433 134.008,234.482C134.008,298.53 186.007,350.53 250.056,350.53C314.104,350.53 366.104,298.53 366.104,234.482C366.104,170.433 314.104,118.434 250.056,118.434Z" style="fill:#a52019;"/>
<path d="M189.09,222.379C183.346,222.379 178.683,217.716 178.683,211.972C178.683,209.1 179.849,206.498 181.733,204.614L204.205,182.142C204.253,182.092 204.302,182.042 204.351,181.993C208.413,177.931 215.007,177.931 219.069,181.993C223.131,186.055 223.131,192.649 219.069,196.711C219.02,196.76 218.97,196.808 218.921,196.856L214.212,201.565L312.183,201.565C317.927,201.565 322.59,206.228 322.59,211.972C322.59,217.716 317.927,222.379 312.183,222.379L189.09,222.379Z" style="fill:#a52019;"/>
<path d="M311.547,245.378C317.29,245.378 321.954,250.042 321.954,255.785C321.954,258.657 320.788,261.259 318.904,263.143L296.431,285.616C296.383,285.665 296.335,285.715 296.286,285.764C292.224,289.826 285.629,289.826 281.568,285.764C277.506,281.703 277.506,275.108 281.568,271.046C281.617,270.997 281.666,270.949 281.716,270.901L286.424,266.193L188.453,266.193C182.71,266.193 178.046,261.529 178.046,255.785C178.046,250.042 182.71,245.378 188.453,245.378L311.547,245.378Z" style="fill:#a52019;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -3,11 +3,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# --------------------------------------------------------------
# Build File : justfile
# File Authors : Aoran Zeng <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# File Authors : Aoran Zeng <ccmywish@qq.com>
# Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
# |
# 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

View File

@@ -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"

23
src/framework/version.h Normal file
View File

@@ -0,0 +1,23 @@
/** ------------------------------------------------------------
* Copyright © 2023-2025 曾奥然, 郭恒
* SPDX-License-Identifier: MIT
* -------------------------------------------------------------
* Lib Authors : 曾奥然 <ccmywish@qq.com>
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
* |
* 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

BIN
src/res/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

44
src/res/win_res.rc Normal file
View File

@@ -0,0 +1,44 @@
// chsrc.rc - Windows Resource Script
// SPDX-License-Identifier: GPL-3.0-or-later
#include <windows.h>
#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