Skip to content
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

Vtk new module system #62

Merged
merged 20 commits into from
Apr 23, 2019
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
6 changes: 3 additions & 3 deletions cdat-docker-conda-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ RUN yum -y install wget tar which
RUN yum -y install mesa-libGL-devel "@X Window System" libXt-devel

# install newer compiler 4.9.2
# See https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/
# See https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
RUN yum-config-manager --enable rhel-server-rhscl-6-rpms
RUN yum -y install devtoolset-3-gcc-c++
RUN yum -y install devtoolset-7-gcc-c++

# Enable the new compiler in bash
RUN echo $'currentver="$(gcc -dumpversion)" \n\
oldver="4.4.7" \n\
echo "Current version" ${currentver} \n\
if [ "$(printf "%s\\n" "$oldver" "$currentver" | sort -r -V | head -n1)" = "$oldver" ]; then \
echo "Setup a new version";\
scl enable devtoolset-3 bash;\
scl enable devtoolset-7 bash;\
fi' >> ~/.bashrc

# install conda and CDAT
Expand Down
16 changes: 9 additions & 7 deletions cdat-docker-conda-build/README-docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ RedHat 6 docker for building CDAT conda recipes
>>> docker inspect registry.access.redhat.com/rhel6/rhel

* Modify the Dockerfile and enter the username and password for your Red Hat Developer Subscription.
You can get a free subscription from Red Hat.
You can get a free subscription from Red Hat at
https://developers.redhat.com/#
bottom of the screen, red box, Sign me up>

* build the image test
>>> docker build --rm -t test .
* build the image cdat-conda-build-7
>>> docker build --rm -t cdat-conda-build-7 .

* run the container test, using image test to create it, mounting the
* run the container cdat-conda-build-7, using image cdat-conda-build-7 to create it, mounting the
important folders. For instance ~/projects has all the CDAT
recipes. This gives you a prompt in RedHat 6 docker.
>>> docker run -it -v ~/projects/:/root/projects -v ~/anaconda3:/home/danlipsa/anaconda3 --name test test
>>> docker run -it -v ~/projects/:/root/projects -v ~/anaconda3:/home/danlipsa/anaconda3 --name cdat-conda-build-7 cdat-conda-build-7

* build conda recipes

Expand All @@ -26,7 +28,7 @@ RedHat 6 docker for building CDAT conda recipes
>>> exit

* start the container after exit
>>> docker container start test
>>> docker container start cdat-conda-build-7

* connect to the container
>>> docker exec -it test /bin/bash
>>> docker exec -it cdat-conda-build-7 /bin/bash
6 changes: 6 additions & 0 deletions cdat-docker-conda-build/centos6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM centos:6
MAINTAINER Dan Lipsa <[email protected]>

RUN yum groupinstall "X Window System" "Desktop" "Desktop Platform"

CMD ["/bin/bash"]
27 changes: 27 additions & 0 deletions cdat-docker-conda-build/centos6/README-docker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
===========================================
Centos 6 docker for insepcting CDT packages
===========================================

* pull centos6 image
>>> docker pull centos:6

* build the image cdat-centos6
The docker file is from
https://hub.docker.com/_/centos
>>> docker build --rm -t cdat-centos6 .

* run the container cdat-centos6, using image cdat-centos6 to create it, mounting the
important folders. For instance ~/projects has all the CDAT
recipes. This gives you a prompt in RedHat 6 docker.
>>> docker run -it -v ~/projects/:/root/projects -v ~/anaconda3:/home/danlipsa/anaconda3 --name cdat-centos6 cdat-centos6

* Work with centos6

* exit the container
>>> exit

* start the container after exit
>>> docker container start cdat-centos6

* connect to the container
>>> docker exec -it cdat-centos6 /bin/bash
86 changes: 58 additions & 28 deletions vtk-cdat/build.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,61 @@
#!/bin/bash

mkdir build
cd build
cd build || exit

BUILD_CONFIG=Release
OSNAME=`uname`
OSNAME=$(uname)

# Use bash "Remove Largest Suffix Pattern" to get rid of all but major version number
PYTHON_MAJOR_VERSION=${PY_VER%%.*}

# These will help cmake find the right python
PYTHON_H_FILE=$(find "$PREFIX" -name Python.h -type f)
PYTHON_INCLUDE_DIR=$(dirname "${PYTHON_H_FILE}")
if [ "${OSNAME}" == Darwin ]; then
PYTHON_LIBRARY=$(find "$PREFIX/lib" -regex '.*libpython.*\..*\.dylib$')
elif [ "${OSNAME}" == Linux ]; then
PYTHON_LIBRARY=$(find "$PREFIX/lib" -regex '.*libpython.*\..*\.so$')
fi
PYTHON_INCLUDE_PARAMETER_NAME="Python${PYTHON_MAJOR_VERSION}_INCLUDE_DIR"
PYTHON_LIBRARY_PARAMETER_NAME="Python${PYTHON_MAJOR_VERSION}_LIBRARY_RELEASE"
if [ "${OSNAME}" == Darwin ]; then
CONDA_BUILD_SYSROOT=/opt/MacOSX10.9.sdk
fi

