Refactor Windows resource compiling

This commit is contained in:
Aoran Zeng
2025-10-15 18:09:50 +08:00
parent e030c8095e
commit ebc9e167f2

View File

@@ -3,11 +3,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# --------------------------------------------------------------
# Build File : justfile
# File Authors : Aoran Zeng <ccmywish@qq.com>
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
# |
# Created On : <2025-06-18>
# Last Modified : <2025-10-11>
# Last Modified : <2025-10-15>
#
# 该文件主要用于在原生Windows上执行项目的基本任务而不借助于
# GNU make 以及相应的 MSYS2、Cygwin 环境
@@ -53,7 +53,7 @@ CFLAGS_chk_Clang := if os() == 'windows' {
} else {''}
CFLAGS_base := '-Iinclude -Ilib -Isrc/framework ' + CFLAGS_chk_Clang
CFLAGS_base := '-Iinclude -Ilib ' + 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'
@@ -115,10 +115,15 @@ build-in-debug-mode:
build-in-release-mode:
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -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 { '' } }}
@{{ if os() == 'windows' { \
'if exist chsrc.res del chsrc.res' + \
' & windres src/resource/chsrc.rc -O coff -o chsrc.res' \
} else { '' } }}
@{{ if os() == 'windows' { \
CC + ' src/chsrc-main.c chsrc.res ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
} else { \
CC + ' src/chsrc-main.c ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
} }}
@echo Finished: Build in RELEASE mode
debug: build-in-debug-mode