From 42a36671b9968ab59e4788f69a9a1f3cf22f6c25 Mon Sep 17 00:00:00 2001 From: zachlewis Date: Tue, 29 Oct 2024 14:23:58 -0400 Subject: [PATCH] deps: Add build recipe for WebP (#4422) As requested in #4387. --------- Signed-off-by: Zach Lewis Signed-off-by: zachlewis --- src/cmake/build_WebP.cmake | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/cmake/build_WebP.cmake diff --git a/src/cmake/build_WebP.cmake b/src/cmake/build_WebP.cmake new file mode 100644 index 0000000000..a86f99bd69 --- /dev/null +++ b/src/cmake/build_WebP.cmake @@ -0,0 +1,46 @@ +# Copyright Contributors to the OpenImageIO project. +# SPDX-License-Identifier: Apache-2.0 +# https://github.com/AcademySoftwareFoundation/OpenImageIO + +###################################################################### +# WebP by hand! +###################################################################### + +set_cache (WebP_BUILD_VERSION 1.4.0 "WebP version for local builds") +set (WebP_GIT_REPOSITORY "https://github.com/webmproject/libwebp.git") +set (WebP_GIT_TAG "v${WebP_BUILD_VERSION}") + +set_cache (WebP_BUILD_SHARED_LIBS OFF + DOC "Should execute a local WebP build; if necessary, build shared libraries" ADVANCED) + +string (MAKE_C_IDENTIFIER ${WebP_BUILD_VERSION} WebP_VERSION_IDENT) + +build_dependency_with_cmake(WebP + VERSION ${WebP_BUILD_VERSION} + GIT_REPOSITORY ${WebP_GIT_REPOSITORY} + GIT_TAG ${WebP_GIT_TAG} + CMAKE_ARGS + -D BUILD_SHARED_LIBS=${WebP_BUILD_SHARED_LIBS} + -D WEBP_BUILD_ANIM_UTILS=OFF + -D WEBP_BUILD_CWEBP=OFF + -D WEBP_BUILD_DWEBP=OFF + -D WEBP_BUILD_GIF2WEBP=OFF + -D WEBP_BUILD_IMG2WEBP=OFF + -D WEBP_BUILD_VWEBP=OFF + -D WEBP_BUILD_WEBPINFO=OFF + -D WEBP_BUILD_WEBPMUX=OFF + -D WEBP_BUILD_EXTRAS=OFF + -D CMAKE_INSTALL_LIBDIR=lib + ) + +# Set some things up that we'll need for a subsequent find_package to work +set (WebP_ROOT ${WebP_LOCAL_INSTALL_DIR}) + +# Signal to caller that we need to find again at the installed location +set (WebP_REFIND TRUE) +set (WebP_REFIND_VERSION ${WebP_BUILD_VERSION}) +set (WebP_REFIND_ARGS CONFIG) + +if (WebP_BUILD_SHARED_LIBS) + install_local_dependency_libs (WebP WebP) +endif ()