From 305a8b3d44f9a749f01b1d8dbd8944d8c9b26411 Mon Sep 17 00:00:00 2001 From: Xaver K Date: Tue, 6 Oct 2020 15:11:46 +0200 Subject: [PATCH] Fixed CMake file for VTK in dependent projects. --- CMakeLists.txt | 2 +- cmake/ViennaLSConfig.cmake.in | 20 ++++++++++++++++++++ include/lsWriteVisualizationMesh.hpp | 5 +---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2efb65e4..ab76e946 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ if(VIENNALS_USE_VTK) find_package(VTK QUIET) if(VTK_FOUND) message(STATUS "Found VTK") - add_definitions(-DVIENNALS_USE_VTK) + add_compile_definitions(VIENNALS_USE_VTK) include(${VTK_USE_FILE}) # only link needed vtk libraries for static builds if(VIENNALS_STATIC_BUILD) diff --git a/cmake/ViennaLSConfig.cmake.in b/cmake/ViennaLSConfig.cmake.in index fd4abd37..0a2ba1b2 100644 --- a/cmake/ViennaLSConfig.cmake.in +++ b/cmake/ViennaLSConfig.cmake.in @@ -28,6 +28,26 @@ else(ViennaLS_COMMON_TARGET) # include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") endif() +if(@VIENNALS_USE_VTK@) + add_compile_definitions(VIENNALS_USE_VTK) + if(NOT VTK_DIR) + set(VTK_DIR $ENV{VTK_DIR}) + endif(NOT VTK_DIR) + find_package(VTK QUIET) + if(VTK_FOUND) + message(STATUS "Found VTK") + add_compile_definitions(VIENNALS_USE_VTK) + include(${VTK_USE_FILE}) + # only link needed vtk libraries for static builds + if(VIENNALS_STATIC_BUILD) + set(VTK_LIBRARIES vtksys;vtkIOCore;vtkexpat;vtklz4;vtkzlib;vtklzma;vtkdoubleconversion;vtkCommonMisc;vtkCommonSystem;vtkIOXML) + endif(VIENNALS_STATIC_BUILD) + list(APPEND VIENNALS_LIBRARIES ${VTK_LIBRARIES}) + list(APPEND VIENNALS_PYTHON_LIBRARIES ${VTK_LIBRARIES}) + else(VTK_FOUND) + message(STATUS "No VTK install found: Building without VTK.") + endif(VTK_FOUND) +endif() if(@VIENNALS_BUILD_SHARED_LIBS@) option(VIENNALS_USE_SHARED_LIBS "Use precompiled headers" ON) diff --git a/include/lsWriteVisualizationMesh.hpp b/include/lsWriteVisualizationMesh.hpp index 6396095f..520573d4 100644 --- a/include/lsWriteVisualizationMesh.hpp +++ b/include/lsWriteVisualizationMesh.hpp @@ -440,7 +440,7 @@ template class lsWriteVisualizationMesh { lsMessage::getInstance() .addWarning("lsWriteVisualizationMesh: Level Set " + std::to_string(i) + - " must have a width greater than 2! Not converting!") + " should have a width greater than 2! Conversion might fail!") .print(); } } @@ -526,9 +526,6 @@ template class lsWriteVisualizationMesh { if (it->get()->getNumberOfPoints() == 0) continue; // ignore empty levelSets - assert(it->get()->getLevelSetWidth() >= - numLayers); // check if enough information - // create grid of next LS with slight offset and project into current mesh vtkSmartPointer rgrid = vtkSmartPointer::New();