if [ -f "$PREFIX/lib/libOSMesa32${SHLIB_EXT}" ]; then
VTK_ARGS="${VTK_ARGS} \
-DVTK_USE_OFFSCREEN:BOOL=ON \
-DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=ON \
-DVTK_OPENGL_HAS_OSMESA:BOOL=ON \
-DOSMESA_INCLUDE_DIR:PATH=${PREFIX}/include \
-DOSMESA_LIBRARY:FILEPATH=${PREFIX}/lib/libOSMesa32${SHLIB_EXT}"

if [ ${OSNAME} == Linux ]; then
if [ "${OSNAME}" == Linux ]; then
VTK_ARGS="${VTK_ARGS} \
-DCMAKE_CXX_STANDARD_LIBRARIES:PATH=${PREFIX}/lib/libstdc++.so \
-DCMAKE_TOOLCHAIN_FILE=${RECIPE_DIR}/cross-linux.cmake
-DVTK_USE_X:BOOL=OFF"
elif [ ${OSNAME} == Darwin ]; then
elif [ "${OSNAME}" == Darwin ]; then
VTK_ARGS="${VTK_ARGS} \
-DVTK_USE_CARBON:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=OFF"
-DVTK_USE_COCOA:BOOL=OFF \
-DCMAKE_OSX_SYSROOT:PATH=${CONDA_BUILD_SYSROOT}"
fi
else
VTK_ARGS="${VTK_ARGS} \
-DVTK_USE_OFFSCREEN:BOOL=OFF \
-DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=OFF \
-DVTK_OPENGL_HAS_OSMESA:BOOL=OFF"
if [ ${OSNAME} == Linux ]; then
if [ "${OSNAME}" == Linux ]; then
VTK_ARGS="${VTK_ARGS} \
-DVTK_USE_X:BOOL=ON"
elif [ ${OSNAME} == Darwin ]; then
-DVTK_USE_X:BOOL=ON \
-DCMAKE_TOOLCHAIN_FILE=${RECIPE_DIR}/cross-linux.cmake
-DOPENGL_gl_LIBRARY:FILEPATH=${BUILD_PREFIX}/${HOST}/sysroot/usr/lib64/libGL.so
-DX11_Xt_LIB:PATH=${BUILD_PREFIX}/${HOST}/sysroot/usr/lib64/libXt.so
-DX11_SM_LIB:PATH=${BUILD_PREFIX}/${HOST}/sysroot/usr/lib64/libSM.so
-DX11_ICE_LIB:PATH=${BUILD_PREFIX}/${HOST}/sysroot/usr/lib64/libICE.so
-DX11_X11_LIB:PATH=${BUILD_PREFIX}/${HOST}/sysroot/usr/lib64/libX11.so"
elif [ "${OSNAME}" == Darwin ]; then
VTK_ARGS="${VTK_ARGS} \
-DVTK_USE_CARBON:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=ON"
-DVTK_USE_COCOA:BOOL=ON \
-DCMAKE_OSX_SYSROOT:PATH=${CONDA_BUILD_SYSROOT}"
fi
fi

Expand All @@ -44,21 +67,28 @@ cmake .. -G "Ninja" \
-DCMAKE_INSTALL_PREFIX:PATH="${PREFIX}" \
-DCMAKE_INSTALL_LIBDIR:PATH="lib" \
-DCMAKE_INSTALL_RPATH:PATH="${PREFIX}/lib" \
-DBUILD_DOCUMENTATION:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DBUILD_EXAMPLES:BOOL=OFF \
-DVTK_BUILD_DOCUMENTATION:BOOL=OFF \
-DVTK_BUILD_TESTING:STRING=OFF \
-DVTK_BUILD_EXAMPLES:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DVTK_WRAP_PYTHON:BOOL=ON \
-DModule_vtkPythonInterpreter:BOOL=OFF \
-DVTK_PYTHON_VERSION:STRING="${PY_VER}" \
-DVTK_LEGACY_SILENT:BOOL=OFF \
-DVTK_HAS_FEENABLEEXCEPT:BOOL=OFF \
-DModule_vtkRenderingMatplotlib=ON \
-DVTK_Group_Web:BOOL=ON \
-DVTK_LEGACY_SILENT:BOOL=ON \
-DModule_vtkIOFFMPEG:BOOL=ON \
-DModule_vtkViewsCore:BOOL=ON \
-DModule_vtkViewsGeovis:BOOL=ON \
${VTK_ARGS}
-DVTK_WRAP_PYTHON:BOOL=ON \
-DVTK_PYTHON_VERSION:STRING="${PYTHON_MAJOR_VERSION}" \
"-D${PYTHON_INCLUDE_PARAMETER_NAME}:PATH=${PYTHON_INCLUDE_DIR}" \
"-D${PYTHON_LIBRARY_PARAMETER_NAME}:FILEPATH=${PYTHON_LIBRARY}" \
-DVTK_MODULE_ENABLE_VTK_PythonInterpreter:STRING=NO \
-DVTK_MODULE_ENABLE_VTK_RenderingFreeType:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_RenderingMatplotlib:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_IOFFMPEG:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_ViewsCore:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_ViewsContext2D:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_PythonContext2D:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_RenderingContext2D:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_RenderingCore:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_RenderingOpenGL2:STRING=YES \
${VTK_ARGS} # we need word spliting here

