Skip to content

Commit 5d89f4f

Browse files
committed
Check compiler version
1 parent 8e59c0e commit 5d89f4f

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

.github/workflows/build-on-Windows.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ jobs:
5151
5252
- name: 为 Android 构建
5353
run: |
54-
mingw32-make.exe build-in-ci-release-mode CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android21-clang
54+
compiler=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android21-clang
55+
56+
# 检查编译器版本
57+
$compiler --version
58+
59+
mingw32-make.exe build-in-ci-release-mode CC=$compiler CROSS_BUILD_WINDOWS_FOR_ANDROID=1
5560
mv chsrc-ci-release.exe chsrc-arm64-android
5661
5762
- name: List files

.github/workflows/build-on-macOS.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Contributors : Nul None <[email protected]>
55
# |
66
# Created On : <2023-09-15>
7-
# Last Modified : <2025-06-20>
7+
# Last Modified : <2025-07-22>
88
#
99
# Build chsrc on macOS and upload it to GitHub: the 'pre' release
1010
# ---------------------------------------------------------------
@@ -22,6 +22,11 @@ jobs:
2222
- name: 检出代码
2323
uses: actions/checkout@v4
2424

25+
- name: 检查编译器版本
26+
run: |
27+
clang --version
28+
gcc --version
29+
2530
- name: 为 arm64 (AArch64) 构建
2631
run: |
2732
make build-in-ci-release-mode
@@ -47,6 +52,11 @@ jobs:
4752
- name: 检出代码
4853
uses: actions/checkout@v4
4954

55+
- name: 检查编译器版本
56+
run: |
57+
clang --version
58+
gcc --version
59+
5060
- name: 为 x64 构建
5161
run: |
5262
make build-in-ci-release-mode

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ endif
3636

3737
#======== Default Tooling ============
3838
ifeq ($(On-Windows), 1)
39-
# MSYS2 环境
39+
# MSYS2 环境
4040
CC = cc
4141
else ifeq ($(On-macOS), 1)
4242
CC = clang
@@ -101,10 +101,14 @@ ifeq ($(MAKECMDGOALS), build-in-ci-release-mode)
101101
endif
102102

103103
ifeq ($(On-macOS), 1)
104-
# 太糟糕了,到现在 (2025-07-22) GitHub Actions 的 macOS (13、15) 中的 LLVM 版本还太低
105-
# 我们代码里有 raw string literal 扩展的用法,所以只能切到 GCC 去
106-
# 但是用户自己编译等情况下,依旧让他们用 Clang,因为他们环境的 LLVM 版本可能比较新
107-
CC = gcc
104+
ifeq ($(CC), clang)
105+
CFLAGS += -fraw-string-literals
106+
endif
107+
endif
108+
109+
# 在 Windows 上交叉编译 Android 时,用的是 clang
110+
ifdef CROSS_BUILD_WINDOWS_FOR_ANDROID
111+
CFLAGS += -fraw-string-literals
108112
endif
109113

110114
endif

0 commit comments

Comments
 (0)