LibWeb: Get skia version constraint from vcpkg.json

This way we only have to update it in one place.
This commit is contained in:
Francesco Gazzetta 2024-07-03 22:17:27 +02:00 committed by Andrew Kaster
parent 543b415b7d
commit 210e6edd9f
Notes: sideshowbarker 2024-07-17 02:55:44 +09:00

View file

@ -761,7 +761,20 @@ if(unofficial-skia_FOUND)
set(SKIA_LIBRARIES unofficial::skia::skia)
else()
find_package(PkgConfig)
pkg_check_modules(SKIA skia=124 REQUIRED)
# 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()