Skip to content

VMTK build against Slicer with VTK 9.5 is not straightforward #477

@chir-set

Description

@chir-set

This patch is needed to build VMTK (a95f3e3) within SlicerVMTK, against VTK 9.5 within Slicer.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d46a7c..4043110 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.12...3.29.1)
+cmake_minimum_required(VERSION 3.3)
 
 project(VMTK)
 
@@ -27,7 +27,7 @@ if(VMTK_WITH_LIBRARY_VERSION)
      )
 endif()
 
-find_package( Python3 COMPONENTS Interpreter )
+find_package( PythonInterp )
 if (NOT VMTK_PYTHON_VERSION)
   set(VMTK_PYTHON_VERSION "python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" CACHE STRING "" FORCE)
 endif ()
@@ -309,17 +309,11 @@ if(VMTK_SCRIPTS_ENABLED)
     ${VMTK_BINARY_DIR}/VMTKConfig.cmake
   @ONLY IMMEDIATE
   )
-  install(FILES ${VMTK_BINARY_DIR}/VMTKConfig.cmake
-    TYPE LIB
-  )
 
   configure_file(
     ${VMTK_SOURCE_DIR}/CMake/VMTKUse.cmake.in
     ${VMTK_BINARY_DIR}/VMTKUse.cmake
   @ONLY IMMEDIATE
   )
-  install(FILES ${VMTK_BINARY_DIR}/VMTKUse.cmake
-    TYPE LIB
-  )
 
 endif()

In brief, it reverses the changes in this file from 6c189dd.

Moreover, the following files must be prevented from being downloaded during the build process:

  • vtkWrapHierarchy.cmake
  • vtkWrapPython.cmake
  • vtkMacroKitPythonWrap.cmake.
diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt
index d58cbdf..b85b4b8 100644
--- a/CMake/CMakeLists.txt
+++ b/CMake/CMakeLists.txt
@@ -17,11 +17,6 @@ foreach(filename IN ITEMS
   set(url "https://raw.githubusercontent.com/Slicer/vtkAddon/${vtkAddon_version}/CMake/${filename}")
   if(NOT EXISTS ${dest_file})
     file(DOWNLOAD ${url} ${dest_file} EXPECTED_HASH SHA256=${expected_hash})
-  else()
-    file(SHA256 ${dest_file} current_hash)
-    if(NOT ${current_hash} STREQUAL ${expected_hash})
-      file(DOWNLOAD ${url} ${dest_file} EXPECTED_HASH SHA256=${expected_hash})
-    endif()
   endif()
 endforeach()

Instead, they must be manually replaced by the same files found in Slicer's build tree. The online versions of these wrappers seem to need an update.

I don't know what is the best solution for a seamless build of SlicerVMTK. PythonInterp is dropped in 6c189dd, but Slicer itself does not seem to use Python3 regarding the find_package() cmake function and VTK 9.5 looks like being friendly to Python3.

FYI, looking forward for a lasting solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions