Skip to content

Commit

Permalink
Merge pull request #9 from jcfr/osmesa-build-update
Browse files Browse the repository at this point in the history
Build osmesa properly
  • Loading branch information
zachmullen committed Nov 2, 2017
2 parents 4a8ad37 + 6e41e85 commit 86aab88
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 8 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ if(VTKPythonPackage_SUPERBUILD)
# re-using existing resources.
#
# VTK_SOURCE_DIR: Path to an existing source directory
# VTK_Group_Web: Whether web package should be included
# VTK_OPENGL_HAS_OSMESA: Whether to use OSMesa for offscreen rendering
#

option(VTKPythonPackage_BUILD_PYTHON "Build VTK python module" ON)
Expand All @@ -59,6 +61,13 @@ if(VTKPythonPackage_SUPERBUILD)
option(VTK_Group_Web "Build VTK web module" OFF)
mark_as_advanced(VTK_Group_Web)

option(VTK_OPENGL_HAS_OSMESA "Use OSMesa for offscreen rendering" OFF)
mark_as_advanced(VTK_OPENGL_HAS_OSMESA)
if(VTK_OPENGL_HAS_OSMESA)
set(NOT_VTK_OPENGL_HAS_OSMESA OFF)
else()
set(NOT_VTK_OPENGL_HAS_OSMESA ON)
endif()

#-----------------------------------------------------------------------------
include(ExternalProject)
Expand Down Expand Up @@ -203,6 +212,8 @@ if(VTKPythonPackage_SUPERBUILD)
# Rendering options
-DVTK_Group_Qt:BOOL=OFF # XXX Enabled this later
-DVTK_RENDERING_BACKEND:STRING=OpenGL2
-DVTK_OPENGL_HAS_OSMESA:BOOL=${VTK_OPENGL_HAS_OSMESA}
-DVTK_USE_X:BOOL=${NOT_VTK_OPENGL_HAS_OSMESA}

# Module options
-DVTK_Group_Web:BOOL=${VTK_Group_Web}
Expand Down
45 changes: 40 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
FROM python:3.6
MAINTAINER Zach Mullen <zach.mullen@kitware.com>

RUN apt-get update && apt-get install -y libglapi-mesa libosmesa6 freeglut3-dev && \
pip install cmake ninja scikit-build
RUN pip install cmake ninja scikit-build

# Download llvm
RUN wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz && \
tar xf llvm-3.9.1.src.tar.xz && rm llvm-3.9.1.src.tar.xz

# Build llvm
RUN cd /llvm-3.9.1.src && mkdir _build && cd _build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_TARGETS_TO_BUILD:STRING=X86 \
.. && make -j4 && make install

# Download osmesa
RUN wget https://mesa.freedesktop.org/archive/mesa-17.2.4.tar.xz && \
tar xf mesa-17.2.4.tar.xz && rm mesa-17.2.4.tar.xz

# Build osmesa
RUN cd /mesa-17.2.4 && ./configure \
--disable-xvmc \
--disable-glx \
--disable-dri \
--disable-gbm \
--with-dri-drivers= \
--with-gallium-drivers=swrast \
--enable-texture-float \
--disable-egl \
--with-platforms= \
--enable-gallium-osmesa \
--enable-llvm && \
make -j4 && make install

# Build VTK with python
COPY . /VTKPythonPackage

RUN cd VTKPythonPackage && \
VTK_CMAKE_ARGS="-DVTK_Group_Web:BOOL=ON" python setup.py bdist_wheel
RUN pip install /VTKPythonPackage/dist/vtk-*.whl
RUN cd /VTKPythonPackage && \
VTK_CMAKE_ARGS="-DVTK_OPENGL_HAS_OSMESA:BOOL=ON -DVTK_Group_Web:BOOL=ON" python setup.py bdist_wheel
RUN pip install /VTKPythonPackage/dist/vtk-*.whl && \
ldconfig && \
rm -rf /VTKPythonPackage && rm -rf /mesa-17.2.4 && rm -rf /llvm-3.9.1.src
15 changes: 12 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@
py_modules=[
'vtkVersion',
],
download_url=r'http://www.vtk.org/download/',
description=r'VTK is an open-source toolkit for 3D computer graphics, image processing, and visualization',
long_description='VTK is an open-source, cross-platform library that provides developers with an extensive suite of software tools for 3D computer graphics, image processing, and visualization. It consists of a C++ class library and several interpreted interface layers including Tcl/Tk, Java, and Python. VTK supports a wide variety of visualization algorithms including scalar, vector, tensor, texture, and volumetric methods, as well as advanced modeling techniques such as implicit modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay triangulation. VTK has an extensive information visualization framework and a suite of 3D interaction widgets. The toolkit supports parallel processing and integrates with various databases on GUI toolkits such as Qt and Tk.',
download_url='http://www.vtk.org/download/',
description='VTK is an open-source toolkit for 3D computer graphics, image processing, and visualization',
long_description='VTK is an open-source, cross-platform library that provides developers with '
'an extensive suite of software tools for 3D computer graphics, image processing,'
'and visualization. It consists of a C++ class library and several interpreted interface '
'layers including Tcl/Tk, Java, and Python. VTK supports a wide variety of visualization '
'algorithms including scalar, vector, tensor, texture, and volumetric methods, as well as '
'advanced modeling techniques such as implicit modeling, polygon reduction, mesh '
'smoothing, cutting, contouring, and Delaunay triangulation. VTK has an extensive '
'information visualization framework and a suite of 3D interaction widgets. The toolkit '
'supports parallel processing and integrates with various databases on GUI toolkits such '
'as Qt and Tk.',
classifiers=[
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
Expand Down

0 comments on commit 86aab88

Please sign in to comment.