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