diff --git a/Meta/CMake/Findlibjxl.cmake b/Meta/CMake/Findlibjxl.cmake new file mode 100644 index 00000000000..d46176ca3b3 --- /dev/null +++ b/Meta/CMake/Findlibjxl.cmake @@ -0,0 +1,52 @@ + +# SDL_image: An example image loading library for use with SDL +# Copyright (C) 1997-2024 Sam Lantinga +# +# This software is provided 'as-is', without any express or implied +# warranty. In no event will the authors be held liable for any damages +# arising from the use of this software. +# +# Permission is granted to anyone to use this software for any purpose, +# including commercial applications, and to alter it and redistribute it +# freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not +# claim that you wrote the original software. If you use this software +# in a product, an acknowledgment in the product documentation would be +# appreciated but is not required. +# 2. Altered source versions must be plainly marked as such, and must not be +# misrepresented as being the original software. +# 3. This notice may not be removed or altered from any source distribution. + +include(FindPackageHandleStandardArgs) + +find_library(libjxl_LIBRARY + NAMES jxl +) + +find_path(libjxl_INCLUDE_PATH + NAMES jxl/decode.h +) + +set(libjxl_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of libjxl") + +set(libjxl_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of libjxl") + +set(libjxl_LINK_FLAGS "" CACHE STRING "Extra link flags of libjxl") + +find_package_handle_standard_args(libjxl + REQUIRED_VARS libjxl_LIBRARY libjxl_INCLUDE_PATH +) + +if (libjxl_FOUND) + if (NOT TARGET libjxl::libjxl) + add_library(libjxl::libjxl UNKNOWN IMPORTED) + set_target_properties(libjxl::libjxl PROPERTIES + IMPORTED_LOCATION "${libjxl_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${libjxl_INCLUDE_PATH}" + INTERFACE_COMPILE_OPTIONS "${libjxl_COMPILE_OPTIONS}" + INTERFACE_LINK_LIBRARIES "${libjxl_LINK_LIBRARIES}" + INTERFACE_LINK_FLAGS "${libjxl_LINK_FLAGS}" + ) + endif() +endif() diff --git a/Userland/Libraries/LibGfx/CMakeLists.txt b/Userland/Libraries/LibGfx/CMakeLists.txt index 060f09c5617..511a3ad55b9 100644 --- a/Userland/Libraries/LibGfx/CMakeLists.txt +++ b/Userland/Libraries/LibGfx/CMakeLists.txt @@ -108,12 +108,20 @@ find_package(JPEG REQUIRED) find_package(PNG REQUIRED) find_package(LIBAVIF REQUIRED) find_package(WebP REQUIRED) -pkg_check_modules(Jxl REQUIRED IMPORTED_TARGET libjxl) find_package(harfbuzz REQUIRED) -target_link_libraries(LibGfx PRIVATE PkgConfig::WOFF2 JPEG::JPEG PkgConfig::Jxl PNG::PNG avif WebP::webp WebP::webpdecoder +target_link_libraries(LibGfx PRIVATE PkgConfig::WOFF2 JPEG::JPEG PNG::PNG avif WebP::webp WebP::webpdecoder WebP::webpdemux WebP::libwebpmux skia harfbuzz) +if (NOT ANDROID) + pkg_check_modules(Jxl REQUIRED IMPORTED_TARGET libjxl) + target_link_libraries(LibGfx PRIVATE PkgConfig::Jxl) +else() + find_package(libjxl REQUIRED) + find_package(hwy REQUIRED) + target_link_libraries(LibGfx PRIVATE libjxl::libjxl hwy::hwy) +endif() + if (ENABLE_SWIFT) generate_clang_module_map(LibGfx GENERATED_FILES ${generated_headers}) target_sources(LibGfx PRIVATE