From e5ddfed1fbc791a3af0187fc475438944d64b16b Mon Sep 17 00:00:00 2001 From: pointer-to-bios Date: Sun, 4 Feb 2024 02:58:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=9B=AE=E6=A0=87=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=BAnone=E4=BB=A5=E7=94=9F=E6=88=90=E4=B8=8D?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E4=BB=BB=E4=BD=95=E5=B9=B3=E5=8F=B0=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 15 +++++++++++++++ rustlib | 2 +- src/Makefile | 8 +++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cef59e4..f89fb5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,3 +2,18 @@ name = "metaverse" version = "0.1.0" edition = "2021" + +# 此Cargo.toml仅用于rust-analyzer识别rust部分的代码 +# 不应使用cargo编译 + +[build] +type = "staticlib" +rustflags = [ + "-C", "embed-bitcode=no", + "-C", "code-model=large", + "-C", "relocation-model=static", + "-L", "crate=${PWD}/../rustlib/${ARCH}/src/" +] + +[target.'cfg(target_arch = "x86_64")'] +target = "x86_64-unknown-none" diff --git a/rustlib b/rustlib index a7d79f8..087c479 160000 --- a/rustlib +++ b/rustlib @@ -1 +1 @@ -Subproject commit a7d79f8d3d865c93dad38796530e6a4dc53a0377 +Subproject commit 087c4795bbc23cd0baee060bda8c1159a971a542 diff --git a/src/Makefile b/src/Makefile index 3957d4b..7ccfc6c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -22,12 +22,18 @@ endif ################################ # rust语言环境变量 -RSCFLAGS = --emit obj --crate-type lib \ +RSCFLAGS = --emit obj --crate-type staticlib --verbose \ + --crate-name=metaverse \ + --edition 2021 \ -L crate="${PWD}/../rustlib/${ARCH}/src/" \ -C code-model=large \ -C relocation-model=static \ -C embed-bitcode=no +ifeq (${ARCH},x86_64) + RSCFLAGS := ${RSCFLAGS} --target x86_64-unknown-none +endif + ifdef release RSCFLAGS := -O endif