更改目标类型为none以生成不依赖任何平台的代码

This commit is contained in:
pointer-to-bios 2024-02-04 02:58:09 +08:00
parent 2b2dc2d5bc
commit e5ddfed1fb
3 changed files with 23 additions and 2 deletions

View File

@ -2,3 +2,18 @@
name = "metaverse" name = "metaverse"
version = "0.1.0" version = "0.1.0"
edition = "2021" 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"

@ -1 +1 @@
Subproject commit a7d79f8d3d865c93dad38796530e6a4dc53a0377 Subproject commit 087c4795bbc23cd0baee060bda8c1159a971a542

View File

@ -22,12 +22,18 @@ endif
################################ ################################
# rust语言环境变量 # 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/" \ -L crate="${PWD}/../rustlib/${ARCH}/src/" \
-C code-model=large \ -C code-model=large \
-C relocation-model=static \ -C relocation-model=static \
-C embed-bitcode=no -C embed-bitcode=no
ifeq (${ARCH},x86_64)
RSCFLAGS := ${RSCFLAGS} --target x86_64-unknown-none
endif
ifdef release ifdef release
RSCFLAGS := -O RSCFLAGS := -O
endif endif