CMake: Always use a target for linking skia

This commit is contained in:
Andrew Kaster 2024-08-26 19:02:23 -06:00 committed by Andrew Kaster
parent e782947a03
commit f27d638e0a
Notes: github-actions[bot] 2024-08-27 23:23:29 +00:00
3 changed files with 11 additions and 8 deletions

View file

@ -1,6 +1,8 @@
include_guard()
find_package(unofficial-skia CONFIG)
if(unofficial-skia_FOUND)
set(SKIA_LIBRARIES unofficial::skia::skia)
set(SKIA_TARGET unofficial::skia::skia)
else()
find_package(PkgConfig)
@ -16,7 +18,8 @@ else()
endif()
endforeach()
pkg_check_modules(SKIA skia=${SKIA_REQUIRED_VERSION} REQUIRED)
include_directories(${SKIA_INCLUDE_DIRS})
link_directories(${SKIA_LIBRARY_DIRS})
pkg_check_modules(skia skia=${SKIA_REQUIRED_VERSION} REQUIRED IMPORTED_TARGET skia)
set(SKIA_TARGET PkgConfig::skia)
endif()
swizzle_target_properties_for_swift(${SKIA_TARGET})
add_library(skia ALIAS ${SKIA_TARGET})

View file

@ -73,8 +73,7 @@ set(SOURCES
serenity_lib(LibGfx gfx)
find_package(harfbuzz REQUIRED)
target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibFileSystem LibRIFF LibTextCodec LibIPC LibUnicode LibURL ${SKIA_LIBRARIES} harfbuzz)
target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibFileSystem LibRIFF LibTextCodec LibIPC LibUnicode LibURL)
set(generated_sources TIFFMetadata.h TIFFTagHandler.cpp)
list(TRANSFORM generated_sources PREPEND "ImageFormats/")
@ -110,9 +109,10 @@ 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
WebP::webpdemux WebP::libwebpmux)
WebP::webpdemux WebP::libwebpmux skia harfbuzz)
if (ENABLE_SWIFT)
generate_clang_module_map(LibGfx GENERATED_FILES ${generated_headers})

View file

@ -786,7 +786,7 @@ set(GENERATED_SOURCES
serenity_lib(LibWeb web)
target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibHTTP LibGfx LibIPC LibRegex LibSyntax LibTextCodec LibUnicode LibAudio LibMedia LibWasm LibXML LibIDL LibURL LibTLS LibRequests ${SKIA_LIBRARIES})
target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibHTTP LibGfx LibIPC LibRegex LibSyntax LibTextCodec LibUnicode LibAudio LibMedia LibWasm LibXML LibIDL LibURL LibTLS LibRequests skia)
generate_js_bindings(LibWeb)