Skip to content

Instantly share code, notes, and snippets.

@kevin-keraudren
Created January 27, 2016 10:00
Show Gist options
  • Save kevin-keraudren/40489545b30ad3f8ca9c to your computer and use it in GitHub Desktop.
Save kevin-keraudren/40489545b30ad3f8ca9c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -x
set -e
git clone https://github.com/Kitware/VTK.git
cd VTK
mkdir build
cd build
# we want to install it in our virtual environment
virtualenv_root=`python -c 'import sys; print(sys.prefix)'`
# we want to compile against our Python 3 installed with brew
brew_root="/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5"
cmake -D BUILD_TESTING:BOOL=OFF \
-D CMAKE_BUILD_TYPE:STRING=Release \
-D CMAKE_INSTALL_PREFIX:PATH=${virtualenv_root} \
-D VTK_WRAP_PYTHON:BOOL=ON \
-D VTK_PYTHON_VERSION:STRING=3 \
-D PYTHON_INCLUDE_DIR:PATH=${brew_root}/include/python3.5m/ \
-D PYTHON_LIBRARY:FILEPATH=${brew_root}/lib/libpython3.5.dylib \
-D VTK_INSTALL_PYTHON_MODULE_DIR:PATH=${virtualenv_root}/lib/python3.5/site-packages/ \
..
make -j4
make install
# add a line to your bash_profile:
# export DYLD_FALLBACK_LIBRARY_PATH=`python -c 'import sys; print(sys.prefix)'`/lib
@dewet22
Copy link

dewet22 commented Feb 2, 2016

Two small improvements: $virtualenv_root already exists as $VIRTUAL_ENV, and $brew_root should be determined by the output from python3.5-config --prefix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment