2018-12-18 04:09:44 +08:00
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
|
|
message(WARNING "You will need to install Xorg dependencies to build vtk:\napt-get install libxt-dev\n")
|
|
|
|
endif()
|
|
|
|
|
2017-01-12 18:03:02 +08:00
|
|
|
include(vcpkg_common_functions)
|
|
|
|
|
2019-03-15 05:38:47 +08:00
|
|
|
set(VTK_SHORT_VERSION "8.2")
|
2018-01-09 15:22:21 +08:00
|
|
|
set(VTK_LONG_VERSION "${VTK_SHORT_VERSION}.0")
|
2017-08-28 16:48:30 +08:00
|
|
|
# =============================================================================
|
2018-01-05 00:57:30 +08:00
|
|
|
# Options:
|
2017-11-02 04:20:00 +08:00
|
|
|
|
|
|
|
if ("qt" IN_LIST FEATURES)
|
2018-01-05 00:57:30 +08:00
|
|
|
set(VTK_WITH_QT ON )
|
2017-11-02 04:20:00 +08:00
|
|
|
else()
|
2018-01-05 00:57:30 +08:00
|
|
|
set(VTK_WITH_QT OFF )
|
2017-11-02 04:20:00 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if ("mpi" IN_LIST FEATURES)
|
2019-04-03 17:16:30 +08:00
|
|
|
set(VTK_Group_MPI ON)
|
2017-11-02 04:20:00 +08:00
|
|
|
else()
|
2019-04-03 17:16:30 +08:00
|
|
|
set(VTK_Group_MPI OFF)
|
2017-11-02 04:20:00 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if ("python" IN_LIST FEATURES)
|
2018-01-05 00:57:30 +08:00
|
|
|
set(VTK_WITH_PYTHON ON)
|
2017-11-02 04:20:00 +08:00
|
|
|
else()
|
2018-01-05 00:57:30 +08:00
|
|
|
set(VTK_WITH_PYTHON OFF)
|
2017-11-02 04:20:00 +08:00
|
|
|
endif()
|
2017-11-09 07:33:29 +08:00
|
|
|
|
2017-11-02 04:20:00 +08:00
|
|
|
if("openvr" IN_LIST FEATURES)
|
2019-04-03 17:16:30 +08:00
|
|
|
set(Module_vtkRenderingOpenVR ON)
|
2017-11-02 04:20:00 +08:00
|
|
|
else()
|
2019-04-03 17:16:30 +08:00
|
|
|
set(Module_vtkRenderingOpenVR OFF)
|
2017-11-07 02:35:12 +08:00
|
|
|
endif()
|
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
set(VTK_WITH_ALL_MODULES OFF) # IMPORTANT: if ON make sure `qt5`, `mpi`, `python3`, `ffmpeg`, `gdal`, `fontconfig`,
|
|
|
|
# `libmysql` and `atlmfc` are listed as dependency in the CONTROL file
|
2018-10-26 02:47:58 +08:00
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
# =============================================================================
|
2018-10-26 02:47:58 +08:00
|
|
|
# Clone & patch
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
2019-04-03 17:16:30 +08:00
|
|
|
REPO Kitware/VTK
|
2018-10-26 02:47:58 +08:00
|
|
|
REF "v${VTK_LONG_VERSION}"
|
2019-03-15 05:38:47 +08:00
|
|
|
SHA512 fd1d9c2872baa6eca7f8105b0057b56ec554e9d5eaf25985302e7fc032bdce72255d79e3f5f16ca50504151bda49cb3a148272ba32e0f410b4bdb70959b8f3f4
|
2019-04-03 20:52:27 +08:00
|
|
|
HEAD_REF master
|
2017-08-08 23:56:09 +08:00
|
|
|
PATCHES
|
2018-11-09 02:46:25 +08:00
|
|
|
fix-find-lz4.patch
|
2019-03-15 05:38:47 +08:00
|
|
|
fix_ogg_linkage.patch
|
2019-04-03 17:16:30 +08:00
|
|
|
fix-pugixml-link.patch
|
2017-08-08 23:56:09 +08:00
|
|
|
)
|
2019-04-03 17:16:30 +08:00
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
# Remove the FindGLEW.cmake and FindPythonLibs.cmake that are distributed with VTK,
|
|
|
|
# since they do not detect the debug libraries correctly.
|
|
|
|
# The default files distributed with CMake (>= 3.9) should be superior by all means.
|
|
|
|
# For GDAL, the one distributed with CMake does not detect the debug libraries correctly,
|
|
|
|
# so we provide an own one.
|
2017-08-11 00:20:40 +08:00
|
|
|
file(REMOVE ${SOURCE_PATH}/CMake/FindGLEW.cmake)
|
2017-08-28 16:48:30 +08:00
|
|
|
file(REMOVE ${SOURCE_PATH}/CMake/FindPythonLibs.cmake)
|
|
|
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindGDAL.cmake DESTINATION ${SOURCE_PATH}/CMake)
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
# Collect CMake options for optional components
|
|
|
|
if(VTK_WITH_QT)
|
|
|
|
list(APPEND ADDITIONAL_OPTIONS
|
|
|
|
-DVTK_Group_Qt=ON
|
|
|
|
-DVTK_QT_VERSION=5
|
|
|
|
-DVTK_BUILD_QT_DESIGNER_PLUGIN=OFF
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VTK_WITH_PYTHON)
|
|
|
|
list(APPEND ADDITIONAL_OPTIONS
|
|
|
|
-DVTK_WRAP_PYTHON=ON
|
|
|
|
-DVTK_PYTHON_VERSION=3
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VTK_WITH_ALL_MODULES)
|
|
|
|
list(APPEND ADDITIONAL_OPTIONS
|
|
|
|
-DVTK_BUILD_ALL_MODULES=ON
|
|
|
|
-DVTK_USE_TK=OFF # TCL/TK currently not included in vcpkg
|
|
|
|
# -DVTK_USE_SYSTEM_AUTOBAHN=ON
|
|
|
|
# -DVTK_USE_SYSTEM_SIX=ON
|
|
|
|
# -DVTK_USE_SYSTEM_MPI4PY=ON
|
|
|
|
# -DVTK_USE_SYSTEM_CONSTANTLY=ON
|
|
|
|
# -DVTK_USE_SYSTEM_INCREMENTAL=ON
|
|
|
|
# -DVTK_USE_SYSTEM_TWISTED=ON
|
|
|
|
# -DVTK_USE_SYSTEM_XDMF2=ON
|
|
|
|
# -DVTK_USE_SYSTEM_XDMF3=ON
|
|
|
|
# -DVTK_USE_SYSTEM_ZFP=ON
|
|
|
|
# -DVTK_USE_SYSTEM_ZOPE=ON
|
|
|
|
)
|
|
|
|
endif()
|
2017-08-11 00:20:40 +08:00
|
|
|
|
2019-03-19 03:33:45 +08:00
|
|
|
if(NOT VCPKG_CMAKE_SYSTEM_NAME)
|
|
|
|
set(Module_vtkGUISupportMFC ON)
|
|
|
|
else()
|
|
|
|
set(Module_vtkGUISupportMFC OFF)
|
|
|
|
endif()
|
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
# =============================================================================
|
|
|
|
# Configure & Install
|
2019-03-15 05:38:47 +08:00
|
|
|
|
2017-01-12 18:03:02 +08:00
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2017-02-28 21:45:42 +08:00
|
|
|
PREFER_NINJA
|
2017-01-12 18:03:02 +08:00
|
|
|
OPTIONS
|
|
|
|
-DBUILD_TESTING=OFF
|
2017-02-28 21:45:42 +08:00
|
|
|
-DBUILD_EXAMPLES=OFF
|
2017-08-11 16:17:32 +08:00
|
|
|
-DVTK_INSTALL_INCLUDE_DIR=include
|
2017-01-12 18:03:02 +08:00
|
|
|
-DVTK_INSTALL_DATA_DIR=share/vtk/data
|
|
|
|
-DVTK_INSTALL_DOC_DIR=share/vtk/doc
|
|
|
|
-DVTK_INSTALL_PACKAGE_DIR=share/vtk
|
2019-02-22 03:47:54 +08:00
|
|
|
-DVTK_INSTALL_RUNTIME_DIR=bin
|
2017-02-28 21:45:42 +08:00
|
|
|
-DVTK_FORBID_DOWNLOADS=ON
|
2019-04-03 17:16:30 +08:00
|
|
|
|
|
|
|
# We set all libraries to "system" and explicitly list the ones that should use embedded copies
|
|
|
|
-DVTK_USE_SYSTEM_LIBRARIES=ON
|
|
|
|
-DVTK_USE_SYSTEM_GL2PS=OFF
|
|
|
|
|
|
|
|
# Select modules / groups to install
|
|
|
|
-DVTK_Group_Imaging=ON
|
|
|
|
-DVTK_Group_Views=ON
|
2019-03-19 03:33:45 +08:00
|
|
|
-DModule_vtkGUISupportMFC=${Module_vtkGUISupportMFC}
|
2019-04-03 17:16:30 +08:00
|
|
|
-DModule_vtkRenderingOpenVR=${Module_vtkRenderingOpenVR}
|
|
|
|
-DVTK_Group_MPI=${VTK_Group_MPI}
|
|
|
|
|
2017-01-12 18:03:02 +08:00
|
|
|
${ADDITIONAL_OPTIONS}
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
# =============================================================================
|
|
|
|
# Fixup target files
|
2017-08-10 17:56:23 +08:00
|
|
|
vcpkg_fixup_cmake_targets()
|
2017-01-12 18:03:02 +08:00
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
# For some reason the references to the XDMF libraries in the target files do not end up
|
|
|
|
# correctly, so we fix them here.
|
|
|
|
if(VTK_WITH_ALL_MODULES)
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake VTK_TARGETS_RELEASE_CONTENT)
|
|
|
|
string(REPLACE "lib/../XdmfCore.lib" "lib/XdmfCore.lib" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
|
|
|
|
string(REPLACE "bin/../XdmfCore.dll" "bin/XdmfCore.dll" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
|
|
|
|
string(REPLACE "lib/../vtkxdmf3.lib" "lib/vtkxdmf3.lib" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
|
|
|
|
string(REPLACE "bin/../vtkxdmf3.dll" "bin/vtkxdmf3.dll" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake "${VTK_TARGETS_RELEASE_CONTENT}")
|
|
|
|
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake VTK_TARGETS_DEBUG_CONTENT)
|
|
|
|
string(REPLACE "lib/../XdmfCore.lib" "lib/XdmfCore.lib" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
|
|
|
|
string(REPLACE "bin/../XdmfCore.dll" "bin/XdmfCore.dll" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
|
|
|
|
string(REPLACE "lib/../vtkxdmf3.lib" "lib/vtkxdmf3.lib" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
|
|
|
|
string(REPLACE "bin/../vtkxdmf3.dll" "bin/vtkxdmf3.dll" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake "${VTK_TARGETS_DEBUG_CONTENT}")
|
|
|
|
endif()
|
|
|
|
|
2019-03-15 05:38:47 +08:00
|
|
|
#file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" VTK_TARGETS_CONTENT)
|
2019-03-01 15:53:42 +08:00
|
|
|
# Remove unset of _IMPORT_PREFIX in VTKTargets.cmake
|
2019-03-15 05:38:47 +08:00
|
|
|
#_IMPORT_PREFIX is required by vtkModules due to vcpkg_fixup_cmake_targets changing all cmake files (to use _IMPORT_PREFIX).
|
|
|
|
#STRING(REPLACE [[set(_IMPORT_PREFIX)]]
|
|
|
|
#[[
|
2019-03-01 15:53:42 +08:00
|
|
|
# VCPKG: The value of _IMPORT_PREFIX should not be unset.
|
|
|
|
#set(_IMPORT_PREFIX)
|
2019-03-15 05:38:47 +08:00
|
|
|
#]]
|
|
|
|
#VTK_TARGETS_CONTENT "${VTK_TARGETS_CONTENT}")
|
|
|
|
#file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" "${VTK_TARGETS_CONTENT}")
|
2019-03-01 15:53:42 +08:00
|
|
|
|
2019-03-15 05:38:47 +08:00
|
|
|
#file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" VTK_TARGETS_CONTENT)
|
2017-08-10 23:05:43 +08:00
|
|
|
|
2019-03-15 05:38:47 +08:00
|
|
|
# Fix _IMPORT_PREFIX. It is not set within the Modules cmake (only set in VTKTargets.cmake).
|
|
|
|
# Since for VCPKG _IMPORT_PREFIX == VTK_INSTALL_PREFIX we just replace it with that.
|
|
|
|
file(GLOB_RECURSE CMAKE_FILES ${CURRENT_PACKAGES_DIR}/share/vtk/Modules/*.cmake)
|
2018-10-26 02:47:58 +08:00
|
|
|
foreach(FILE IN LISTS CMAKE_FILES)
|
|
|
|
file(READ "${FILE}" _contents)
|
2019-03-15 05:38:47 +08:00
|
|
|
string(REPLACE "\${_IMPORT_PREFIX}" "\${VTK_INSTALL_PREFIX}" _contents "${_contents}")
|
2018-10-26 02:47:58 +08:00
|
|
|
file(WRITE "${FILE}" "${_contents}")
|
|
|
|
endforeach()
|
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
# =============================================================================
|
2018-04-30 22:02:11 +08:00
|
|
|
# Clean-up other directories
|
2017-01-12 18:03:02 +08:00
|
|
|
|
2019-02-22 03:47:54 +08:00
|
|
|
# Delete the debug binary TOOL_NAME that is not required
|
|
|
|
function(_vtk_remove_debug_tool TOOL_NAME)
|
|
|
|
# on windows, the tools end with .exe
|
|
|
|
set(filename_win ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME}.exe)
|
|
|
|
if(EXISTS ${filename_win})
|
|
|
|
file(REMOVE ${filename_win})
|
|
|
|
endif()
|
|
|
|
# on other OS, it doesn't
|
|
|
|
set(filename_unix ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME})
|
|
|
|
if(EXISTS ${filename_unix})
|
|
|
|
file(REMOVE ${filename_unix})
|
|
|
|
endif()
|
|
|
|
# we also have to bend the lines referencing the tools in VTKTargets-debug.cmake
|
|
|
|
# to make them point to the release version of the tools
|
|
|
|
file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake" VTK_TARGETS_CONTENT_DEBUG)
|
|
|
|
string(REPLACE "debug/bin/${TOOL_NAME}" "tools/vtk/${TOOL_NAME}" VTK_TARGETS_CONTENT_DEBUG "${VTK_TARGETS_CONTENT_DEBUG}")
|
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake" "${VTK_TARGETS_CONTENT_DEBUG}")
|
|
|
|
endfunction()
|
2017-08-28 16:48:30 +08:00
|
|
|
|
2019-02-22 03:47:54 +08:00
|
|
|
# Move the release binary TOOL_NAME from bin to tools
|
|
|
|
function(_vtk_move_release_tool TOOL_NAME)
|
|
|
|
# on windows, the tools end with .exe
|
|
|
|
set(old_filename_win "${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}.exe")
|
|
|
|
if(EXISTS ${old_filename_win})
|
|
|
|
file(INSTALL ${old_filename_win} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/vtk")
|
|
|
|
file(REMOVE ${old_filename_win})
|
2018-04-30 22:02:11 +08:00
|
|
|
endif()
|
2019-02-22 03:47:54 +08:00
|
|
|
# on other OS, it doesn't
|
|
|
|
set(old_filename_unix "${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}")
|
|
|
|
if(EXISTS ${old_filename_unix})
|
|
|
|
file(INSTALL ${old_filename_unix} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/vtk")
|
|
|
|
file(REMOVE ${old_filename_unix})
|
|
|
|
endif()
|
|
|
|
# we also have to bend the lines referencing the tools in VTKTargets-release.cmake
|
|
|
|
# to make them point to the tool folder
|
|
|
|
file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake" VTK_TARGETS_CONTENT_RELEASE)
|
|
|
|
string(REPLACE "bin/${TOOL_NAME}" "tools/vtk/${TOOL_NAME}" VTK_TARGETS_CONTENT_RELEASE "${VTK_TARGETS_CONTENT_RELEASE}")
|
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake" "${VTK_TARGETS_CONTENT_RELEASE}")
|
2017-08-28 16:48:30 +08:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
set(VTK_TOOLS
|
|
|
|
vtkEncodeString-${VTK_SHORT_VERSION}
|
|
|
|
vtkHashSource-${VTK_SHORT_VERSION}
|
|
|
|
vtkWrapTclInit-${VTK_SHORT_VERSION}
|
|
|
|
vtkWrapTcl-${VTK_SHORT_VERSION}
|
|
|
|
vtkWrapPythonInit-${VTK_SHORT_VERSION}
|
|
|
|
vtkWrapPython-${VTK_SHORT_VERSION}
|
|
|
|
vtkWrapJava-${VTK_SHORT_VERSION}
|
|
|
|
vtkWrapHierarchy-${VTK_SHORT_VERSION}
|
|
|
|
vtkParseJava-${VTK_SHORT_VERSION}
|
|
|
|
vtkParseOGLExt-${VTK_SHORT_VERSION}
|
|
|
|
vtkpython
|
|
|
|
pvtkpython
|
|
|
|
)
|
|
|
|
|
2019-02-22 03:47:54 +08:00
|
|
|
foreach(TOOL_NAME IN LISTS VTK_TOOLS)
|
|
|
|
_vtk_remove_debug_tool("${TOOL_NAME}")
|
|
|
|
_vtk_move_release_tool("${TOOL_NAME}")
|
|
|
|
endforeach()
|
|
|
|
|
2017-11-10 17:23:10 +08:00
|
|
|
file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/Modules/vtkhdf5.cmake" _contents)
|
|
|
|
string(REPLACE "vtk::hdf5::hdf5_hl" "" _contents "${_contents}")
|
|
|
|
string(REPLACE "vtk::hdf5::hdf5" "" _contents "${_contents}")
|
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/Modules/vtkhdf5.cmake" "${_contents}")
|
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
# =============================================================================
|
|
|
|
# Remove other files and directories that are not valid for vcpkg
|
|
|
|
if(VTK_WITH_ALL_MODULES)
|
|
|
|
file(REMOVE ${CURRENT_PACKAGES_DIR}/XdmfConfig.cmake)
|
|
|
|
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/XdmfConfig.cmake)
|
|
|
|
endif()
|
|
|
|
|
2019-04-03 17:16:30 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
2017-08-06 17:37:27 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
|
|
|
|
endif()
|
2017-01-12 18:03:02 +08:00
|
|
|
|
2017-08-10 17:56:23 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
|
|
|
|
2017-08-28 16:48:30 +08:00
|
|
|
# =============================================================================
|
2017-01-12 18:03:02 +08:00
|
|
|
# Handle copyright
|
|
|
|
file(COPY ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/vtk/Copyright.txt ${CURRENT_PACKAGES_DIR}/share/vtk/copyright)
|
2019-02-22 03:47:54 +08:00
|
|
|
|
|
|
|
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/vtk)
|