Files
workinf_Blender_Wasm/tools/web/native-build-env.sh
mes123456 c2c65d3a09
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Rebuild local Blender WASM environment and recovery evidence
2026-08-27 20:22:15 +08:00

46 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Shared environment for native Blender builds and desktop fixture checkers.
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
export BLENDER_SOURCE_DIR="${BLENDER_SOURCE_DIR:-${repo_root}/blender-5.2.0}"
export BLENDER_BUILD_DIR="${BLENDER_BUILD_DIR:-${repo_root}/build_blender_native}"
export BLENDER_DEPS_ROOT="${BLENDER_DEPS_ROOT:-${repo_root}/.deps/native}"
export BLENDER_PYTHON_ROOT="${BLENDER_PYTHON_ROOT:-${BLENDER_DEPS_ROOT}/python}"
export BLENDER_CMAKE_HELPERS="${repo_root}/tools/web/cmake"
native_lib_dirs=()
if [[ -d "${BLENDER_DEPS_ROOT}" ]]; then
while IFS= read -r directory; do
native_lib_dirs+=("${directory}")
done < <(find "${BLENDER_DEPS_ROOT}" -type d \( -name lib -o -name lib64 \) -print | sort)
fi
if [[ -d "${BLENDER_PYTHON_ROOT}/lib" ]]; then
native_lib_dirs+=("${BLENDER_PYTHON_ROOT}/lib")
fi
for site_packages in \
"${BLENDER_PYTHON_ROOT}/lib/python3.13/site-packages" \
"${BLENDER_BUILD_DIR}/bin/5.2/python/lib/python3.13/site-packages"; do
for private_lib_dir in "${site_packages}"/*.libs; do
if [[ -d "${private_lib_dir}" ]]; then
native_lib_dirs+=("${private_lib_dir}")
fi
done
done
if [[ -n "${LD_LIBRARY_PATH:-}" ]]; then
native_lib_dirs+=("${LD_LIBRARY_PATH}")
fi
if ((${#native_lib_dirs[@]})); then
IFS=:; export LD_LIBRARY_PATH="${native_lib_dirs[*]}"
fi
export PATH="${BLENDER_PYTHON_ROOT}/bin:${PATH}"
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
printf 'native-build-env-ok source=%s build=%s deps=%s\n' \
"${BLENDER_SOURCE_DIR}" "${BLENDER_BUILD_DIR}" "${BLENDER_DEPS_ROOT}"
printf 'compiler=%s\n' "$(command -v "${CC:-gcc-14}" || command -v gcc || printf 'missing')"
printf 'cmake=%s ninja=%s\n' "$(command -v cmake || printf 'missing')" "$(command -v ninja || printf 'missing')"
fi