From 8dbd0eb7fe5466763792390cc5635d48a28d731f Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Thu, 5 Jan 2023 13:21:23 +0100 Subject: [PATCH] [cmake] Build VTK statically as external dependency for easy packaging. Fixes #3354. --- MeshLib/IO/VtkIO/VtuInterface-impl.h | 2 ++ scripts/cmake/DependenciesExternalProject.cmake | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/MeshLib/IO/VtkIO/VtuInterface-impl.h b/MeshLib/IO/VtkIO/VtuInterface-impl.h index a14e4cf93ea..5b0a3df7043 100644 --- a/MeshLib/IO/VtkIO/VtuInterface-impl.h +++ b/MeshLib/IO/VtkIO/VtuInterface-impl.h @@ -82,6 +82,7 @@ bool VtuInterface::writeVTU(std::string const& file_name, vtuWriter->SetFileName(file_name.c_str()); +#ifdef USE_PETSC if constexpr (std::is_same_v<UnstructuredGridWriter, vtkXMLPUnstructuredGridWriter>) { @@ -103,6 +104,7 @@ bool VtuInterface::writeVTU(std::string const& file_name, vtuWriter->SetStartPiece(rank); vtuWriter->SetEndPiece(rank); } +#endif #ifdef VTK_USE_64BIT_IDS vtuWriter->SetHeaderTypeToUInt64(); diff --git a/scripts/cmake/DependenciesExternalProject.cmake b/scripts/cmake/DependenciesExternalProject.cmake index b4ed6349b5b..9d3f4de6d25 100644 --- a/scripts/cmake/DependenciesExternalProject.cmake +++ b/scripts/cmake/DependenciesExternalProject.cmake @@ -57,7 +57,6 @@ if(OGS_USE_MFRONT) "ExternalProject_Add(): added package TFEL@rliv-${ogs.minimum_version.tfel-rliv}" ) set(TFELHOME ${PROJECT_BINARY_DIR}/_ext/TFEL CACHE PATH "" FORCE) - set(_EXT_LIBS ${_EXT_LIBS} TFEL CACHE INTERNAL "") endif() endif() @@ -249,7 +248,6 @@ if(NOT HDF5_FOUND) STATUS "ExternalProject_Add(): added package HDF5@${ogs.tested_version.hdf5}" ) - set(_EXT_LIBS ${_EXT_LIBS} HDF5 CACHE INTERNAL "") BuildExternalProject_find_package(HDF5) endif() @@ -278,9 +276,8 @@ foreach(option_index ${ogs.libraries.vtk.options}) endforeach() list(REMOVE_DUPLICATES VTK_OPTIONS) -# Setting shared libs on PETSc, otherwise pvtu files only contain one -# <Piece>-element (one subdomain). -list(APPEND VTK_OPTIONS "-DBUILD_SHARED_LIBS=${OGS_USE_PETSC}" +# Setting static libs for easier packaging. +list(APPEND VTK_OPTIONS "-DBUILD_SHARED_LIBS=OFF" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" ) message(STATUS "VTK_OPTIONS: ${VTK_OPTIONS}") @@ -329,7 +326,6 @@ if(NOT VTK_FOUND) STATUS "ExternalProject_Add(): added package VTK@${ogs.minimum_version.vtk}" ) - set(_EXT_LIBS ${_EXT_LIBS} VTK CACHE INTERNAL "") BuildExternalProject_find_package(VTK) endif() -- GitLab