Skip to content

Commit ebc9e16

Browse files
committed
Refactor Windows resource compiling
1 parent e030c80 commit ebc9e16

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

justfile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# --------------------------------------------------------------
33
# SPDX-License-Identifier: GPL-3.0-or-later
44
# --------------------------------------------------------------
5-
# Build File : justfile
6-
# File Authors : Aoran Zeng <[email protected]>
7-
# Contributors : Mikachu2333 <[email protected]>
8-
# |
5+
# Build File : justfile
6+
# File Authors : 曾奥然 <[email protected]>
7+
# Contributors : Mikachu2333 <[email protected]>
8+
# |
99
# Created On : <2025-06-18>
10-
# Last Modified : <2025-10-11>
10+
# Last Modified : <2025-10-15>
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 -Isrc/framework ' + CFLAGS_chk_Clang
56+
CFLAGS_base := '-Iinclude -Ilib ' + 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'
@@ -114,12 +114,17 @@ build-in-debug-mode:
114114
@echo Finished: Build in DEBUG mode
115115

116116
build-in-release-mode:
117-
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -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 { '' } }}
122-
@echo Finished: Build in RELEASE mode
117+
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
118+
@{{ if os() == 'windows' { \
119+
'if exist chsrc.res del chsrc.res' + \
120+
' & windres src/resource/chsrc.rc -O coff -o chsrc.res' \
121+
} else { '' } }}
122+
@{{ if os() == 'windows' { \
123+
CC + ' src/chsrc-main.c chsrc.res ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
124+
} else { \
125+
CC + ' src/chsrc-main.c ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
126+
} }}
127+
@echo Finished: Build in RELEASE mode
123128

124129
debug: build-in-debug-mode
125130
@{{DEBUGGER}} {{DebugMode-Target-Name}}

0 commit comments

Comments
 (0)