2023-08-17 18:39:47 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
ROOT_DIR="$(pwd)"
|
2024-03-23 18:55:26 +01:00
|
|
|
BUILD_DIR="$ROOT_DIR/target/debug/"
|
|
|
|
WHEEL_DIR="$ROOT_DIR/target/wheels"
|
|
|
|
FILENAME="libcodemp"
|
2023-08-17 18:39:47 +02:00
|
|
|
|
|
|
|
TARGET_DIR="$ROOT_DIR/bindings"
|
2024-03-23 18:55:26 +01:00
|
|
|
SO_NAME="codemp"
|
|
|
|
WHEEL_NAME="Codemp_Sublime"
|
2023-08-17 18:39:47 +02:00
|
|
|
|
|
|
|
PYO3_PYTHON="$(pyenv which python)"
|
2024-03-16 14:59:26 +01:00
|
|
|
TARGET_EXT="$($PYO3_PYTHON -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')"
|
2024-03-23 18:55:26 +01:00
|
|
|
SO_TARGET="${SO_NAME}${TARGET_EXT}"
|
2023-08-17 18:39:47 +02:00
|
|
|
|
2024-03-23 18:55:26 +01:00
|
|
|
echo "Building .SO with python: $PYO3_PYTHON"
|
2024-03-16 15:51:49 +01:00
|
|
|
env PYO3_PYTHON="${PYO3_PYTHON}" cargo build
|
2024-03-23 18:55:26 +01:00
|
|
|
echo "Copying into: $TARGET_DIR/$SO_TARGET"
|
2023-08-17 18:39:47 +02:00
|
|
|
|
2024-03-23 18:55:26 +01:00
|
|
|
echo "Building python wheel..."
|
|
|
|
maturin build -i "$PYO3_PYTHON"
|
|
|
|
|
|
|
|
wheels=($WHEEL_DIR/$WHEEL_NAME*.whl)
|
|
|
|
for whl in $wheels; do
|
|
|
|
cp $whl $TARGET_DIR
|
|
|
|
done
|
|
|
|
ditto "$BUILD_DIR/${FILENAME}.dylib" "$TARGET_DIR/$SO_TARGET"
|