Closed tussedrotten closed 2 years ago
Dette fungerer i hvert fall på en Jetson AGX Xavier
#!/usr/bin/env bash
vtk_python() (
debs() {
sudo apt-get install python3.8 python3.8-dev python3.8-distutils python3.8-venv
sudo apt-get install ninja-build cmake libgl1-mesa-dev libegl1-mesa-dev
sudo apt install time
touch .apt-already
}
venv() {
python3.8 -m venv venv
source venv/bin/activate
pip install -U pip
}
src() {
[[ -d VTK ]] || git clone https://github.com/Kitware/VTK -b v9.0.1 --depth 1
mkdir -p VTK/build
}
set -euxo pipefail
rm -rf __pycache__ venv VTK/build
[[ -f .apt-already ]] || debs
venv
src
PYBIN=$(which python)
cd VTK/build
cmake \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DVTK_BUILD_TESTING=OFF \
-DVTK_BUILD_DOCUMENTATION=OFF \
-DVTK_BUILD_EXAMPLES=OFF \
-DVTK_DATA_EXCLUDE_FROM_ALL:BOOL=ON \
-DVTK_MODULE_ENABLE_VTK_PythonInterpreter:STRING=NO \
-DVTK_WHEEL_BUILD=ON \
-DVTK_PYTHON_VERSION=3 \
-DVTK_USE_CUDA=ON \
-DVTK_ENABLE_WRAPPING=ON \
-DVTK_WRAP_PYTHON=ON \
-DVTK_OPENGL_HAS_EGL=False \
-DPython3_EXECUTABLE=$PYBIN \
..
time ninja
pip install wheel
pip wheel . --verbose
pip install ./vtk-*.whl
pip install pyvista
)
[[ $_ != $0 ]] || vtk_python
./vtk_python
Prøvde med -DVTK_OPENGL_HAS_EGL=True
men da fikk jeg feilmelding a la
vtkopenglstate.cxx:1380 WARN| Hardware does not support the number of textures defined
og bare svart skjerm.
La også inn en patch i VTK/CMakeLists.txt
fordi jeg har så ny CMake. (3.22.2)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00695601..cca29f06 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,0 +18,6 @@ endif ()
+if (POLICY CMP0077)
+ cmake_policy(SET CMP0077 OLD)
+endif ()
+if (POLICY CMP0127)
+ cmake_policy(SET CMP0127 OLD)
+endif ()
https://github.com/pyvista/pyvista/releases https://docs.pyvista.org/extras/building_vtk.html