From 97ca7bbbdb7dff92b61c9f82f2c48f9fe2468f37 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Tue, 27 Oct 2026 12:43:19 +0800 Subject: [PATCH] =?UTF-8?q?chore(build):=20viperc=20=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E9=9B=86=E4=B8=AD=E4=B8=BA=20VIPERC=20=E5=B8=B8=E9=87=8F?= =?UTF-8?q?=E5=B9=B6=E5=88=87=E6=8D=A2=20vpcbuild3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - BuildKernel / BuildLibs / BuildApps 共用 VIPERC,去掉三处硬编码 - 指向 ViperC/__vpcbuild3__/output/viperc.exe --- build.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index 506e0c5..19d4400 100644 --- a/build.py +++ b/build.py @@ -4,6 +4,12 @@ import sys import subprocess +# ============================================================================ +# viperc 编译器路径 —— 唯一来源,改这里即可 +# ============================================================================ +VIPERC = r'..\..\ViperC\__vpcbuild3__\output\viperc.exe' + + # 解析参数 clean = '--noclean' not in sys.argv kernel_only = '--kernel-only' in sys.argv @@ -41,7 +47,7 @@ if kernel_only and nokernel: def BuildKernel(): """编译内核:链接器一次产出带符号 kernel.elf,再由 objcopy 二次处理成裸镜像 kernel.bin""" - cmd = r'..\..\ViperC\__vpcbuild__\output\viperc.exe --project ./VKernel/project.vpj --clear-cache --rebuild-includes' + cmd = rf'{VIPERC} --project ./VKernel/project.vpj --clear-cache --rebuild-includes' if clean: cmd += ' --clean' os.system(cmd) @@ -78,7 +84,7 @@ def BuildLibs(): """编译 Libs/ 下的动态库(应用运行期经 LOAD_SO 加载)。""" os.makedirs("./disk/libs", exist_ok=True) for proj, out in LIB_LIST: - cmd = rf'..\..\ViperC\__vpcbuild__\output\viperc.exe --project {proj}/project.vpj --clear-cache' + cmd = rf'{VIPERC} --project {proj}/project.vpj --clear-cache' if clean: cmd += ' --clean' os.system(cmd) @@ -123,7 +129,7 @@ def BuildApps(): for name, proj, out, dst in APP_LIST: if app_filter is not None and name not in app_filter: continue - cmd = rf'..\..\ViperC\__vpcbuild__\output\viperc.exe --project {proj}/project.vpj --clear-cache' + cmd = rf'{VIPERC} --project {proj}/project.vpj --clear-cache' if clean: cmd += ' --clean' os.system(cmd)