Files
ladybird/Meta/CMake/skia.cmake
Aliaksandr Kalenik 1bd0871ed8 LibWeb+LibGfx: Use Skia for text rasterization
The main incentive is much better performance. We could have gone a bit
further in optimizing the Skia painter to blit glyphs produced by LibGfx
more efficiently from the glyph atlas, but eventually, we also want Skia
to improve correctness.

This change does not completely replace LibGfx in text handling. It's
still used at all stages, including layout, up until display list
replaying.
2024-07-27 08:18:54 +02:00

23 lines
990 B
CMake

find_package(unofficial-skia CONFIG)
if(unofficial-skia_FOUND)
set(SKIA_LIBRARIES unofficial::skia::skia)
else()
find_package(PkgConfig)
# Get skia version from vcpkg.json
file(READ ${LADYBIRD_SOURCE_DIR}/vcpkg.json VCPKG_DOT_JSON)
string(JSON VCPKG_OVERRIDES_LENGTH LENGTH ${VCPKG_DOT_JSON} overrides)
MATH(EXPR VCPKG_OVERRIDES_END_RANGE "${VCPKG_OVERRIDES_LENGTH}-1")
foreach(IDX RANGE ${VCPKG_OVERRIDES_END_RANGE})
string(JSON VCPKG_OVERRIDE_NAME GET ${VCPKG_DOT_JSON} overrides ${IDX} name)
if(VCPKG_OVERRIDE_NAME STREQUAL "skia")
string(JSON SKIA_REQUIRED_VERSION GET ${VCPKG_DOT_JSON} overrides ${IDX} version)
string(REGEX MATCH "[0-9]+" SKIA_REQUIRED_VERSION ${SKIA_REQUIRED_VERSION})
endif()
endforeach()
pkg_check_modules(SKIA skia=${SKIA_REQUIRED_VERSION} REQUIRED)
target_include_directories(LibWeb PRIVATE ${SKIA_INCLUDE_DIRS})
target_link_directories(LibWeb PRIVATE ${SKIA_LIBRARY_DIRS})
endif()