mirror of
https://github.com/ScrelliCopter/tmx2gba.git
synced 2025-02-21 03:29:25 +11:00
first crack at making bundled dependencies optional
This commit is contained in:
@@ -25,7 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef USE_EXTLIBS
|
||||
#ifndef USE_ZLIB
|
||||
#include "miniz.h"
|
||||
#else
|
||||
#include <zlib.h>
|
||||
@@ -63,7 +63,7 @@ bool tmx::decompress(const char* source, std::vector<unsigned char>& dest, std::
|
||||
//to be incorrect in miniz. This is fine for zlib
|
||||
//compressed data, but gzip compressed streams
|
||||
//will fail to inflate.
|
||||
#ifdef USE_EXTLIBS
|
||||
#ifdef USE_ZLIB
|
||||
if (inflateInit2(&stream, 15 + 32) != Z_OK)
|
||||
#else
|
||||
if (inflateInit(&stream) != Z_OK)
|
||||
|
||||
@@ -25,11 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
#include <tmxlite/ImageLayer.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
@@ -25,11 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
#include <tmxlite/LayerGroup.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/ObjectGroup.hpp>
|
||||
|
||||
@@ -25,11 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
#include <tmxlite/Map.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/ObjectGroup.hpp>
|
||||
|
||||
@@ -25,11 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
#include <tmxlite/Object.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/Map.hpp>
|
||||
|
||||
@@ -25,11 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/ObjectGroup.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
@@ -24,11 +24,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/ObjectTypes.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
@@ -25,11 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
#include <tmxlite/Property.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
|
||||
@@ -25,12 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#include <zstd.h>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef USE_ZSTD
|
||||
#include <zstd.h>
|
||||
@@ -135,7 +130,7 @@ void TileLayer::parseBase64(const pugi::xml_node& node)
|
||||
byteData.insert(byteData.end(), dataString.begin(), dataString.end());
|
||||
break;
|
||||
case CompressionType::Zstd:
|
||||
#if defined USE_ZSTD || defined USE_EXTLIBS
|
||||
#if defined USE_ZSTD
|
||||
{
|
||||
std::size_t dataSize = dataString.length() * sizeof(unsigned char);
|
||||
std::size_t result = ZSTD_decompress(byteData.data(), expectedSize, &dataString[0], dataSize);
|
||||
@@ -148,12 +143,12 @@ void TileLayer::parseBase64(const pugi::xml_node& node)
|
||||
}
|
||||
break;
|
||||
#else
|
||||
Logger::log("Library must be built with USE_EXTLIBS or USE_ZSTD for Zstd compression", Logger::Type::Error);
|
||||
Logger::log("Library must be built with USE_ZSTD for Zstd compression", Logger::Type::Error);
|
||||
return {};
|
||||
#endif
|
||||
case CompressionType::GZip:
|
||||
#ifndef USE_EXTLIBS
|
||||
Logger::log("Library must be built with USE_EXTLIBS for GZip compression", Logger::Type::Error);
|
||||
#ifndef USE_ZLIB
|
||||
Logger::log("Library must be built with USE_ZLIB for GZip compression", Logger::Type::Error);
|
||||
return {};
|
||||
#endif
|
||||
//[[fallthrough]];
|
||||
|
||||
@@ -25,11 +25,7 @@ and must not be misrepresented as being the original software.
|
||||
source distribution.
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef USE_EXTLIBS
|
||||
#include <pugixml.hpp>
|
||||
#else
|
||||
#include "detail/pugixml.hpp"
|
||||
#endif
|
||||
#include <tmxlite/Tileset.hpp>
|
||||
#include <tmxlite/FreeFuncs.hpp>
|
||||
#include <tmxlite/detail/Log.hpp>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#include <pugixml.hpp>
|
||||
Reference in New Issue
Block a user