From 32751e09ac1313baa4d22a4098c8dd03ba6a1741 Mon Sep 17 00:00:00 2001 From: Leon Krause Date: Tue, 27 Nov 2018 18:14:54 +0100 Subject: [PATCH] Build squish decompression in runtime --- modules/squish/config.py | 2 +- modules/squish/image_compress_squish.cpp | 4 ++-- modules/squish/image_compress_squish.h | 2 ++ modules/squish/register_types.cpp | 7 ++----- modules/squish/register_types.h | 2 -- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/squish/config.py b/modules/squish/config.py index 098f1eafa9e..1c8cd12a2dc 100644 --- a/modules/squish/config.py +++ b/modules/squish/config.py @@ -1,5 +1,5 @@ def can_build(env, platform): - return env['tools'] + return True def configure(env): pass diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index a08ac7bd28e..4161a0f6ae6 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -30,8 +30,6 @@ #include "image_compress_squish.h" -#include "core/print_string.h" - #include void image_decompress_squish(Image *p_image) { @@ -76,6 +74,7 @@ void image_decompress_squish(Image *p_image) { p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } +#ifdef TOOLS_ENABLED void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source) { if (p_image->get_format() >= Image::FORMAT_DXT1) @@ -204,3 +203,4 @@ void image_compress_squish(Image *p_image, float p_lossy_quality, Image::Compres p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } } +#endif diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h index dfebdc955f0..dd53f2787a6 100644 --- a/modules/squish/image_compress_squish.h +++ b/modules/squish/image_compress_squish.h @@ -33,7 +33,9 @@ #include "core/image.h" +#ifdef TOOLS_ENABLED void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source); +#endif void image_decompress_squish(Image *p_image); #endif // IMAGE_COMPRESS_SQUISH_H diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp index d4ed676cce3..9a5bb47f195 100644 --- a/modules/squish/register_types.cpp +++ b/modules/squish/register_types.cpp @@ -29,17 +29,14 @@ /*************************************************************************/ #include "register_types.h" - -#ifdef TOOLS_ENABLED - #include "image_compress_squish.h" void register_squish_types() { +#ifdef TOOLS_ENABLED Image::set_compress_bc_func(image_compress_squish); +#endif Image::_image_decompress_bc = image_decompress_squish; } void unregister_squish_types() {} - -#endif diff --git a/modules/squish/register_types.h b/modules/squish/register_types.h index 00f5c345c45..9dbd69c46b0 100644 --- a/modules/squish/register_types.h +++ b/modules/squish/register_types.h @@ -28,7 +28,5 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef TOOLS_ENABLED void register_squish_types(); void unregister_squish_types(); -#endif