Fix the pyo3 build for macos. (#324)

* Fix the pyo3 build for macos.

* rustfmt fix.
This commit is contained in:
Laurent Mazare
2023-08-05 14:53:57 +01:00
committed by GitHub
parent 620f83cf66
commit 0b175fcbbd
4 changed files with 15 additions and 2 deletions

View File

@ -19,6 +19,9 @@ candle = { path = "../candle-core", version = "0.1.0", package = "candle-core" }
pyo3 = { version = "0.19.0", features = ["extension-module"] }
half = { workspace = true }
[build-dependencies]
pyo3-build-config = "0.19"
[features]
default = []
cuda = ["candle/cuda"]

View File

@ -1,5 +1,11 @@
From the top level directory run:
From the top level directory run the following for linux.
```
cargo build --release --package candle-pyo3 && cp -f ./target/release/libcandle.so candle.so
cargo build --profile=release-with-debug --package candle-pyo3 && cp -f ./target/release-with-debug/libcandle.so candle.so
PYTHONPATH=. python3 candle-pyo3/test.py
```bash
Or for macOS users:
```bash
cargo build --profile=release-with-debug --package candle-pyo3 && cp -f ./target/release-with-debug/libcandle.dylib candle.so
PYTHONPATH=. python3 candle-pyo3/test.py
```

3
candle-pyo3/build.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
pyo3_build_config::add_extension_module_link_args();
}