From 160ad716c28f3ba3d7787899ec28ec8ba1d9e8cb Mon Sep 17 00:00:00 2001 From: shenjack-5600u <3695888@qq.com> Date: Sun, 26 May 2024 10:47:05 +0800 Subject: [PATCH] update dr rs and compile_mod.py --- mods/dr_game/Difficult_Rocket_rs/src/setup.py | 3 ++- scripts/compile_mod.py | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mods/dr_game/Difficult_Rocket_rs/src/setup.py b/mods/dr_game/Difficult_Rocket_rs/src/setup.py index a1f97cc..d697a13 100644 --- a/mods/dr_game/Difficult_Rocket_rs/src/setup.py +++ b/mods/dr_game/Difficult_Rocket_rs/src/setup.py @@ -19,7 +19,8 @@ setup( RustExtension( target="Difficult_Rocket_rs.Difficult_Rocket_rs", binding=Binding.PyO3, - strip=Strip.All, + rustc_flags=["-Ctarget-cpu=native"], + strip=Strip.No, ) ], zip_safe=False, diff --git a/scripts/compile_mod.py b/scripts/compile_mod.py index 7dbb13f..3cf1109 100644 --- a/scripts/compile_mod.py +++ b/scripts/compile_mod.py @@ -1,13 +1,16 @@ +import os +import sys import argparse import subprocess -import sys -import os + +from pathlib import Path if __name__ == "__main__": parser = argparse.ArgumentParser() # script -py (3.8 ~ 3.12) parser.add_argument("-py", type=str, help="python version") parser.add_argument("-all", help="用所有的python版本编译", action="store_true") + parser.add_argument("-clean", help="清理编译文件", action="store_true") args = parser.parse_args() @@ -17,8 +20,16 @@ if __name__ == "__main__": subprocess.run(["cargo", "fmt", "--all"]) + if args.clean: + subprocess.run(["cargo", "clean"]) + os.chdir("../") + if args.clean: + subprocess.run([sys.executable, "setup.py", "clean"]) + + sys.exit(0) + if not args.py: if args.all: all_version = ("38", "39", "310", "311", "312")