From f27d638e0ab8d05a2f77e4773abff528065d490d Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 26 Aug 2024 19:02:23 -0600 Subject: [PATCH] CMake: Always use a target for linking skia --- Meta/CMake/skia.cmake | 11 +++++++---- Userland/Libraries/LibGfx/CMakeLists.txt | 6 +++--- Userland/Libraries/LibWeb/CMakeLists.txt | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Meta/CMake/skia.cmake b/Meta/CMake/skia.cmake index 81ea7732813..0506d3fa77f 100644 --- a/Meta/CMake/skia.cmake +++ b/Meta/CMake/skia.cmake @@ -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}) diff --git a/Userland/Libraries/LibGfx/CMakeLists.txt b/Userland/Libraries/LibGfx/CMakeLists.txt index 6662c923486..f7adeb8e0cc 100644 --- a/Userland/Libraries/LibGfx/CMakeLists.txt +++ b/Userland/Libraries/LibGfx/CMakeLists.txt @@ -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}) diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 42a67b025b3..9a67a714c9f 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -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)