nodeslicer/build.sh
2026-10-07 14:00:18 +03:00

40 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
TMPDIR="$(mktemp -d)"
cleanup() { rm -rf "$TMPDIR"; }
trap cleanup EXIT
if command -v gcc >/dev/null 2>&1; then
gcc -O3 -fPIC -shared "$SCRIPT_DIR/core/c_seam.c" -o "$SCRIPT_DIR/core/libseam_opt.so" -lm 2>/dev/null || true
elif command -v clang >/dev/null 2>&1; then
clang -O3 -fPIC -shared "$SCRIPT_DIR/core/c_seam.c" -o "$SCRIPT_DIR/core/libseam_opt.so" -lm 2>/dev/null || true
fi
mapfile -t FILES < <(git ls-files -co --exclude-standard \
| grep -v -xE '(\.gitignore|build\.sh)' \
| while read -r f; do [ -e "$f" ] && echo "$f"; done)
tar -cf - "${FILES[@]}" | tar -xf - -C "$TMPDIR"
if [ -f "$SCRIPT_DIR/core/libseam_opt.so" ]; then
cp "$SCRIPT_DIR/core/libseam_opt.so" "$TMPDIR/core/libseam_opt.so"
fi
if [ -d wheels ]; then
mkdir -p "$TMPDIR/wheels"
cp -r wheels/* "$TMPDIR/wheels/" 2>/dev/null || true
fi
BLENDER="${BLENDER:-/home/nicolas/Applications/blender-5.1.0-linux-x64/blender}"
if [ ! -x "$BLENDER" ]; then
BLENDER="$(command -v blender)"
fi
cd "$TMPDIR"
"$BLENDER" \
--command extension build --split-platforms \
--output-filepath "$SCRIPT_DIR/release/NodeSlicer_0.0.1.zip"
cd "$SCRIPT_DIR"