Commit 513580fb authored by Philip Trettner's avatar Philip Trettner

made lodepng dep internal

parent 0cd83fba
[submodule "extern/lodepng/lodepng"]
path = extern/lodepng/lodepng
url = https://github.com/lvandeve/lodepng
......@@ -10,7 +10,6 @@ set(GLOW_OPENGL_SUPPORT CORE_45 CACHE STRING "Defines the OpenGL version with su
# libs
set(GLOW_USE_OWN_GLAD ON CACHE BOOL "If true, extern/glad is used")
set(GLOW_USE_OWN_LODEPNG ON CACHE BOOL "If true, extern/lodepng is used")
# build options
set(GLOW_LINK_TYPE SHARED CACHE STRING "Defines the build type of libraries (shared is default)")
......@@ -98,6 +97,8 @@ if(NOT MSVC)
endif()
endif()
target_link_libraries(glow PUBLIC pthread)
# gold linker
if(GLOW_USE_GOLD_LINKER)
# WRONG: target_compile_options(glow PUBLIC -fuse-ld=gold )
......@@ -216,12 +217,6 @@ if(GLOW_USE_OWN_GLAD)
target_link_libraries(glow PUBLIC glad)
endif()
# Lodepng
if(GLOW_USE_OWN_LODEPNG)
add_subdirectory(extern/lodepng)
target_link_libraries(glow PRIVATE lodepng)
endif()
# AION
if(GLOW_AUTO_PROFILING)
if (TARGET aion)
......
cmake_minimum_required(VERSION 3.0)
project(lodepng)
add_library(lodepng ${GLOW_LINK_TYPE} lodepng/lodepng.cpp)
target_include_directories(lodepng PUBLIC ./)
if(MSVC)
target_compile_options(lodepng PUBLIC /MP)
else()
target_compile_options(lodepng PRIVATE -Wall -Werror -std=c++11)
endif()
Subproject commit 116f5b2ed7c4a9c6779ae291b79770727cbb11ad
......@@ -4,7 +4,7 @@
#include <glow/common/log.hh>
#include <glow/common/profiling.hh>
#include <lodepng/lodepng.h>
#include <glow/detail/lodepng/lodepng.hh>
using namespace glow;
......@@ -16,13 +16,13 @@ SharedTextureData TextureData::loadWithLodepng(const std::string& filename, std:
unsigned width, height;
// decode
unsigned errCode = lodepng::decode(data, width, height, filename);
unsigned errCode = glow_lodepng::decode(data, width, height, filename);
// if there's an error, display it
if (errCode)
{
error() << "Error loading LodePNG texture data from " << filename;
error() << " decoder error " << errCode << ": " << lodepng_error_text(errCode);
error() << " decoder error " << errCode << ": " << glow_lodepng_error_text(errCode);
return nullptr;
}
......@@ -66,13 +66,13 @@ SharedTextureData TextureData::loadWithLodepng(const unsigned char* rawData, siz
unsigned width, height;
// decode
unsigned errCode = lodepng::decode(data, width, height, rawData, rawDataSize);
unsigned errCode = glow_lodepng::decode(data, width, height, rawData, rawDataSize);
// if there's an error, display it
if (errCode)
{
error() << "Error loading LodePNG texture data from raw data";
error() << " decoder error " << errCode << ": " << lodepng_error_text(errCode);
error() << " decoder error " << errCode << ": " << glow_lodepng_error_text(errCode);
return nullptr;
}
......@@ -127,7 +127,7 @@ void TextureData::saveWithLodepng(TextureData* data, const std::string& filename
switch (surf->getFormat())
{
case GL_RGBA:
lodepng_encode32_file(filename.c_str(), //
glow_lodepng_encode32_file(filename.c_str(), //
(unsigned char const*)surf->getFlippedData().data(), //
surf->getWidth(), //
surf->getHeight());
......@@ -135,14 +135,14 @@ void TextureData::saveWithLodepng(TextureData* data, const std::string& filename
case GL_BGRA:
tmpS = surf->convertTo(GL_RGBA, surf->getType());
lodepng_encode32_file(filename.c_str(), //
glow_lodepng_encode32_file(filename.c_str(), //
(unsigned char const*)tmpS->getFlippedData().data(), //
surf->getWidth(), //
surf->getHeight());
return;
case GL_RGB:
lodepng_encode24_file(filename.c_str(), //
glow_lodepng_encode24_file(filename.c_str(), //
(unsigned char const*)surf->getFlippedData().data(), //
surf->getWidth(), //
surf->getHeight());
......@@ -152,7 +152,7 @@ void TextureData::saveWithLodepng(TextureData* data, const std::string& filename
case GL_RG:
case GL_BGR:
tmpS = surf->convertTo(GL_RGB, surf->getType());
lodepng_encode24_file(filename.c_str(), //
glow_lodepng_encode24_file(filename.c_str(), //
(unsigned char const*)tmpS->getFlippedData().data(), //
surf->getWidth(), //
surf->getHeight());
......
Copyright (c) 2005-2018 Lode Vandevenne
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
This diff is collapsed.
This diff is collapsed.
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