From 72c752bfddcb540e11b12f9a3ea3a10b2257ce6b Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 20 Jun 2025 17:36:28 +0800 Subject: [PATCH] Configure default compiler for `just` --- doc/01-Develop.md | 2 +- justfile | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/01-Develop.md b/doc/01-Develop.md index 34c7c61..22ce9b6 100644 --- a/doc/01-Develop.md +++ b/doc/01-Develop.md @@ -86,7 +86,7 @@ make clean ### 编译运行 ```bash -just # 在Windows上默认使用 gcc 编译,在Linux上默认使用cc编译 +just # 在Windows上默认使用 gcc 编译,在macOS上默认使用 clang 编译,在其他系统上默认使用 cc 编译 just CC=clang # 使用 clang 编译 just CC=gcc # 使用 gcc 编译 ``` diff --git a/justfile b/justfile index da1ba10..070d17e 100644 --- a/justfile +++ b/justfile @@ -7,7 +7,7 @@ # Contributors : Nul None # | # Created On : <2025-06-18> -# Last Modified : <2025-06-19> +# Last Modified : <2025-06-20> # # just (build) # just debug @@ -23,7 +23,14 @@ set windows-shell := ['cmd', '/c'] -CC := 'gcc' +CC := if os() == 'windows' { + "gcc" +} else if os() == 'macos' { + "clang" +} else { + "cc" +} + DEBUGGER := 'gdb' CFLAGS_base := '-Iinclude -Ilib'