Commit 4e1a98b3 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

vtkIOExportPDF: update to the new module system

parent c5d62dfe
# Find the GhostScript executable for GL2PS tests.
find_program(VTK_GHOSTSCRIPT_EXECUTABLE gs gswin32c gsos2)
mark_as_advanced(VTK_GHOSTSCRIPT_EXECUTABLE)
# Like the above, but only tests PDF (instead of always PS and maybe PDF).
function(vtk_add_pdf_test_cxx)
set(tests ${ARGN})
foreach(test ${tests})
string(REGEX REPLACE ",.*" "" testsrc "${test}")
get_filename_component(TName ${testsrc} NAME_WE)
# Convert pdf to png
add_test(NAME ${_vtk_build_test}Cxx-${TName}-RasterizePDFToPNG
COMMAND ${CMAKE_COMMAND}
"-DPDFFILE=${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}.pdf"
"-DPDFPNGFILE=${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}-rasterPDF.png"
"-DGS_EXECUTABLE=${VTK_GHOSTSCRIPT_EXECUTABLE}"
-DREMOVEPDF=1
-DRASTERIZE_PDF=1
-P "${vtkTestingPDF_SOURCE_DIR}/RasterizePostScript.cmake"
)
set_tests_properties("${_vtk_build_test}Cxx-${TName}-RasterizePDFToPNG"
PROPERTIES
DEPENDS "${_vtk_build_test}Cxx-${TName}"
REQUIRED_FILES
"${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}.pdf"
LABELS "${_vtk_build_test_labels}"
)
get_filename_component(TName ${test} NAME_WE)
if(${${TName}Error})
set(_error_threshold ${${TName}Error})
else()
set(_error_threshold 15)
endif()
# Image diff rasterized png produced from a PS with baseline
ExternalData_add_test(VTKData
NAME ${_vtk_build_test}Cxx-${TName}-VerifyRasterizedPDFPNG
COMMAND "vtkRenderingGL2PSOpenGL2CxxTests" PNGCompare
-D "${_vtk_build_TEST_DATA_DIRECTORY}"
-T "${_vtk_build_TEST_OUTPUT_DIRECTORY}"
-E "${_error_threshold}"
-V "DATA{../Data/Baseline/${TName}-rasterPDFRef.png,:}"
--test-file "${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}-rasterPDF.png"
)
set_tests_properties("${_vtk_build_test}Cxx-${TName}-VerifyRasterizedPDFPNG"
PROPERTIES
DEPENDS "${_vtk_build_test}Cxx-${TName}-RasterizePDFToPNG"
REQUIRED_FILES
"${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}-rasterPDF.png"
LABELS "${_vtk_build_test_labels}"
)
endforeach()
endfunction()
set(vtkTestingPDF_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}")
include(vtkObjectFactory)
vtk_object_factory_configure("${vtk_module_overrides}")
set(classes
vtkPDFContextDevice2D
vtkPDFExporter)
set(Module_SRCS
vtkPDFContextDevice2D.cxx
vtkPDFExporter.cxx
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx
)
vtk_object_factory_declare(
BASE vtkContextDevice2D
OVERRIDE vtkPDFContextDevice2D)
vtk_module_library(${vtk-module} ${Module_SRCS})
vtk_object_factory_configure(
SOURCE_FILE vtk_object_factory_source
HEADER_FILE vtk_object_factory_header
EXPORT_MACRO "VTKIOEXPORTPDF_EXPORT")
vtk_module_add_module(VTK::IOExportPDF
CLASSES ${classes}
SOURCES ${vtk_object_factory_source}
PRIVATE_HEADERS ${vtk_object_factory_header})
include(../../../../CMake/vtkGhostscript.cmake)
if(VTK_GHOSTSCRIPT_EXECUTABLE)
set(PDFTests
TestPDFContextExport.cxx,NO_DATA
......@@ -13,6 +15,6 @@ if(VTK_GHOSTSCRIPT_EXECUTABLE)
RENDERING_FACTORY
)
include(vtkTestingGL2PS)
include(../../../../CMake/vtkTestingPDF.cmake)
vtk_add_pdf_test_cxx(${PDFTests})
endif()
vtk_module(vtkIOExportPDF
GROUPS
Rendering
IMPLEMENTS
vtkIOExport
TEST_DEPENDS
vtkChartsCore
vtkTestingRendering
vtkRenderingContextOpenGL2
vtkViewsContext2D
DEPENDS
vtkIOExport
PRIVATE_DEPENDS
vtkCommonCore
vtkImagingCore
vtklibharu
)
NAME
VTK::IOExportPDF
LIBRARY_NAME
vtkIOExportPDF
GROUPS
Rendering
IMPLEMENTS
VTK::IOExport
DEPENDS
VTK::IOExport
PRIVATE_DEPENDS
VTK::CommonCore
VTK::ImagingCore
VTK::libharu
TEST_DEPENDS
VTK::ChartsCore
VTK::FiltersModeling
VTK::ImagingCore
VTK::RenderingContextOpenGL2
VTK::TestingRendering
VTK::ViewsContext2D
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment