Skip to content

Commit e030c80

Browse files
authored
Merge pull request #307 from Mikachu2333/feat/win_rc_support
为win的exe文件增添附加的属性,便于区分版本
2 parents f926834 + cfe8503 commit e030c80

File tree

8 files changed

+93
-14
lines changed

8 files changed

+93
-14
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*.dll
2323
*.out
2424
*.exe
25-
25+
*.res
2626

2727

2828
##############################

doc/01-开发与构建.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
! -------------------------------------------------------------
44
! Doc Type : Markdown
55
! Doc Name : 01-开发与构建.md
6-
! Doc Authors : 曾奥然 <[email protected]>
7-
! Contributors : Nul None <[email protected]>
6+
! Doc Authors : 曾奥然 <[email protected]>
7+
! Contributors : Mikachu2333 <[email protected]>
88
! |
99
! Created On : <2024-12-27>
10-
! Last Modified : <2025-08-22>
10+
! Last Modified : <2025-10-11>
1111
! ---------------------------------------------------------- -->
1212

1313
# 开发 chsrc

doc/image/chsrc.svg

Lines changed: 9 additions & 0 deletions
Loading

justfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# SPDX-License-Identifier: GPL-3.0-or-later
44
# --------------------------------------------------------------
55
# Build File : justfile
6-
# File Authors : Aoran Zeng <[email protected]>
7-
# Contributors : Nul None <[email protected]>
6+
# File Authors : Aoran Zeng <[email protected]>
7+
# Contributors : Mikachu2333 <[email protected]>
88
# |
99
# Created On : <2025-06-18>
10-
# Last Modified : <2025-07-21>
10+
# Last Modified : <2025-10-11>
1111
#
1212
# 该文件主要用于在原生Windows上执行项目的基本任务,而不借助于
1313
# GNU make 以及相应的 MSYS2、Cygwin 环境
@@ -53,7 +53,7 @@ CFLAGS_chk_Clang := if os() == 'windows' {
5353
} else {''}
5454

5555

56-
CFLAGS_base := '-Iinclude -Ilib ' + CFLAGS_chk_Clang
56+
CFLAGS_base := '-Iinclude -Ilib -Isrc/framework ' + CFLAGS_chk_Clang
5757

5858
WARN := '-Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-missing-braces -Wno-misleading-indentation' + ' ' + \
5959
'-Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare'
@@ -104,9 +104,9 @@ alias c := clean
104104
default: build-in-dev-mode
105105

106106
build-in-dev-mode:
107-
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
108-
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
109-
@echo Finished: Build in DEV mode
107+
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
108+
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
109+
@echo Finished: Build in DEV mode
110110

111111
build-in-debug-mode:
112112
@echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}}
@@ -115,7 +115,10 @@ build-in-debug-mode:
115115

116116
build-in-release-mode:
117117
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
118-
@{{CC}} src/chsrc-main.c {{CFLAGS_release_mode}} -o {{ReleaseMode-Target-Name}}
118+
{{ if os() == 'windows' { '@if exist src\\res\\chsrc.res del src\\res\\chsrc.res' } else { '' } }}
119+
{{ if os() == 'windows' { '@windres src\\res\\win_res.rc -O coff -o src\\res\\chsrc.res -Iinclude -Ilib -Isrc\\framework -Isrc\\res' } else { '' } }}
120+
{{ 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 } }}
121+
{{ if os() == 'windows' { '@del src\\res\\chsrc.res' } else { '' } }}
119122
@echo Finished: Build in RELEASE mode
120123

121124
debug: build-in-debug-mode

src/chsrc-main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
* 然的加入,逐渐成长为互相支持的伙伴。
3131
* ------------------------------------------------------------*/
3232

33-
#define Chsrc_Version "0.2.3"
34-
#define Chsrc_Release_Date "2025/10/06"
33+
#include "version.h"
34+
3535
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
3636
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
3737

src/framework/version.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/** ------------------------------------------------------------
2+
* Copyright © 2023-2025 曾奥然, 郭恒
3+
* SPDX-License-Identifier: MIT
4+
* -------------------------------------------------------------
5+
* Lib Authors : 曾奥然 <[email protected]>
6+
* Contributors : Mikachu2333 <[email protected]>
7+
* |
8+
* Created On : <2025-10-10>
9+
* Last Modified : <2025-10-10>
10+
11+
* !!!警告!!!
12+
* 发布前请修改此处的内容
13+
* ------------------------------------------------------------*/
14+
15+
#define Chsrc_Version "0.2.3"
16+
#define Chsrc_Release_Date "2025/10/06"
17+
18+
// 以下宏仅用于 Windows
19+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
20+
#define CHSRC_VERSION_MAJOR 0
21+
#define CHSRC_VERSION_MINOR 2
22+
#define CHSRC_VERSION_PATCH 3
23+
#endif

src/res/logo.ico

60.3 KB
Binary file not shown.

src/res/win_res.rc

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// chsrc.rc - Windows Resource Script
2+
// SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
#include <windows.h>
5+
#include "version.h"
6+
7+
// 图标资源
8+
IDI_ICON1 ICON DISCARDABLE "logo.ico"
9+
10+
// 版本信息
11+
VS_VERSION_INFO VERSIONINFO
12+
FILEVERSION CHSRC_VERSION_MAJOR,CHSRC_VERSION_MINOR,CHSRC_VERSION_PATCH,0
13+
PRODUCTVERSION CHSRC_VERSION_MAJOR,CHSRC_VERSION_MINOR,CHSRC_VERSION_PATCH,0
14+
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
15+
#ifdef _DEBUG
16+
FILEFLAGS VS_FF_DEBUG
17+
#else
18+
FILEFLAGS 0x0L
19+
#endif
20+
FILEOS VOS_NT_WINDOWS32
21+
FILETYPE VFT_APP
22+
FILESUBTYPE VFT2_UNKNOWN
23+
BEGIN
24+
BLOCK "StringFileInfo"
25+
BEGIN
26+
BLOCK "040904b0"
27+
BEGIN
28+
VALUE "CompanyName", "Github RubyMetric"
29+
VALUE "FileDescription", "Change Source everywhere for every software"
30+
VALUE "FileVersion", Chsrc_Version
31+
VALUE "InternalName", "chsrc"
32+
VALUE "LegalCopyright", "Copyright (c) 2023-2025 RubyMetric"
33+
VALUE "OriginalFilename", "chsrc.exe"
34+
VALUE "ProductName", "chsrc"
35+
VALUE "ProductVersion", Chsrc_Release_Date
36+
VALUE "Comments", "MIT License"
37+
VALUE "LegalTrademarks", ""
38+
END
39+
END
40+
BLOCK "VarFileInfo"
41+
BEGIN
42+
VALUE "Translation", 0x0804, 1200, 0x0409, 1200 // 简体中文和英语
43+
END
44+
END

0 commit comments

Comments
 (0)