mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 02:25:42 +00:00
turn lodepng into a library
This commit is contained in:
parent
94f0d2f8a5
commit
e925d6d54c
@ -88,7 +88,7 @@ set(sources
|
|||||||
DecodePNG.cxx
|
DecodePNG.cxx
|
||||||
EncodePNG.cxx
|
EncodePNG.cxx
|
||||||
raytracing/Logger.cxx
|
raytracing/Logger.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
# This list of sources has code that uses devices and so might need to be
|
# This list of sources has code that uses devices and so might need to be
|
||||||
# compiled with a device-specific compiler (like CUDA).
|
# compiled with a device-specific compiler (like CUDA).
|
||||||
@ -103,6 +103,7 @@ set(device_sources
|
|||||||
ColorBarAnnotation.cxx
|
ColorBarAnnotation.cxx
|
||||||
ColorLegendAnnotation.cxx
|
ColorLegendAnnotation.cxx
|
||||||
ConnectivityProxy.cxx
|
ConnectivityProxy.cxx
|
||||||
|
DecodePNG.cxx
|
||||||
LineRenderer.cxx
|
LineRenderer.cxx
|
||||||
Mapper.cxx
|
Mapper.cxx
|
||||||
MapperConnectivity.cxx
|
MapperConnectivity.cxx
|
||||||
|
@ -523,7 +523,8 @@ bool Canvas::LoadFont() const
|
|||||||
const std::vector<unsigned char>& rawPNG = Internals->Font.GetRawImageData();
|
const std::vector<unsigned char>& rawPNG = Internals->Font.GetRawImageData();
|
||||||
std::vector<unsigned char> rgba;
|
std::vector<unsigned char> rgba;
|
||||||
unsigned long textureWidth, textureHeight;
|
unsigned long textureWidth, textureHeight;
|
||||||
auto error = DecodePNG(rgba, textureWidth, textureHeight, &rawPNG[0], rawPNG.size());
|
auto error =
|
||||||
|
vtkm::rendering::DecodePNG(rgba, textureWidth, textureHeight, &rawPNG[0], rawPNG.size());
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
#include <vtkm/internal/Configure.h>
|
#include <vtkm/internal/Configure.h>
|
||||||
|
|
||||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||||
#include <vtkm/thirdparty/lodepng/vtkmlodepng/lodepng.cpp>
|
#include <vtkm/thirdparty/lodepng/vtkmlodepng/lodepng.h>
|
||||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
VTKM_THIRDPARTY_POST_INCLUDE
|
||||||
|
|
||||||
namespace vtkm
|
namespace vtkm
|
||||||
{
|
{
|
||||||
|
@ -8,14 +8,13 @@
|
|||||||
// PURPOSE. See the above copyright notice for more information.
|
// PURPOSE. See the above copyright notice for more information.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <vtkm/rendering/WorldAnnotatorGL.h>
|
|
||||||
|
|
||||||
#include <vtkm/Matrix.h>
|
#include <vtkm/Matrix.h>
|
||||||
#include <vtkm/rendering/BitmapFontFactory.h>
|
#include <vtkm/rendering/BitmapFontFactory.h>
|
||||||
#include <vtkm/rendering/Color.h>
|
#include <vtkm/rendering/Color.h>
|
||||||
#include <vtkm/rendering/DecodePNG.h>
|
#include <vtkm/rendering/DecodePNG.h>
|
||||||
#include <vtkm/rendering/MatrixHelpers.h>
|
#include <vtkm/rendering/MatrixHelpers.h>
|
||||||
#include <vtkm/rendering/Scene.h>
|
#include <vtkm/rendering/Scene.h>
|
||||||
|
#include <vtkm/rendering/WorldAnnotatorGL.h>
|
||||||
|
|
||||||
#include <vtkm/rendering/internal/OpenGLHeaders.h>
|
#include <vtkm/rendering/internal/OpenGLHeaders.h>
|
||||||
|
|
||||||
@ -103,7 +102,7 @@ void WorldAnnotatorGL::RenderText(vtkm::Float32 scale,
|
|||||||
const std::vector<unsigned char>& rawpngdata = this->Font.GetRawImageData();
|
const std::vector<unsigned char>& rawpngdata = this->Font.GetRawImageData();
|
||||||
|
|
||||||
std::vector<unsigned char> rgba;
|
std::vector<unsigned char> rgba;
|
||||||
unsigned long width, height;
|
unsigned width, height;
|
||||||
int error = vtkm::rendering::DecodePNG(rgba, width, height, &rawpngdata[0], rawpngdata.size());
|
int error = vtkm::rendering::DecodePNG(rgba, width, height, &rawpngdata[0], rawpngdata.size());
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ set(unit_tests
|
|||||||
UnitTestScalarRenderer.cxx
|
UnitTestScalarRenderer.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
vtkm_unit_tests(SOURCES ${unit_tests} ALL_BACKENDS LIBRARIES vtkm_rendering)
|
vtkm_unit_tests(SOURCES ${unit_tests} ALL_BACKENDS LIBRARIES vtkm_rendering vtkm_lodepng)
|
||||||
|
|
||||||
if(VTKm_ENABLE_GL_CONTEXT)
|
if(VTKm_ENABLE_GL_CONTEXT)
|
||||||
# message(STATUS "rendering testing/glfw needs a FindGLFW")
|
# message(STATUS "rendering testing/glfw needs a FindGLFW")
|
||||||
|
46
vtkm/thirdparty/lodepng/CMakeLists.txt
vendored
46
vtkm/thirdparty/lodepng/CMakeLists.txt
vendored
@ -7,19 +7,41 @@
|
|||||||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
## PURPOSE. See the above copyright notice for more information.
|
## PURPOSE. See the above copyright notice for more information.
|
||||||
##============================================================================
|
##============================================================================
|
||||||
add_library(vtkm_lodepng INTERFACE)
|
set(headers
|
||||||
|
vtkmlodepng/lodepng.h
|
||||||
vtkm_get_kit_name(kit_name kit_dir)
|
)
|
||||||
|
set(sources
|
||||||
|
vtkmlodepng/lodepng.cpp
|
||||||
|
)
|
||||||
|
# vtkm_library(NAME vtkm_lodepng HEADERS ${headers} SOURCES ${sources})
|
||||||
|
add_library(vtkm_lodepng STATIC ${headers} ${sources})
|
||||||
|
if(DEFINED VTKm_CUSTOM_LIBRARY_SUFFIX)
|
||||||
|
set(_lib_suffix "${VTKm_CUSTOM_LIBRARY_SUFFIX}")
|
||||||
|
else()
|
||||||
|
set(_lib_suffix "-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}")
|
||||||
|
endif()
|
||||||
|
set_target_properties(vtkm_lodepng
|
||||||
|
PROPERTIES
|
||||||
|
OUTPUT_NAME "vtkm_lodepng${_lib_suffix}"
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
|
||||||
|
VERSION 1
|
||||||
|
SOVERSION 1
|
||||||
|
)
|
||||||
|
vtkm_generate_export_header(vtkm_lodepng)
|
||||||
target_include_directories(vtkm_lodepng INTERFACE
|
target_include_directories(vtkm_lodepng INTERFACE
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:${VTKm_INSTALL_INCLUDE_DIR}/vtkm/thirdparty/lodepng>)
|
$<INSTALL_INTERFACE:${VTKm_INSTALL_INCLUDE_DIR}/vtkm/thirdparty/lodepng>
|
||||||
|
)
|
||||||
|
install(DIRECTORY vtkmlodepng
|
||||||
|
DESTINATION "${VTKm_INSTALL_INCLUDE_DIR}/vtkm/thirdparty/lodepng"
|
||||||
|
)
|
||||||
|
|
||||||
install(TARGETS vtkm_lodepng
|
install(TARGETS vtkm_lodepng
|
||||||
EXPORT ${VTKm_EXPORT_NAME})
|
EXPORT ${VTKm_EXPORT_NAME}
|
||||||
|
LIBRARY DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||||
## Install headers
|
ARCHIVE DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||||
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
|
RUNTIME DESTINATION ${VTKm_INSTALL_BIN_DIR}
|
||||||
install(DIRECTORY vtkmlodepng
|
COMPONENT libraries
|
||||||
DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${kit_dir}/)
|
)
|
||||||
endif()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user