Commit c5d62dfe authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Ben Boeckel

vtkIOExport: update to the new module system

Also split vtkIOExport into vtkIOExport and vtkIOExportGL2PS.
Remove vtkIOExportOpenGL2 and merged it with vtkIOExportGL2PS.
parent 263726ff
......@@ -92,56 +92,4 @@ function(vtk_add_gl2ps_test_cxx)
endforeach()
endfunction()
# 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-module}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 "${vtkTestingGL2PS_SOURCE_DIR}/RasterizePostScript.cmake"
)
set_tests_properties("${vtk-module}Cxx-${TName}-RasterizePDFToPNG"
PROPERTIES
DEPENDS "${vtk-module}Cxx-${TName}"
REQUIRED_FILES
"${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}.pdf"
LABELS "${${vtk-module}_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-module}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-module}Cxx-${TName}-VerifyRasterizedPDFPNG"
PROPERTIES
DEPENDS "${vtk-module}Cxx-${TName}-RasterizePDFToPNG"
REQUIRED_FILES
"${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}-rasterPDF.png"
LABELS "${${vtk-module}_TEST_LABELS}"
)
endforeach()
endfunction()
set(vtkTestingGL2PS_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}")
set(Module_SRCS
vtkExporter.cxx
vtkGL2PSExporter.cxx
vtkGLTFExporter.cxx
vtkIVExporter.cxx
vtkJSONDataSetWriter.cxx
vtkJSONSceneExporter.cxx
vtkOBJExporter.cxx
vtkOOGLExporter.cxx
vtkPOVExporter.cxx
vtkRIBExporter.cxx
vtkRIBLight.cxx
vtkRIBProperty.cxx
vtkSingleVTPExporter.cxx
vtkSVGContextDevice2D.cxx
vtkSVGExporter.cxx
vtkVRMLExporter.cxx
vtkX3D.cxx
vtkX3DExporter.cxx
vtkX3DExporterFIWriter.cxx
vtkX3DExporterWriter.cxx
vtkX3DExporterXMLWriter.cxx
)
set(classes
vtkExporter
vtkGLTFExporter
vtkIVExporter
vtkJSONDataSetWriter
vtkJSONSceneExporter
vtkOBJExporter
vtkOOGLExporter
vtkPOVExporter
vtkRIBExporter
vtkRIBLight
vtkRIBProperty
vtkSVGContextDevice2D
vtkSVGExporter
vtkSingleVTPExporter
vtkVRMLExporter
vtkX3D
vtkX3DExporter
vtkX3DExporterFIWriter
vtkX3DExporterWriter
vtkX3DExporterXMLWriter)
vtk_module_library(vtkIOExport ${Module_SRCS})
include(vtkOpenGL)
vtk_opengl_link(vtkIOExport)
vtk_module_add_module(VTK::IOExport
CLASSES ${classes})
vtk_module_test_data(
Data/combq.bin
Data/combxyz.bin
Data/earth.ppm
Data/vtk-transparent.png)
add_subdirectory(Cxx)
include(vtkGhostscript)
include(vtkWkHtmlToImage)
include("${CMAKE_CURRENT_LIST_DIR}/vtkWkHtmlToImage.cmake")
if (VTK_WKHTMLTOIMAGE_EXECUTABLE)
set(SVGTests
......@@ -9,34 +8,13 @@ if (VTK_WKHTMLTOIMAGE_EXECUTABLE)
)
endif()
# Only run GL2PS tests if GhostScript is available
if(VTK_GHOSTSCRIPT_EXECUTABLE)
set(GL2PSTests
TestGL2PSBillboardTextActor3D.cxx
TestGL2PSScalarBar.cxx
TestGL2PSTextActor.cxx
TestGL2PSTextActor3D.cxx
TestGL2PSTextMapper.cxx
TestGL2PSLabeledDataMapper.cxx
TestStackedPlotGL2PS.cxx
)
set(GL2PSTestsPDFBothOpenGL
TestGL2PSExporterRaster.cxx
TestGL2PSExporterMultipleRenderers.cxx
TestGL2PSExporterVolumeRaster.cxx
)
set(GL2PSTestsPDF
${GL2PSTestsPDFBothOpenGL}
)
endif()
vtk_add_test_cxx(vtkIOExportCxxTests tests
X3DTest.cxx,NO_DATA,NO_VALID
TestOBJExporter.cxx,NO_DATA,NO_VALID
TestGLTFExporter.cxx,NO_DATA,NO_VALID
TestSingleVTPExporter.cxx,NO_DATA,NO_VALID
${GL2PSTests} ${GL2PSTestsPDF} ${SVGTests}
${SVGTests}
TestRIBExporter.cxx,NO_VALID
UnitTestRIB.cxx,NO_DATA,NO_VALID
)
......@@ -64,18 +42,18 @@ if(RMANTREE)
)
add_test(NAME vtkIOExport-RIBExporterPrman
COMMAND ${RMANTREE}/bin/prman
${VTK_TEST_OUTPUT_DIR}/TestRIBExporter.rib
${_vtk_build_TEST_OUTPUT_DIRECTORY}/TestRIBExporter.rib
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
# Image diff rman generated tif with baseline
set(baseline_dir ${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline)
ExternalData_add_test(VTKData
ExternalData_add_test(${_vtk_build_TEST_DATA_TARGET}
NAME vtkIOExportCxx-ComparePrmanImage
COMMAND ${RMANTREE}/bin/cmptiff -d 100
DATA{${baseline_dir}/TestRIBExporter.tif}
${VTK_TEST_OUTPUT_DIR}/TestRIBExporter.tif
${_vtk_build_TEST_OUTPUT_DIRECTORY}/TestRIBExporter.tif
)
set_tests_properties(vtkIOExport-RIBExporterPrman
set_tests_properties(VTK::IOExport-RIBExporterPrman
PROPERTIES
DEPENDS
"vtkIOExport-TestRIBExporter"
......@@ -84,22 +62,13 @@ if(RMANTREE)
ENVIRONMENT
"RMANTREE=${RMANTREE}"
)
set_tests_properties("vtkIOExportCxx-ComparePrmanImage"
set_tests_properties("VTK::IOExportCxx-ComparePrmanImage"
PROPERTIES
DEPENDS "vtkIOExportCxx-TestRIBExporter"
REQUIRED_FILES
"${VTK_TEST_OUTPUT_DIR}/TestRIBExporter.tif"
"${_vtk_build_TEST_OUTPUT_DIRECTORY}/TestRIBExporter.tif"
)
endif()
set(TestGL2PSExporterVolumeRasterError 50)
include(vtkTestingGL2PS)
# text alignment and rotation with TextAsPath off is not
# yet implemented for the OpenGL2 backend.
vtk_add_gl2ps_test_cxx(${GL2PSTests})
# test postscript and pdf
vtk_add_gl2ps_test_cxx(pdf ${GL2PSTestsPDFBothOpenGL})
include(vtkTestingSVG)
include("${CMAKE_CURRENT_LIST_DIR}/vtkTestingSVG.cmake")
vtk_add_svg_test(${SVGTests})
......@@ -14,7 +14,7 @@ function(vtk_add_svg_test)
get_filename_component(TName ${testsrc} NAME_WE)
# Convert svg to png
add_test(NAME ${vtk-module}Cxx-${TName}-RasterizePNG
add_test(NAME ${_vtk_build_test}Cxx-${TName}-RasterizePNG
COMMAND ${CMAKE_COMMAND}
"-DSVGFILE=${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}.svg"
"-DPNGFILE=${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}-raster.png"
......@@ -22,11 +22,11 @@ function(vtk_add_svg_test)
-DREMOVESVG=1
-P "${vtkTestingSVG_SOURCE_DIR}/RasterizeSVG.cmake"
)
set_tests_properties("${vtk-module}Cxx-${TName}-RasterizePNG"
set_tests_properties("${_vtk_build_test}Cxx-${TName}-RasterizePNG"
PROPERTIES
DEPENDS "${vtk-module}Cxx-${TName}"
DEPENDS "vtkIOExportCxx-${TName}"
REQUIRED_FILES "${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}.svg"
LABELS "${${vtk-module}_TEST_LABELS}"
LABELS "${vtkIOExport_TEST_LABELS}"
)
get_filename_component(TName ${test} NAME_WE)
......@@ -38,7 +38,7 @@ function(vtk_add_svg_test)
# Image diff rasterized png produced from SVG with baseline
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-${TName}-VerifyRasterizedPNG
NAME ${_vtk_build_test}Cxx-${TName}-VerifyRasterizedPNG
COMMAND "vtkRenderingGL2PSOpenGL2CxxTests" PNGCompare
-D "${_vtk_build_TEST_DATA_DIRECTORY}"
-T "${_vtk_build_TEST_OUTPUT_DIRECTORY}"
......@@ -46,11 +46,11 @@ function(vtk_add_svg_test)
-V "DATA{../Data/Baseline/${TName}-rasterRef.png,:}"
--test-file "${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}-raster.png"
)
set_tests_properties("${vtk-module}Cxx-${TName}-VerifyRasterizedPNG"
set_tests_properties("vtkIOExportCxx-${TName}-VerifyRasterizedPNG"
PROPERTIES
DEPENDS "${vtk-module}Cxx-${TName}-RasterizePNG"
DEPENDS "vtkIOExportCxx-${TName}-RasterizePNG"
REQUIRED_FILES "${_vtk_build_TEST_OUTPUT_DIRECTORY}/${TName}-raster.png"
LABELS "${${vtk-module}_TEST_LABELS}"
LABELS "${_vtk_build_test_labels}"
)
endforeach()
endfunction()
......
if(ANDROID OR APPLE_IOS) # No gl2ps on mobile
set(gl2ps_depends)
set(gl2ps_test_depends)
elseif(VTK_RENDERING_BACKEND STREQUAL "OpenGL2")
set(gl2ps_depends vtkRenderingGL2PSOpenGL2)
set(gl2ps_test_depends vtkIOExportOpenGL2)
endif()
vtk_module(vtkIOExport
GROUPS
Rendering
TEST_DEPENDS
vtkCommonColor
vtkChartsCore
vtkInteractionImage
vtkIOParallel
vtkTestingRendering
vtkInteractionStyle
vtkRenderingAnnotation
vtkRenderingContextOpenGL2
vtkRenderingLabel
vtkRenderingVolumeOpenGL2
vtkViewsContext2D
${gl2ps_test_depends}
DEPENDS
${gl2ps_depends}
vtkCommonCore
vtkIOCore
vtkIOImage
vtkIOXML
vtkRenderingContext2D
vtkRenderingCore
vtkRenderingFreeType
PRIVATE_DEPENDS
vtkCommonDataModel
vtkCommonMath
vtkCommonTransforms
vtkFiltersGeometry
vtkIOImage
vtkImagingCore
vtksys
vtkjsoncpp
)
NAME
VTK::IOExport
LIBRARY_NAME
vtkIOExport
KIT
VTK::IO
IMPLEMENTABLE
GROUPS
Rendering
DEPENDS
VTK::CommonCore
VTK::IOCore
VTK::IOImage
VTK::IOXML
VTK::RenderingContext2D
VTK::RenderingCore
VTK::RenderingFreeType
PRIVATE_DEPENDS
VTK::CommonDataModel
VTK::CommonMath
VTK::CommonTransforms
VTK::FiltersGeometry
VTK::IOImage
VTK::ImagingCore
VTK::jsoncpp
VTK::libharu
TEST_DEPENDS
VTK::ChartsCore
VTK::CommonColor
VTK::IOParallel
VTK::InteractionImage
VTK::InteractionStyle
VTK::RenderingAnnotation
VTK::RenderingContextOpenGL2
VTK::RenderingLabel
VTK::RenderingVolumeOpenGL2
VTK::TestingRendering
VTK::ViewsContext2D
set(classes
vtkGL2PSExporter
vtkOpenGLGL2PSExporter
)
vtk_object_factory_declare(
BASE vtkGL2PSExporter
OVERRIDE vtkOpenGLGL2PSExporter)
vtk_object_factory_configure(
SOURCE_FILE vtk_object_factory_source
HEADER_FILE vtk_object_factory_header
EXPORT_MACRO "VTKIOEXPORTGL2PS_EXPORT")
vtk_module_add_module(VTK::IOExportGL2PS
CLASSES ${classes}
SOURCES ${vtk_object_factory_source}
PRIVATE_HEADERS ${vtk_object_factory_header})
include(../../../../CMake/vtkGhostscript.cmake)
# Only run GL2PS tests if GhostScript is available
if(VTK_GHOSTSCRIPT_EXECUTABLE)
set(GL2PSTests
TestGL2PSBillboardTextActor3D.cxx
TestGL2PSContext.cxx # No image export supported in OGL
TestGL2PSLabeledDataMapper.cxx
TestGL2PSScalarBar.cxx
TestGL2PSTextActor3D.cxx
TestGL2PSTextActor.cxx
TestGL2PSTextMapper.cxx
TestStackedPlotGL2PS.cxx
)
set(GL2PSTestsPDFBothOpenGL
TestGL2PSExporterMultipleRenderers.cxx
TestGL2PSExporterRaster.cxx
TestGL2PSExporterVolumeRaster.cxx
)
set(GL2PSTestsPDF
${GL2PSTestsPDFBothOpenGL}
)
vtk_add_test_cxx(vtkIOExportGL2PSCxxTests tests
${GL2PSTests}
${GL2PSTestsPDF}
)
vtk_test_cxx_executable(vtkIOExportGL2PSCxxTests tests RENDERING_FACTORY)
set(TestGL2PSExporterVolumeRasterError 50)
include(../../../../CMake/vtkTestingGL2PS.cmake)
# text alignment and rotation with TextAsPath off is not
# yet implemented for the OpenGL2 backend.
vtk_add_gl2ps_test_cxx(${GL2PSTests})
# test postscript and pdf
vtk_add_gl2ps_test_cxx(pdf ${GL2PSTestsPDFBothOpenGL})
endif()
NAME
VTK::IOExportGL2PS
LIBRARY_NAME
vtkIOExportGL2PS
CONDITION
NOT ANDROID AND NOT APPLE_IOS
IMPLEMENTABLE
IMPLEMENTS
VTK::IOExportGL2PS
GROUPS
Rendering
DEPENDS
VTK::IOExport
VTK::RenderingGL2PSOpenGL2
PRIVATE_DEPENDS
VTK::CommonCore
VTK::CommonDataModel
VTK::ImagingCore
VTK::RenderingCore
VTK::gl2ps
TEST_DEPENDS
VTK::ChartsCore
VTK::CommonColor
VTK::FiltersGeometry
VTK::FiltersModeling
VTK::IOParallel
VTK::IOXML
VTK::ImagingCore
VTK::ImagingHybrid
VTK::RenderingAnnotation
VTK::RenderingContextOpenGL2
VTK::RenderingLabel
VTK::RenderingVolumeOpenGL2
VTK::TestingRendering
VTK::ViewsContext2D
......@@ -77,14 +77,14 @@
#ifndef vtkGL2PSExporter_h
#define vtkGL2PSExporter_h
#include "vtkIOExportModule.h" // For export macro
#include "vtkIOExportGL2PSModule.h" // For export macro
#include "vtkExporter.h"
#include "vtkNew.h" // For vtkNew
class vtkPropCollection;
class VTKIOEXPORT_EXPORT vtkGL2PSExporter : public vtkExporter
class VTKIOEXPORTGL2PS_EXPORT vtkGL2PSExporter : public vtkExporter
{
public:
static vtkGL2PSExporter *New();
......
......@@ -24,12 +24,12 @@
#ifndef vtkOpenGLGL2PSExporter_h
#define vtkOpenGLGL2PSExporter_h
#include "vtkIOExportOpenGL2Module.h" // For export macro
#include "vtkIOExportGL2PSModule.h" // For export macro
#include "vtkGL2PSExporter.h"
class vtkImageData;
class VTKIOEXPORTOPENGL2_EXPORT vtkOpenGLGL2PSExporter: public vtkGL2PSExporter
class VTKIOEXPORTGL2PS_EXPORT vtkOpenGLGL2PSExporter: public vtkGL2PSExporter
{
public:
static vtkOpenGLGL2PSExporter *New();
......
include(vtkObjectFactory)
vtk_add_override(vtkGL2PSExporter vtkOpenGLGL2PSExporter)
vtk_object_factory_configure("${vtk_module_overrides}")
set(Module_SRCS
vtkOpenGLGL2PSExporter.cxx
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx
)
vtk_module_library(${vtk-module} ${Module_SRCS})
include(vtkOpenGL)
vtk_opengl_link(${vtk-module})
include(vtkGhostscript)
include(vtkTestingGL2PS)
set(GL2PSTests)
if(VTK_GHOSTSCRIPT_EXECUTABLE)
set(GL2PSTests
# These tests differ from OpenGL1, hence they're in this submodule.
TestGL2PSContext.cxx # No image export supported in OGL
)
endif()
vtk_add_test_cxx(vtkIOExportOpenGL2CxxTests tests ${GL2PSTests})
# Create rasterize/verify tests to check generated postscript:
vtk_add_gl2ps_test_cxx(${GL2PSTests})
vtk_test_cxx_executable(vtkIOExportOpenGL2CxxTests tests RENDERING_FACTORY)
if(ANDROID OR APPLE_IOS) # No GL2PS on mobile
return()
endif()
vtk_module(vtkIOExportOpenGL2
IMPLEMENTS
vtkIOExport
BACKEND
OpenGL2
IMPLEMENTATION_REQUIRED_BY_BACKEND
TEST_DEPENDS
vtkRenderingContextOpenGL2
vtkTestingRendering
vtkViewsContext2D
DEPENDS
vtkIOExport
vtkRenderingGL2PSOpenGL2
PRIVATE_DEPENDS
vtkCommonCore
vtkCommonDataModel
vtkImagingCore
vtkRenderingCore
vtkgl2ps
)
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