From 053d126b625af2ceda2662e8ca432f097ec3ae4b Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 24 Jan 2024 14:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E7=82=B9=20pyo3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/Cargo.toml | 4 ++++ ica-rs/build.rs | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 ica-rs/build.rs diff --git a/ica-rs/Cargo.toml b/ica-rs/Cargo.toml index 2afab5f..c33d468 100644 --- a/ica-rs/Cargo.toml +++ b/ica-rs/Cargo.toml @@ -2,6 +2,7 @@ name = "ica-rs" version = "0.1.0" edition = "2021" +build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,3 +16,6 @@ toml = "0.8.8" [patch.crates-io] rust_socketio = { path = "../../../rust-socketio/socketio" } + +[build-dependencies] + diff --git a/ica-rs/build.rs b/ica-rs/build.rs new file mode 100644 index 0000000..8b48414 --- /dev/null +++ b/ica-rs/build.rs @@ -0,0 +1,19 @@ +use std::env; + +// 指定 pyo3 的绑定对象 +fn pyo3_config() { + // PYO3_PYTHON=xxxx + #[cfg(windows)] + { + env::set_var("PYO3_PYTHON", "python3.10") + } + // wsl + #[cfg(target_os = "linux")] + { + env::set_var("PYO3_PYTHON", "python3.10") + } +} + +fn main() { + pyo3_config(); +} \ No newline at end of file