Use WebP as built-in submodule

This commit is contained in:
Maarten Bent
2025-05-10 17:19:21 +02:00
parent e040b0cd79
commit d408cea7e4
6 changed files with 60 additions and 11 deletions
+4
View File
@@ -38,3 +38,7 @@
path = src/stc/lexilla
url = https://github.com/wxWidgets/lexilla.git
branch = wx
[submodule "3rdparty/libwebp"]
path = 3rdparty/libwebp
url = https://github.com/wxWidgets/libwebp.git
branch = wx
Vendored Submodule
+1
Submodule 3rdparty/libwebp added at 406ef4e955
-8
View File
@@ -359,14 +359,6 @@ if(wxUSE_LIBLZMA)
endif()
endif()
if(wxUSE_LIBWEBP)
find_package(WebP) # TODO: select specific components as soon as upstream-supplied WebPConfig.cmake supports it
if (NOT ${WebP_FOUND})
message(WARNING "libwebp not found, WebP file format will not be supported")
wx_option_force_value(wxUSE_LIBWEBP OFF)
endif()
endif()
if (wxUSE_WEBREQUEST)
if(wxUSE_WEBREQUEST_CURL)
find_package(CURL)
+1 -1
View File
@@ -21,7 +21,7 @@ endif()
# Define third party libraries
set(LIBS_THIRDPARTY regex zlib expat)
if(wxUSE_GUI)
list(APPEND LIBS_THIRDPARTY jpeg png tiff nanosvg)
list(APPEND LIBS_THIRDPARTY jpeg png tiff nanosvg webp)
endif()
foreach(LIB IN LISTS LIBS_THIRDPARTY)
include(${LIB}.cmake)
+53
View File
@@ -0,0 +1,53 @@
#############################################################################
# Name: build/cmake/lib/webp.cmake
# Purpose: Use external or internal libwebp
# Author:
# Created: 2025-01-31
# Copyright: (c) 2025 wxWidgets development team
# Licence: wxWindows licence
#############################################################################
if(wxUSE_LIBWEBP STREQUAL "builtin")
set(WEBP_ROOT "${wxSOURCE_DIR}/3rdparty/libwebp")
set(WEBP_BUILD_ROOT "${CMAKE_CURRENT_BINARY_DIR}/webp-build")
# static library
set(WEBP_LINK_STATIC ON)
# disable tools
set(WEBP_BUILD_ANIM_UTILS OFF)
set(WEBP_BUILD_CWEBP OFF)
set(WEBP_BUILD_DWEBP OFF)
set(WEBP_BUILD_GIF2WEBP OFF)
set(WEBP_BUILD_IMG2WEBP OFF)
set(WEBP_BUILD_VWEBP OFF)
set(WEBP_BUILD_WEBPINFO OFF)
set(WEBP_BUILD_WEBPMUX OFF)
set(WEBP_BUILD_EXTRAS OFF)
set(WEBP_BUILD_WEBP_JS OFF)
set(WEBP_BUILD_FUZZTEST OFF)
add_subdirectory("${WEBP_ROOT}" "${WEBP_BUILD_ROOT}" EXCLUDE_FROM_ALL)
mark_as_advanced(WEBP_BITTRACE)
mark_as_advanced(WEBP_BUILD_LIBWEBPMUX)
mark_as_advanced(WEBP_ENABLE_SIMD)
mark_as_advanced(WEBP_ENABLE_SWAP_16BIT_CSP)
mark_as_advanced(WEBP_ENABLE_WUNUSED_RESULT)
mark_as_advanced(WEBP_LINK_STATIC)
mark_as_advanced(WEBP_NEAR_LOSSLESS)
mark_as_advanced(WEBP_UNICODE)
mark_as_advanced(WEBP_USE_THREAD)
get_property(webpTargets DIRECTORY "${WEBP_ROOT}" PROPERTY BUILDSYSTEM_TARGETS)
foreach(target_name IN LISTS webpTargets)
set_target_properties(${target_name} PROPERTIES
FOLDER "Third Party Libraries/WebP"
OUTPUT_NAME "${target_name}"
)
endforeach()
set(WebP_LIBRARIES webp webpdemux)
elseif(wxUSE_LIBWEBP)
find_package(WebP REQUIRED)
endif()
+1 -2
View File
@@ -129,8 +129,7 @@ wx_add_thirdparty_library(wxUSE_EXPAT EXPAT "use expat for XML parsing" DEFAULT_
wx_add_thirdparty_library(wxUSE_LIBJPEG JPEG "use libjpeg (JPEG file format)")
wx_add_thirdparty_library(wxUSE_LIBPNG PNG "use libpng (PNG image format)")
wx_add_thirdparty_library(wxUSE_LIBTIFF TIFF "use libtiff (TIFF file format)")
wx_option(wxUSE_LIBWEBP "use libwebp (WebP file format)" OFF)
set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBWEBP "use libwebp (WebP file format)")
wx_add_thirdparty_library(wxUSE_LIBWEBP WebP "use libwebp (WebP file format)")
wx_add_thirdparty_library(wxUSE_NANOSVG NanoSVG "use NanoSVG for rasterizing SVG" DEFAULT builtin)
wx_option(wxUSE_LIBLZMA "use LZMA compression" OFF)
set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBLZMA "use liblzma for LZMA compression")