mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibGfx: Use a diffrent way for finding libjxl on Android
When trying to use pkgconfig for finding libjxl, the build fails trying to link the cross-compiler's libc++. Using this way libjxl also requires hwy library. Findlibjxl.cmake was taken from SDL_image and altered to include its license.
This commit is contained in:
parent
a7a136f30a
commit
873e576da2
Notes:
github-actions[bot]
2024-09-03 06:18:54 +00:00
Author: https://github.com/Olekoop Commit: https://github.com/LadybirdBrowser/ladybird/commit/873e576da2d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1006 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/AtkinsSJ
2 changed files with 62 additions and 2 deletions
52
Meta/CMake/Findlibjxl.cmake
Normal file
52
Meta/CMake/Findlibjxl.cmake
Normal file
|
@ -0,0 +1,52 @@
|
|||
|
||||
# SDL_image: An example image loading library for use with SDL
|
||||
# Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
#
|
||||
# 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()
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue