Skip to content

Commit

Permalink
thorvg: Disable webp loader if corresponding module is disabled
Browse files Browse the repository at this point in the history
Fixes #91873.
  • Loading branch information
akien-mga committed May 13, 2024
1 parent c6f1f61 commit 831ebda
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
14 changes: 10 additions & 4 deletions modules/svg/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ thirdparty_sources = [
"src/loaders/raw/tvgRawLoader.cpp",
# image loaders
"src/loaders/external_png/tvgPngLoader.cpp",
"src/loaders/external_webp/tvgWebpLoader.cpp",
"src/loaders/jpg/tvgJpgd.cpp",
"src/loaders/jpg/tvgJpgLoader.cpp",
# renderer common
Expand Down Expand Up @@ -59,6 +58,10 @@ thirdparty_sources = [
"src/renderer/sw_engine/tvgSwStroke.cpp",
]

if env["module_webp_enabled"]:
thirdparty_sources += ["src/loaders/external_webp/tvgWebpLoader.cpp"]
env_svg.Append(CPPDEFINES=["THORVG_WEBP_LOADER_SUPPORT"])

thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]

env_svg.Prepend(CPPPATH=[thirdparty_dir + "inc"])
Expand All @@ -76,12 +79,15 @@ env_thirdparty.Prepend(
thirdparty_dir + "src/renderer/sw_engine",
thirdparty_dir + "src/loaders/raw",
thirdparty_dir + "src/loaders/external_png",
thirdparty_dir + "src/loaders/external_webp",
thirdparty_dir + "src/loaders/jpg",
"#thirdparty/libpng",
"#thirdparty/libwebp/src",
]
)
if env["builtin_libpng"]:
env_thirdparty.Prepend(CPPPATH=["#thirdparty/libpng"])
if env["module_webp_enabled"]:
env_thirdparty.Prepend(CPPPATH=[thirdparty_dir + "src/loaders/external_webp"])
if env["builtin_libwebp"]:
env_thirdparty.Prepend(CPPPATH=["#thirdparty/libwebp/src"])

env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
env.modules_sources += thirdparty_obj
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/thorvg/inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#define THORVG_SVG_LOADER_SUPPORT
#define THORVG_PNG_LOADER_SUPPORT
#define THORVG_JPG_LOADER_SUPPORT
#define THORVG_WEBP_LOADER_SUPPORT
#define THORVG_THREAD_SUPPORT

// Added conditionally if webp module is enabled.
//#define THORVG_WEBP_LOADER_SUPPORT

// For internal debugging:
//#define THORVG_LOG_ENABLED

Expand Down
4 changes: 3 additions & 1 deletion thirdparty/thorvg/update-thorvg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ cat << EOF > ../inc/config.h
#define THORVG_SVG_LOADER_SUPPORT
#define THORVG_PNG_LOADER_SUPPORT
#define THORVG_JPG_LOADER_SUPPORT
#define THORVG_WEBP_LOADER_SUPPORT
#define THORVG_THREAD_SUPPORT
// Added conditionally if webp module is enabled.
//#define THORVG_WEBP_LOADER_SUPPORT
// For internal debugging:
//#define THORVG_LOG_ENABLED
Expand Down

0 comments on commit 831ebda

Please sign in to comment.