# compile & install!
# compile and install
ninja install
13 changes: 5 additions & 8 deletions vtk-cdat/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
python:
- 3.6
- 2.7
pin_run_as_build:
python: x.x

ffmpeg:
- 4.0.*
pin_run_as_build:
ffmpeg: x.x

numpy:
- 1.14
python: x.x.x

VTK_WITH_OSMESA:
- False
- True

CONDA_BUILD_SYSROOT:
- /opt/MacOSX10.9.sdk # [osx]

16 changes: 16 additions & 0 deletions vtk-cdat/cross-linux.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(CMAKE_SYSTEM_NAME ${CMAKE_HOST_NAME})
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})

# specify the cross compiler
set(CMAKE_C_COMPILER $ENV{CC})
set(CMAKE_CXX_COMPILER $ENV{CXX})

# where is the target environment
set(CMAKE_FIND_ROOT_PATH "$ENV{PREFIX};$ENV{BUILD_PREFIX}/$ENV{HOST}/sysroot")
set(CMAKE_SYSROOT $ENV{BUILD_PREFIX}/$ENV{HOST}/sysroot)

# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
13 changes: 13 additions & 0 deletions vtk-cdat/enable-python-optional-link.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Utilities/Python/CMakeLists.txt b/Utilities/Python/CMakeLists.txt
index 632069bc0d..44e4371b1a 100644
--- a/Utilities/Python/CMakeLists.txt
+++ b/Utilities/Python/CMakeLists.txt
@@ -147,7 +147,7 @@ cmake_dependent_option(VTK_PYTHON_OPTIONAL_LINK
# `target_link_options`.
# XXX(Linux): Currently, this causes missing symbols on Linux in ParaView.
# More investigation is necessary.
- "FALSE;BUILD_SHARED_LIBS;COMMAND target_link_options" OFF)
+ "BUILD_SHARED_LIBS;COMMAND target_link_options" OFF)

add_library(PythonUsed INTERFACE)
add_library(VTK::PythonUsed ALIAS PythonUsed)
38 changes: 33 additions & 5 deletions vtk-cdat/meta.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package:
version: {{ environ['GIT_DESCRIBE_TAG'][1:] ~ "." ~ environ['GIT_DESCRIBE_NUMBER']}}.@VERSION@

source:
patches:
- enable-python-optional-link.patch
git_branch: master
git_url: https://gitlab.kitware.com/vtk/vtk.git

Expand All @@ -13,21 +15,48 @@ build:
features:
- mesalib # [VTK_WITH_OSMESA]


requirements:
build:
- toolchain
- {{ compiler('cxx') }} # clang 4.0.1, gcc 7.3.0
- cmake
- ninja

- {{ cdt("mesa-libgl-devel") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("mesa-libgl") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("mesa-dri-drivers") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("xorg-x11-proto-devel") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("xorg-x11-util-macros") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("xorg-x11-server-common") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libXdamage") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libxext-devel") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libxext") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libXfixes") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libx11") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libx11-common") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libx11-devel") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libxt") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libxt-devel") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libxtst") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libxtst-devel") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libXxf86vm") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libsm") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libsm-devel") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libice") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libice-devel") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libuuid") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libxcb") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libxau") }} # [linux and not VTK_WITH_OSMESA]
- {{ cdt("libselinux") }} # [linux and not VTK_WITH_OSMESA]

host:
- python {{python}}
- numpy
- ffmpeg {{ffmpeg}}
- ffmpeg
# needed by ffmpeg for nice videos
- x264
- mesalib # [VTK_WITH_OSMESA]

run:
- toolchain
- python
- numpy
- future
Expand All @@ -39,7 +68,6 @@ requirements:
test:
imports:
- vtk
- vtk.vtkCommonCore

about:
home: http://www.vtk.org/
Expand Down