From 9cd66c83ef7dd1ec4787bf3d7f3c4f44c9e18f42 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Thu, 23 May 2024 10:55:39 +0900 Subject: [PATCH] Android: Build with libwebp Fixes https://github.com/kichikuou/xsystem35-sdl2/issues/46. --- CMakeLists.txt | 2 ++ android/app/jni/CMakeLists.txt | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9050088..254ab8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,8 @@ elseif (ANDROID) find_library(ndk_zlib z) add_library(zlib INTERFACE) set_target_properties(zlib PROPERTIES INTERFACE_LINK_LIBRARIES ${ndk_zlib}) + set(HAVE_WEBP 1) + add_library(WebP ALIAS webp) else() # non-emscripten, non-android if (WIN32) diff --git a/android/app/jni/CMakeLists.txt b/android/app/jni/CMakeLists.txt index 3a99d09..16edb54 100644 --- a/android/app/jni/CMakeLists.txt +++ b/android/app/jni/CMakeLists.txt @@ -33,9 +33,26 @@ set(SDL2MIXER_WAVPACK OFF CACHE BOOL "Enable WavPack music" FORCE) set(SDL2MIXER_SAMPLES OFF CACHE BOOL "Build the SDL2_mixer sample program(s)" FORCE) set(SDL2MIXER_INSTALL OFF CACHE BOOL "Enable SDL2_mixer install target" FORCE) -FetchContent_MakeAvailable(SDL) -FetchContent_MakeAvailable(SDL_ttf) -FetchContent_MakeAvailable(SDL_mixer) +FetchContent_MakeAvailable(SDL SDL_ttf SDL_mixer) + +# libwebp +FetchContent_Declare( + libwebp + URL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.4.0.tar.gz + URL_HASH SHA1=0b1c8bea200caaa010182609dbaaa91aec69b64d +) +set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "Build animation utilities." FORCE) +set(WEBP_BUILD_CWEBP OFF CACHE BOOL "Build the cwebp command line tool." FORCE) +set(WEBP_BUILD_DWEBP OFF CACHE BOOL "Build the dwebp command line tool." FORCE) +set(WEBP_BUILD_GIF2WEBP OFF CACHE BOOL "Build the gif2webp conversion tool." FORCE) +set(WEBP_BUILD_IMG2WEBP OFF CACHE BOOL "Build the img2webp animation tool." FORCE) +set(WEBP_BUILD_VWEBP OFF CACHE BOOL "Build the vwebp viewer tool." FORCE) +set(WEBP_BUILD_WEBPINFO OFF CACHE BOOL "Build the webpinfo command line tool." FORCE) +set(WEBP_BUILD_LIBWEBPMUX OFF CACHE BOOL "Build the libwebpmux library." FORCE) +set(WEBP_BUILD_WEBPMUX OFF CACHE BOOL "Build the webpmux command line tool." FORCE) +set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "Build extras." FORCE) +set(WEBP_BUILD_WEBP_JS OFF CACHE BOOL "Emscripten build of webp.js." OFORCE) +FetchContent_MakeAvailable(libwebp) # The main CMakeLists.txt of xsystem35 add_subdirectory(${PROJECT_ROOT_DIR} xsystem35)