From 48ed0474e2bc6e165e8dd30740d21536e6d0e40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 18 Feb 2024 18:48:14 +0100 Subject: basis_universal: Unbundle jpgd, use our newer copy --- modules/basis_universal/SCsub | 7 ++++--- modules/basis_universal/config.py | 1 + modules/basis_universal/patches/external-jpgd.patch | 13 +++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 modules/basis_universal/patches/external-jpgd.patch (limited to 'modules/basis_universal') diff --git a/modules/basis_universal/SCsub b/modules/basis_universal/SCsub index 14669847bc..80bfd7e858 100644 --- a/modules/basis_universal/SCsub +++ b/modules/basis_universal/SCsub @@ -28,7 +28,6 @@ encoder_sources = [ "basisu_resample_filters.cpp", "basisu_ssim.cpp", "basisu_uastc_enc.cpp", - "jpgd.cpp", "pvpngreader.cpp", ] encoder_sources = [thirdparty_dir + "encoder/" + file for file in encoder_sources] @@ -36,9 +35,11 @@ transcoder_sources = [thirdparty_dir + "transcoder/basisu_transcoder.cpp"] # Treat Basis headers as system headers to avoid raising warnings. Not supported on MSVC. if not env.msvc: - env_basisu.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path]) + env_basisu.Append( + CPPFLAGS=["-isystem", Dir(thirdparty_dir).path, "-isystem", Dir("#thirdparty/jpeg-compressor").path] + ) else: - env_basisu.Prepend(CPPPATH=[thirdparty_dir]) + env_basisu.Prepend(CPPPATH=[thirdparty_dir, "#thirdparty/jpeg-compressor"]) if env["builtin_zstd"]: env_basisu.Prepend(CPPPATH=["#thirdparty/zstd"]) diff --git a/modules/basis_universal/config.py b/modules/basis_universal/config.py index d22f9454ed..6a67f2c77c 100644 --- a/modules/basis_universal/config.py +++ b/modules/basis_universal/config.py @@ -1,4 +1,5 @@ def can_build(env, platform): + env.module_add_dependencies("basis_universal", ["jpg"]) return True diff --git a/modules/basis_universal/patches/external-jpgd.patch b/modules/basis_universal/patches/external-jpgd.patch new file mode 100644 index 0000000000..7a805d00cb --- /dev/null +++ b/modules/basis_universal/patches/external-jpgd.patch @@ -0,0 +1,13 @@ +diff --git a/thirdparty/basis_universal/encoder/basisu_enc.cpp b/thirdparty/basis_universal/encoder/basisu_enc.cpp +index c431ceaf12..e87dd636a2 100644 +--- a/thirdparty/basis_universal/encoder/basisu_enc.cpp ++++ b/thirdparty/basis_universal/encoder/basisu_enc.cpp +@@ -409,7 +409,7 @@ namespace basisu + bool load_jpg(const char *pFilename, image& img) + { + int width = 0, height = 0, actual_comps = 0; +- uint8_t *pImage_data = jpgd::decompress_jpeg_image_from_file(pFilename, &width, &height, &actual_comps, 4, jpgd::jpeg_decoder::cFlagLinearChromaFiltering); ++ uint8_t *pImage_data = jpgd::decompress_jpeg_image_from_file(pFilename, &width, &height, &actual_comps, 4, jpgd::jpeg_decoder::cFlagBoxChromaFiltering); + if (!pImage_data) + return false; + -- cgit v1.2.3