Skip to content

Commit 077dcdc

Browse files
committed
adding vtk to superbuild
1 parent 5c2006a commit 077dcdc

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

Superbuild/Superbuild.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ OPTION(WITH_OSPRAY "Build Ospray." OFF)
105105
# Configure data
106106
OPTION(BUILD_WITH_SCIRUN_DATA "Svn checkout data" OFF)
107107

108+
###########################################
109+
# Configure vtk
110+
OPTION(WITH_VTK "build VTK" ON)
111+
108112
###########################################
109113
# Configure Windows executable to run with
110114
# or without the console
@@ -294,6 +298,10 @@ ENDIF()
294298

295299
ADD_EXTERNAL( ${SUPERBUILD_DIR}/BoostExternal.cmake Boost_external )
296300

301+
IF(WITH_VTK)
302+
ADD_EXTERNAL( ${SUPERBUILD_DIR}/VtkExternal.cmake VTK_external )
303+
ENDIF()
304+
297305
###########################################
298306
# Download external data sources
299307
OPTION(DOWNLOAD_TOOLKITS "Download toolkit repositories." ON)
@@ -320,6 +328,7 @@ SET(SCIRUN_CACHE_ARGS
320328
"-DUSER_PYTHON_VERSION_MINOR:STRING=${USER_PYTHON_VERSION_MINOR}"
321329
"-DWITH_TETGEN:BOOL=${WITH_TETGEN}"
322330
"-DWITH_OSPRAY:BOOL=${WITH_OSPRAY}"
331+
"-DWITH_VTK:BOOL=${WITH_VTK}"
323332
"-DREGENERATE_MODULE_FACTORY_CODE:BOOL=${REGENERATE_MODULE_FACTORY_CODE}"
324333
"-DGENERATE_MODULE_FACTORY_CODE:BOOL=${GENERATE_MODULE_FACTORY_CODE}"
325334
"-DEigen_DIR:PATH=${Eigen_DIR}"
@@ -357,6 +366,12 @@ IF(WITH_OSPRAY)
357366
)
358367
ENDIF()
359368

369+
IF(WITH_VTK)
370+
LIST(APPEND SCIRUN_CACHE_ARGS
371+
"-DVTK_DIR:PATH=${VTK_INSTALL_DIR}/lib/cmake/vtk-9.6"
372+
)
373+
ENDIF()
374+
360375
IF(WIN32)
361376
LIST(APPEND SCIRUN_CACHE_ARGS
362377
"-DSCIRUN_SHOW_CONSOLE:BOOL=${SCIRUN_SHOW_CONSOLE}"

Superbuild/VtkExternal.cmake

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# For more information, please see: http://software.sci.utah.edu
2+
#
3+
# The MIT License
4+
#
5+
# Copyright (c) 2026 Scientific Computing and Imaging Institute,
6+
# University of Utah.
7+
#
8+
#
9+
# Permission is hereby granted, free of charge, to any person obtaining a
10+
# copy of this software and associated documentation files (the "Software"),
11+
# to deal in the Software without restriction, including without limitation
12+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
13+
# and/or sell copies of the Software, and to permit persons to whom the
14+
# Software is furnished to do so, subject to the following conditions:
15+
#
16+
# The above copyright notice and this permission notice shall be included
17+
# in all copies or substantial portions of the Software.
18+
#
19+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25+
# DEALINGS IN THE SOFTWARE.
26+
27+
SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base})
28+
29+
# ---- VTK version ----
30+
set(vtk_GIT_TAG "v9.6.1")
31+
32+
# ---- Dependencies ----
33+
set(vtk_DEPENDENCIES)
34+
LIST(APPEND vtk_DEPENDENCIES
35+
LibPNG_external
36+
Zlib_external
37+
)
38+
39+
# ---- Pull dependency install dirs ----
40+
ExternalProject_Get_Property(Zlib_external INSTALL_DIR)
41+
set(ZLIB_INSTALL_DIR ${INSTALL_DIR})
42+
43+
ExternalProject_Get_Property(LibPNG_external INSTALL_DIR)
44+
set(LIBPNG_INSTALL_DIR ${INSTALL_DIR})
45+
46+
# ---- ExternalProject ----
47+
ExternalProject_Add(VTK_external
48+
DEPENDS ${vtk_DEPENDENCIES}
49+
50+
GIT_REPOSITORY "https://gitlab.kitware.com/vtk/vtk.git"
51+
GIT_TAG ${vtk_GIT_TAG}
52+
53+
GIT_SUBMODULES ""
54+
GIT_SUBMODULES_RECURSE OFF
55+
56+
CMAKE_CACHE_ARGS
57+
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE}
58+
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
59+
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
60+
61+
# ---- Core build options ----
62+
-DBUILD_SHARED_LIBS:BOOL=ON
63+
-DVTK_BUILD_ALL_MODULES:BOOL=OFF
64+
-DVTK_GROUP_ENABLE_StandAlone:STRING=WANT
65+
-DVTK_GROUP_ENABLE_Rendering:STRING=WANT
66+
-DVTK_GROUP_ENABLE_Imaging:STRING=WANT
67+
-DVTK_GROUP_ENABLE_IO:STRING=WANT
68+
69+
# ---- External dependency control ----
70+
-DVTK_MODULE_USE_EXTERNAL_VTK_zlib:BOOL=ON
71+
-DVTK_MODULE_USE_EXTERNAL_VTK_png:BOOL=ON
72+
73+
# ---- Help VTK locate them (minimal first pass) ----
74+
-DZLIB_ROOT:PATH=${ZLIB_INSTALL_DIR}
75+
-DPNG_ROOT:PATH=${LIBPNG_INSTALL_DIR}
76+
77+
# ---- Wrapping ----
78+
-DVTK_WRAP_PYTHON:BOOL=OFF
79+
-DVTK_WRAP_JAVA:BOOL=OFF
80+
81+
# ---- Superbuild hygiene ----
82+
-DVTK_BUILD_TESTING:BOOL=OFF
83+
-DVTK_BUILD_EXAMPLES:BOOL=OFF
84+
85+
# ---- Install ----
86+
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
87+
)
88+
89+
# ---- Export build dir ----
90+
ExternalProject_Get_Property(VTK_external BINARY_DIR)
91+
set(VTK_BUILD_DIR ${BINARY_DIR} CACHE PATH "")
92+
93+
# ---- Export install dir ----
94+
ExternalProject_Get_Property(VTK_external INSTALL_DIR)
95+
set(VTK_INSTALL_DIR ${INSTALL_DIR} CACHE PATH "")
96+
97+
message(STATUS "VTK_BUILD_DIR: ${VTK_BUILD_DIR}")
98+
message(STATUS "VTK_INSTALL_DIR: ${VTK_INSTALL_DIR}")

0 commit comments

Comments
 (0)