Skip to content

VTK 7 (py2 and py3) #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from Jun 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions recipes/vtk/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
mkdir build
cd build

set BUILD_CONFIG=Release

:: tell cmake where Python is
set PYTHON_LIBRARY=%PREFIX%\libs\python%PY_VER:~0,1%%PY_VER:~2,1%.lib

cmake .. -G "NMake Makefiles" ^
-Wno-dev ^
-DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^
-DBUILD_TESTING:BOOL=OFF ^
-DBUILD_EXAMPLES:BOOL=OFF ^
-DBUILD_DOCUMENTATION:BOOL=OFF ^
-DPYTHON_INCLUDE_DIR:PATH="%PREFIX%/include" ^
-DPYTHON_LIBRARY:FILEPATH="%PYTHON_LIBRARY%" ^
-DPYTHON_EXECUTABLE:FILEPATH="%PYTHON%" ^
-DVTK_BUILD_PYTHON_MODULE_DIR:PATH="%SP_DIR%/vtk" ^
-DVTK_ENABLE_VTKPYTHON:BOOL=OFF ^
-DVTK_WRAP_PYTHON:BOOL=ON ^
-DVTK_PYTHON_VERSION:STRING="%PY_VER%" ^
-DVTK_INSTALL_PYTHON_MODULE_DIR:PATH="%SP_DIR%" ^
-DModule_vtkWrappingPythonCore:BOOL=OFF ^
-DINSTALL_BIN_DIR:PATH="%LIBRARY_BIN%" ^
-DINSTALL_LIB_DIR:PATH="%LIBRARY_LIB%" ^
-DINSTALL_INC_DIR:PATH="%LIBRARY_INC%" ^
-DINSTALL_MAN_DIR:PATH="%LIBRARY_PREFIX%/man"
if errorlevel 1 exit 1

nmake install
if errorlevel 1 exit 1
39 changes: 39 additions & 0 deletions recipes/vtk/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
mkdir build
cd build

BUILD_CONFIG=Release

# sometimes python is suffixed, this is a quick fix
# in a future PR we should probably switch to cmake find python scripting
PYTHON_INCLUDE=${PREFIX}/include/python${PY_VER}
if [ ! -d $PYTHON_INCLUDE ]; then
PYTHON_INCLUDE=${PREFIX}/include/python${PY_VER}m
fi

PYTHON_LIBRARY="libpython${PY_VER}.so"
PYTHON_LIBRARY=${PREFIX}/lib/${PYTHON_LIBRARY}
if [ ! -f $PYTHON_LIBRARY ]; then
PYTHON_LIBRARY=${PREFIX}/lib/libpython${PY_VER}m.so
fi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need cmake here? Otherwise how do we build for Mac?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to do so, but it's not entirely clear to us how that works on Linux.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, make install should work just fine on both platforms I think...

cmake .. -G "Unix Makefiles" \
-Wno-dev \
-DCMAKE_BUILD_TYPE=$BUILD_CONFIG \
-DCMAKE_INSTALL_PREFIX:PATH="${PREFIX}" \
-DCMAKE_INSTALL_RPATH:PATH="${PREFIX}/lib" \
-DINSTALL_PKGCONFIG_DIR:PATH=$PKG_CONFIG_PATH \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INSTALL_PKGCONFIG_DIR is unused according to a CMake warning. will remove that in future PR.

-DBUILD_DOCUMENTATION:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DBUILD_EXAMPLES:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DVTK_ENABLE_VTKPYTHON:BOOL=OFF \
-DVTK_WRAP_PYTHON:BOOL=ON \
-DVTK_PYTHON_VERSION:STRING="${PY_VER}" \
-DVTK_INSTALL_PYTHON_MODULE_DIR:PATH="${SP_DIR}" \
-DModule_vtkWrappingPythonCore:BOOL=OFF \
-DPYTHON_EXECUTABLE:FILEPATH=$PYTHON \
-DPYTHON_INCLUDE_DIR:PATH=$PYTHON_INCLUDE \
-DPYTHON_LIBRARY:FILEPATH=$PYTHON_LIBRARY

