diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2023-08-05 14:53:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 14:53:57 +0100 |
commit | 0b175fcbbdbe7ca768b7beaca64ddf699f35a25b (patch) | |
tree | d6a69778b9d61874db598ad8d512c5833342b7c1 /candle-pyo3 | |
parent | 620f83cf66073f033d1fdc9846123c155422677e (diff) | |
download | candle-0b175fcbbdbe7ca768b7beaca64ddf699f35a25b.tar.gz candle-0b175fcbbdbe7ca768b7beaca64ddf699f35a25b.tar.bz2 candle-0b175fcbbdbe7ca768b7beaca64ddf699f35a25b.zip |
Fix the pyo3 build for macos. (#324)
* Fix the pyo3 build for macos.
* rustfmt fix.
Diffstat (limited to 'candle-pyo3')
-rw-r--r-- | candle-pyo3/Cargo.toml | 3 | ||||
-rw-r--r-- | candle-pyo3/README.md | 10 | ||||
-rw-r--r-- | candle-pyo3/build.rs | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/candle-pyo3/Cargo.toml b/candle-pyo3/Cargo.toml index e5ebe953..610a1733 100644 --- a/candle-pyo3/Cargo.toml +++ b/candle-pyo3/Cargo.toml @@ -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"] diff --git a/candle-pyo3/README.md b/candle-pyo3/README.md index 1887f269..f716b092 100644 --- a/candle-pyo3/README.md +++ b/candle-pyo3/README.md @@ -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 ``` diff --git a/candle-pyo3/build.rs b/candle-pyo3/build.rs new file mode 100644 index 00000000..dace4a9b --- /dev/null +++ b/candle-pyo3/build.rs @@ -0,0 +1,3 @@ +fn main() { + pyo3_build_config::add_extension_module_link_args(); +} |