codemp-sublime/build.sh
Camillo Schenone 55da78ad91 chore: name change and build script tweak, adding the wheel
Former-commit-id: e77044f56c199268115c8768d69b4fe06357d6c3
2024-03-23 18:55:26 +01:00

27 lines
721 B
Bash
Executable file

#!/bin/sh
ROOT_DIR="$(pwd)"
BUILD_DIR="$ROOT_DIR/target/debug/"
WHEEL_DIR="$ROOT_DIR/target/wheels"
FILENAME="libcodemp"
TARGET_DIR="$ROOT_DIR/bindings"
SO_NAME="codemp"
WHEEL_NAME="Codemp_Sublime"
PYO3_PYTHON="$(pyenv which python)"
TARGET_EXT="$($PYO3_PYTHON -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')"
SO_TARGET="${SO_NAME}${TARGET_EXT}"
echo "Building .SO with python: $PYO3_PYTHON"
env PYO3_PYTHON="${PYO3_PYTHON}" cargo build
echo "Copying into: $TARGET_DIR/$SO_TARGET"
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"