make install
56 changes: 56 additions & 0 deletions recipes/vtk/manual_vtk_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python

# This simple example shows how to do basic rendering and pipeline
# creation.

import vtk
# The colors module defines various useful colors.
from vtk.util.colors import tomato

# This creates a polygonal cylinder model with eight circumferential
# facets.
cylinder = vtk.vtkCylinderSource()
cylinder.SetResolution(8)

# The mapper is responsible for pushing the geometry into the graphics
# library. It may also do color mapping, if scalars or other
# attributes are defined.
cylinderMapper = vtk.vtkPolyDataMapper()
cylinderMapper.SetInputConnection(cylinder.GetOutputPort())

# The actor is a grouping mechanism: besides the geometry (mapper), it
# also has a property, transformation matrix, and/or texture map.
# Here we set its color and rotate it -22.5 degrees.
cylinderActor = vtk.vtkActor()
cylinderActor.SetMapper(cylinderMapper)
cylinderActor.GetProperty().SetColor(tomato)
cylinderActor.RotateX(30.0)
cylinderActor.RotateY(-45.0)

# Create the graphics structure. The renderer renders into the render
# window. The render window interactor captures mouse events and will
# perform appropriate camera or actor manipulation depending on the
# nature of the events.
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

# Add the actors to the renderer, set the background and size
ren.AddActor(cylinderActor)
ren.SetBackground(0.1, 0.2, 0.4)
renWin.SetSize(200, 200)

# This allows the interactor to initalize itself. It has to be
# called before an event loop.
iren.Initialize()

# We'll zoom in a little by accessing the camera and invoking a "Zoom"
# method on it.
ren.ResetCamera()
ren.GetActiveCamera().Zoom(1.5)
renWin.Render()

# Start the event loop.
iren.Start()
65 changes: 65 additions & 0 deletions recipes/vtk/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{% set version = "7.0.0" %}
{% set minor_version = ".".join(version.split(".")[:2]) %}

package:
name: vtk
version: {{ version }}

source:
url: http://www.vtk.org/files/release/{{ minor_version }}/VTK-{{ version }}.tar.gz
fn: VTK-{{ version }}.tar.gz
sha256: 78a990a15ead79cdc752e86b83cfab7dbf5b7ef51ba409db02570dbdd9ec32c3

build:
number: 0
features:
- vc9 # [win and py27]
- vc10 # [win and py34]
- vc14 # [win and py35]
# only x64 py2.7 and x64 py3.5 on linux will complete before build timeout
# see https://github.com/conda-forge/staged-recipes/pull/453#issuecomment-228308297
skip: true # [win or osx or linux32 or py34]

requirements:
build:
- freeglut # [linux]
- cmake
- python
run:
- freeglut # [linux]
- python

test:
imports:
- vtk
- vtk.vtkChartsCore
- vtk.vtkCommonCore
- vtk.vtkFiltersCore
- vtk.vtkFiltersGeneric
- vtk.vtkGeovisCore
- vtk.vtkFiltersHybrid
- vtk.vtkIOCore
- vtk.vtkImagingCore
- vtk.vtkInfovisCore
- vtk.vtkRenderingCore
- vtk.vtkViewsCore
- vtk.vtkRenderingVolume
- vtk.vtkInteractionWidgets

about:
home: http://www.vtk.org/
license: BSD 3-Clause
summary: >
The Visualization Toolkit (VTK) is an open-source, freely available software
system for 3D computer graphics, modeling, image processing, volume
rendering, scientific visualization, and information visualization.

extra:
recipe-maintainers:
- Korijn
- ivoflipse
- Maxyme
- ccordoba12
- grlee77
- msarahan
- patricksnape
2 changes: 2 additions & 0 deletions recipes/vtk/yum_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
libXt-devel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need mesa-libGLU-devel also.

mesa-libGLU-devel