aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/skia
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/skia')
-rw-r--r--vcpkg/ports/skia/allow-disabling-lib-dl.patch28
-rwxr-xr-xvcpkg/ports/skia/always-build-pathops.patch12
-rw-r--r--vcpkg/ports/skia/bentleyottmann-build.patch14
-rw-r--r--vcpkg/ports/skia/dawn.patch81
-rw-r--r--vcpkg/ports/skia/disable-msvc-env-setup.patch12
-rw-r--r--vcpkg/ports/skia/dont-use-response-file.patch13
-rw-r--r--vcpkg/ports/skia/example/CMakeLists.txt13
-rw-r--r--vcpkg/ports/skia/fix-bsd.patch48
-rw-r--r--vcpkg/ports/skia/graphite.patch12
-rw-r--r--vcpkg/ports/skia/pdfsubsetfont-uwp.diff12
-rw-r--r--vcpkg/ports/skia/portfile.cmake353
-rw-r--r--vcpkg/ports/skia/remove-directwrite-png-dependency.patch48
-rw-r--r--vcpkg/ports/skia/skia-functions.cmake479
-rw-r--r--vcpkg/ports/skia/skia-include-string.patch13
-rw-r--r--vcpkg/ports/skia/skiaConfig.cmake19
-rw-r--r--vcpkg/ports/skia/skparagraph-dllexport.patch231
-rw-r--r--vcpkg/ports/skia/third-party.gn.in25
-rw-r--r--vcpkg/ports/skia/unofficial-skia-config.cmake44
-rw-r--r--vcpkg/ports/skia/unofficial-skia-targets-details.cmake18
-rw-r--r--vcpkg/ports/skia/unofficial-skia-targets.cmake8
-rw-r--r--vcpkg/ports/skia/usage6
-rw-r--r--vcpkg/ports/skia/use-pkgconfig-to-find-gl.patch15
-rw-r--r--vcpkg/ports/skia/vcpkg.json216
-rw-r--r--vcpkg/ports/skia/vulkan-headers.patch43
24 files changed, 1763 insertions, 0 deletions
diff --git a/vcpkg/ports/skia/allow-disabling-lib-dl.patch b/vcpkg/ports/skia/allow-disabling-lib-dl.patch
new file mode 100644
index 0000000..94cd3e1
--- /dev/null
+++ b/vcpkg/ports/skia/allow-disabling-lib-dl.patch
@@ -0,0 +1,28 @@
+diff --git a/BUILD.gn b/BUILD.gn
+index 306bfffaf8..1632feccd4 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -1740,7 +1740,9 @@ skia_component("skia") {
+ if (is_ios) {
+ sources += [ "src/ports/SkOSFile_ios.h" ]
+ }
+- libs += [ "dl" ]
++ if (skia_vcpkg_has_lib_dl) {
++ libs += [ "dl" ]
++ }
+ }
+
+ if (is_android) {
+diff --git a/gn/skia.gni b/gn/skia.gni
+index bea9cd832a..56a2125ea9 100644
+--- a/gn/skia.gni
++++ b/gn/skia.gni
+@@ -105,6 +105,8 @@ declare_args() {
+ }
+
+ skia_build_rust_targets = false
++
++ skia_vcpkg_has_lib_dl = true
+ }
+
+ declare_args() {
diff --git a/vcpkg/ports/skia/always-build-pathops.patch b/vcpkg/ports/skia/always-build-pathops.patch
new file mode 100755
index 0000000..2a73317
--- /dev/null
+++ b/vcpkg/ports/skia/always-build-pathops.patch
@@ -0,0 +1,12 @@
+diff --git a/BUILD.gn b/BUILD.gn
+index 2a04c9f..8d0e7ec 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -1663,6 +1663,7 @@ skia_component("skia") {
+ ":gpu",
+ ":graphite",
+ ":jpeg_encode",
++ ":pathops",
+ ":pdf",
+ ":pdf_jpeg_helpers",
+ ":webp_encode",
diff --git a/vcpkg/ports/skia/bentleyottmann-build.patch b/vcpkg/ports/skia/bentleyottmann-build.patch
new file mode 100644
index 0000000..c3c48d3
--- /dev/null
+++ b/vcpkg/ports/skia/bentleyottmann-build.patch
@@ -0,0 +1,14 @@
+diff --git a/modules/bentleyottmann/BUILD.gn b/modules/bentleyottmann/BUILD.gn
+index 8a6725592f..40e4ac7bec 100644
+--- a/modules/bentleyottmann/BUILD.gn
++++ b/modules/bentleyottmann/BUILD.gn
+@@ -31,4 +31,9 @@ if (skia_enable_bentleyottmann) {
+ ]
+ }
+ }
++} else {
++ group("bentleyottmann") {
++ }
++ group("tests") {
++ }
+ }
diff --git a/vcpkg/ports/skia/dawn.patch b/vcpkg/ports/skia/dawn.patch
new file mode 100644
index 0000000..30299b9
--- /dev/null
+++ b/vcpkg/ports/skia/dawn.patch
@@ -0,0 +1,81 @@
+diff --git a/BUILD.gn b/BUILD.gn
+index 2698abd9bd..c1ea6741e6 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -9,10 +9,6 @@ import("gn/shared_sources.gni")
+ import("gn/skia.gni")
+ import("gn/toolchain/wasm.gni")
+
+-if (skia_use_dawn) {
+- import("//third_party/externals/dawn/scripts/dawn_features.gni")
+-}
+-
+ if (defined(skia_settings)) {
+ import(skia_settings)
+ }
+@@ -885,30 +881,7 @@ optional("gpu_shared") {
+
+ if (skia_use_dawn) {
+ public_defines += [ "SK_DAWN" ]
+-
+- # When building for WASM, the WebGPU headers are provided by Emscripten. For native builds we
+- # have to depend on Dawn directly.
+- if (!skia_use_webgpu) {
+- public_deps += [
+- "//third_party/externals/dawn/include/dawn:cpp_headers",
+- "//third_party/externals/dawn/src/dawn:cpp",
+- "//third_party/externals/dawn/src/dawn:proc",
+- ]
+-
+- if (dawn_enable_d3d12 || dawn_enable_d3d11 || dawn_enable_desktop_gl ||
+- dawn_enable_metal || dawn_enable_opengles || dawn_enable_vulkan) {
+- public_deps += [ "//third_party/externals/dawn/src/dawn/native" ]
+- }
+- if (dawn_enable_d3d12) {
+- libs += [
+- "d3d12.lib",
+- "dxgi.lib",
+- "d3dcompiler.lib",
+- ]
+- } else if (dawn_enable_metal) {
+- frameworks += [ "Metal.framework" ]
+- }
+- }
++ deps += [ "//third_party/dawn" ]
+ }
+
+ if (skia_use_direct3d) {
+@@ -1958,10 +1931,6 @@ skia_source_set("public_headers_warnings_check") {
+ "modules/skottie",
+ "modules/skshaper",
+ ]
+-
+- if (skia_use_dawn) {
+- deps += [ "//third_party/externals/dawn/include/dawn:headers" ]
+- }
+ }
+
+ # TODO: have each optional provide a target with examples and depend on those.
+@@ -2229,7 +2198,6 @@ if (skia_enable_tools) {
+ sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
+ }
+ if (skia_use_dawn) {
+- public_deps += [ "//third_party/externals/dawn/include/dawn:headers" ]
+ if (is_clang) {
+ cflags_cc = [ "-Wno-microsoft-cast" ]
+ }
+diff --git a/tools/window/BUILD.gn b/tools/window/BUILD.gn
+index 4a30186dbd..c001232b44 100644
+--- a/tools/window/BUILD.gn
++++ b/tools/window/BUILD.gn
+@@ -5,10 +5,6 @@
+
+ import("../../gn/skia.gni")
+
+-if (skia_use_dawn) {
+- import("//third_party/externals/dawn/scripts/dawn_features.gni")
+-}
+-
+ config("public_config") {
+ defines = []
+ include_dirs = [ "." ]
diff --git a/vcpkg/ports/skia/disable-msvc-env-setup.patch b/vcpkg/ports/skia/disable-msvc-env-setup.patch
new file mode 100644
index 0000000..96f99c6
--- /dev/null
+++ b/vcpkg/ports/skia/disable-msvc-env-setup.patch
@@ -0,0 +1,12 @@
+diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
+index 4d4abc952f..5800f30bd9 100644
+--- a/gn/toolchain/BUILD.gn
++++ b/gn/toolchain/BUILD.gn
+@@ -96,6 +96,7 @@ template("msvc_toolchain") {
+ # ARM64 compiler is incomplete - it relies on DLLs located in the host toolchain directory.
+ env_setup = "$shell set \"PATH=%PATH%;$win_vc\\Tools\\MSVC\\$win_toolchain_version\\bin\\HostX64\\x64\" && "
+ }
++ env_setup = "" # overwrite
+
+ cl_m32_flag = ""
+
diff --git a/vcpkg/ports/skia/dont-use-response-file.patch b/vcpkg/ports/skia/dont-use-response-file.patch
new file mode 100644
index 0000000..1ce9bfe
--- /dev/null
+++ b/vcpkg/ports/skia/dont-use-response-file.patch
@@ -0,0 +1,13 @@
+diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
+index 8eace39..67d7b00 100644
+--- a/gn/toolchain/BUILD.gn
++++ b/gn/toolchain/BUILD.gn
+@@ -305,7 +305,7 @@ template("gcc_like_toolchain") {
+ rspfile = "{{output}}.rsp"
+ rspfile_content = "{{inputs}}"
+ rm_py = rebase_path("../rm.py")
+- command = "$shell python3 \"$rm_py\" \"{{output}}\" && $ar rcs {{output}} @$rspfile"
++ command = "$shell python3 \"$rm_py\" \"{{output}}\" && $ar rcs {{output}} `cat $rspfile`"
+ }
+
+ outputs =
diff --git a/vcpkg/ports/skia/example/CMakeLists.txt b/vcpkg/ports/skia/example/CMakeLists.txt
new file mode 100644
index 0000000..109ac5f
--- /dev/null
+++ b/vcpkg/ports/skia/example/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.7)
+
+project(skia-example)
+
+set(CMAKE_CXX_STANDARD 17)
+
+add_executable(legacy convert-to-nia.cpp)
+find_package(skia CONFIG REQUIRED)
+target_link_libraries(legacy PRIVATE skia)
+
+add_executable(main convert-to-nia.cpp)
+find_package(unofficial-skia CONFIG REQUIRED)
+target_link_libraries(main PRIVATE unofficial::skia::skia unofficial::skia::modules::skshaper)
diff --git a/vcpkg/ports/skia/fix-bsd.patch b/vcpkg/ports/skia/fix-bsd.patch
new file mode 100644
index 0000000..56d82a7
--- /dev/null
+++ b/vcpkg/ports/skia/fix-bsd.patch
@@ -0,0 +1,48 @@
+diff --git a/src/gpu/ganesh/GrAutoLocaleSetter.h b/src/gpu/ganesh/GrAutoLocaleSetter.h
+index 13a2ab37f9..96968f6779 100644
+--- a/src/gpu/ganesh/GrAutoLocaleSetter.h
++++ b/src/gpu/ganesh/GrAutoLocaleSetter.h
+@@ -27,7 +27,7 @@
+ #define HAVE_XLOCALE 0
+ #endif
+
+-#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION)
++#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION) || defined(__NetBSD__)
+ #define HAVE_LOCALE_T 0
+ #else
+ #define HAVE_LOCALE_T 1
+diff --git a/src/ports/SkMemory_malloc.cpp b/src/ports/SkMemory_malloc.cpp
+index d784af53ef..8bb21406dd 100644
+--- a/src/ports/SkMemory_malloc.cpp
++++ b/src/ports/SkMemory_malloc.cpp
+@@ -15,7 +15,7 @@
+
+ #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
+ #include <malloc/malloc.h>
+-#elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX)
++#elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+ #include <malloc.h>
+ #elif defined(SK_BUILD_FOR_WIN)
+ #include <malloc.h>
+@@ -126,7 +126,7 @@ size_t sk_malloc_size(void* addr, size_t size) {
+ #elif defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 17
+ completeSize = malloc_usable_size(addr);
+ SkASSERT(completeSize >= size);
+- #elif defined(SK_BUILD_FOR_UNIX)
++ #elif defined(SK_BUILD_FOR_UNIX) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+ completeSize = malloc_usable_size(addr);
+ SkASSERT(completeSize >= size);
+ #elif defined(SK_BUILD_FOR_WIN)
+diff --git a/src/ports/SkOSFile_posix.cpp b/src/ports/SkOSFile_posix.cpp
+index 1be1330790..8af0a6d6a7 100644
+--- a/src/ports/SkOSFile_posix.cpp
++++ b/src/ports/SkOSFile_posix.cpp
+@@ -25,7 +25,7 @@
+ #endif
+
+ void sk_fsync(FILE* f) {
+-#if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) && !defined(_NEWLIB_VERSION)
++#if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) && !defined(_NEWLIB_VERSION) && !defined(__OpenBSD__)
+ int fd = fileno(f);
+ fsync(fd);
+ #endif
diff --git a/vcpkg/ports/skia/graphite.patch b/vcpkg/ports/skia/graphite.patch
new file mode 100644
index 0000000..92b0fbc
--- /dev/null
+++ b/vcpkg/ports/skia/graphite.patch
@@ -0,0 +1,12 @@
+diff --git a/include/gpu/graphite/Recorder.h b/include/gpu/graphite/Recorder.h
+index 63c7bc55d5..a7adc83271 100644
+--- a/include/gpu/graphite/Recorder.h
++++ b/include/gpu/graphite/Recorder.h
+@@ -12,6 +12,7 @@
+ #include "include/core/SkRecorder.h"
+ #include "include/core/SkRefCnt.h"
+ #include "include/gpu/graphite/GraphiteTypes.h"
++#include "include/gpu/graphite/ImageProvider.h"
+ #include "include/gpu/graphite/Recording.h"
+ #include "include/private/base/SingleOwner.h"
+ #include "include/private/base/SkAPI.h"
diff --git a/vcpkg/ports/skia/pdfsubsetfont-uwp.diff b/vcpkg/ports/skia/pdfsubsetfont-uwp.diff
new file mode 100644
index 0000000..cdeab28
--- /dev/null
+++ b/vcpkg/ports/skia/pdfsubsetfont-uwp.diff
@@ -0,0 +1,12 @@
+diff --git a/src/pdf/SkPDFSubsetFont.cpp b/src/pdf/SkPDFSubsetFont.cpp
+index 307c4304a2..db723bcd42 100644
+--- a/src/pdf/SkPDFSubsetFont.cpp
++++ b/src/pdf/SkPDFSubsetFont.cpp
+@@ -111,6 +111,7 @@ sk_sp<SkData> SkPDFSubsetFont(const SkTypeface& typeface, const SkPDFGlyphUse& g
+
+ #else
+
++#include "include/core/SkData.h"
+ sk_sp<SkData> SkPDFSubsetFont(const SkTypeface&, const SkPDFGlyphUse&) {
+ return nullptr;
+ }
diff --git a/vcpkg/ports/skia/portfile.cmake b/vcpkg/ports/skia/portfile.cmake
new file mode 100644
index 0000000..a93c1a6
--- /dev/null
+++ b/vcpkg/ports/skia/portfile.cmake
@@ -0,0 +1,353 @@
+include("${CMAKE_CURRENT_LIST_DIR}/skia-functions.cmake")
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO google/skia
+ REF "66a9fa68df253ee59200364436267a46545aee9e"
+ SHA512 5248b09ca2025caba48f1419277d104e332f1fb6d570fb530b9bb803133cdb79795cccbbe42981397be0c268edb113f26ffd9766ccea0ffab8275633966f6c96
+ PATCHES
+ # disable-dev-test.patch
+ skia-include-string.patch
+ bentleyottmann-build.patch
+ graphite.patch
+ vulkan-headers.patch
+ pdfsubsetfont-uwp.diff
+ skparagraph-dllexport.patch
+ dawn.patch
+ use-pkgconfig-to-find-gl.patch
+ dont-use-response-file.patch
+ fix-bsd.patch
+ allow-disabling-lib-dl.patch
+ always-build-pathops.patch
+ remove-directwrite-png-dependency.patch # merged in newer versions on upstream
+)
+
+# De-vendor
+file(REMOVE_RECURSE "${SOURCE_PATH}/include/third_party/vulkan")
+
+# these following aren't available in vcpkg
+# to update, visit the DEPS file in Skia's root directory
+declare_external_from_git(d3d12allocator
+ URL "https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git"
+ REF "169895d529dfce00390a20e69c2f516066fe7a3b"
+ LICENSE_FILE LICENSE.txt
+)
+declare_external_from_git(dng_sdk
+ URL "https://android.googlesource.com/platform/external/dng_sdk.git"
+ REF "dbe0a676450d9b8c71bf00688bb306409b779e90"
+ LICENSE_FILE LICENSE
+)
+declare_external_from_git(jinja2
+ URL "https://chromium.googlesource.com/chromium/src/third_party/jinja2"
+ REF "e2d024354e11cc6b041b0cff032d73f0c7e43a07"
+ LICENSE_FILE LICENSE.rst
+)
+declare_external_from_git(markupsafe
+ URL "https://chromium.googlesource.com/chromium/src/third_party/markupsafe"
+ REF "0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794"
+ LICENSE_FILE LICENSE
+)
+declare_external_from_git(partition_alloc
+ URL "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git"
+ REF "ce13777cb731e0a60c606d1741091fd11a0574d7"
+ LICENSE_FILE LICENSE
+)
+declare_external_from_git(piex
+ URL "https://android.googlesource.com/platform/external/piex.git"
+ REF "bb217acdca1cc0c16b704669dd6f91a1b509c406"
+ LICENSE_FILE LICENSE
+)
+declare_external_from_git(spirv-cross
+ URL "https://github.com/KhronosGroup/SPIRV-Cross"
+ REF "b8fcf307f1f347089e3c46eb4451d27f32ebc8d3"
+ LICENSE_FILE LICENSE
+)
+declare_external_from_git(spirv-headers
+ URL "https://github.com/KhronosGroup/SPIRV-Headers.git"
+ REF "97e96f9e9defeb4bba3cfbd034dec516671dd7a3"
+ LICENSE_FILE LICENSE
+)
+declare_external_from_git(spirv-tools
+ URL "https://github.com/KhronosGroup/SPIRV-Tools.git"
+ REF "3aeaaa088d37b86cff036eee1a9bf452abad7d9d"
+ LICENSE_FILE LICENSE
+)
+declare_external_from_git(wuffs
+ URL "https://github.com/google/wuffs-mirror-release-c.git"
+ REF "e3f919ccfe3ef542cfc983a82146070258fb57f8"
+ LICENSE_FILE LICENSE
+)
+
+declare_external_from_pkgconfig(abseil-cpp)
+declare_external_from_pkgconfig(expat)
+declare_external_from_pkgconfig(fontconfig PATH "third_party")
+declare_external_from_pkgconfig(freetype2)
+declare_external_from_pkgconfig(gl)
+declare_external_from_pkgconfig(harfbuzz MODULES harfbuzz harfbuzz-subset)
+declare_external_from_pkgconfig(icu MODULES icu-uc)
+declare_external_from_pkgconfig(libavif)
+declare_external_from_pkgconfig(libjpeg PATH "third_party/libjpeg-turbo" MODULES libturbojpeg libjpeg)
+declare_external_from_pkgconfig(libpng)
+declare_external_from_pkgconfig(libwebp MODULES libwebpdecoder libwebpdemux libwebpmux libwebp)
+declare_external_from_pkgconfig(zlib)
+
+declare_external_from_vcpkg(vulkan_headers PATH third_party/externals/vulkan-headers)
+
+set(known_cpus x86 x64 arm arm64 wasm)
+if(NOT VCPKG_TARGET_ARCHITECTURE IN_LIST known_cpus)
+ message(WARNING "Unknown target cpu '${VCPKG_TARGET_ARCHITECTURE}'.")
+endif()
+
+string(JOIN " " OPTIONS
+ "target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\""
+ skia_enable_android_utils=false
+ skia_enable_spirv_validation=false
+ skia_enable_tools=false
+ skia_enable_gpu_debug_layers=false
+ skia_use_jpeg_gainmaps=false
+ skia_use_libheif=false
+ skia_use_lua=false
+)
+set(OPTIONS_DBG "is_debug=true")
+set(OPTIONS_REL "is_official_build=true")
+vcpkg_list(SET SKIA_TARGETS :skia :modules)
+
+if(VCPKG_TARGET_IS_ANDROID)
+ string(APPEND OPTIONS " target_os=\"android\"")
+elseif(VCPKG_TARGET_IS_IOS)
+ string(APPEND OPTIONS " target_os=\"ios\"")
+elseif(VCPKG_TARGET_IS_EMSCRIPTEN)
+ string(APPEND OPTIONS " target_os=\"wasm\"")
+elseif(VCPKG_TARGET_IS_WINDOWS)
+ string(APPEND OPTIONS " target_os=\"win\"")
+ if(VCPKG_TARGET_IS_UWP)
+ string(APPEND OPTIONS " skia_enable_winuwp=true skia_enable_fontmgr_win=false skia_use_xps=false")
+ endif()
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ string(APPEND OPTIONS " skia_enable_bentleyottmann=false")
+ endif()
+elseif(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_BSD)
+ string(APPEND OPTIONS " target_os=\"linux\"")
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ string(APPEND OPTIONS " is_component_build=true")
+else()
+ string(APPEND OPTIONS " is_component_build=false")
+endif()
+
+if (VCPKG_TARGET_IS_BSD AND NOT VCPKG_TARGET_IS_FREEBSD)
+ string(APPEND OPTIONS " skia_vcpkg_has_lib_dl=false")
+else()
+ string(APPEND OPTIONS " skia_vcpkg_has_lib_dl=true")
+endif()
+
+set(required_externals
+ expat
+ piex
+ zlib
+ wuffs
+)
+
+if("dng" IN_LIST FEATURES)
+ list(APPEND required_externals dng_sdk)
+ string(APPEND OPTIONS " skia_use_dng_sdk=true")
+else()
+ string(APPEND OPTIONS " skia_use_dng_sdk=false")
+endif()
+
+if("fontconfig" IN_LIST FEATURES)
+ list(APPEND required_externals fontconfig)
+ string(APPEND OPTIONS " skia_use_fontconfig=true")
+ if(VCPKG_TARGET_IS_WINDOWS)
+ string(APPEND OPTIONS " skia_enable_fontmgr_FontConfigInterface=false")
+ endif()
+else()
+ string(APPEND OPTIONS " skia_use_fontconfig=false")
+endif()
+
+if("freetype" IN_LIST FEATURES)
+ list(APPEND required_externals freetype2)
+ string(APPEND OPTIONS " skia_use_freetype=true")
+else()
+ string(APPEND OPTIONS " skia_use_freetype=false")
+endif()
+
+if("harfbuzz" IN_LIST FEATURES)
+ list(APPEND required_externals harfbuzz)
+ string(APPEND OPTIONS " skia_use_harfbuzz=true")
+else()
+ string(APPEND OPTIONS " skia_use_harfbuzz=false")
+endif()
+
+if("icu" IN_LIST FEATURES)
+ list(APPEND required_externals icu)
+ string(APPEND OPTIONS " skia_use_icu=true skia_use_system_icu=true")
+else()
+ string(APPEND OPTIONS " skia_use_icu=false")
+endif()
+
+if("gl" IN_LIST FEATURES)
+ if (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_BSD)
+ list(APPEND required_externals gl)
+ endif()
+ string(APPEND OPTIONS " skia_use_gl=true")
+else()
+ string(APPEND OPTIONS " skia_use_gl=false")
+endif()
+
+if("metal" IN_LIST FEATURES)
+ string(APPEND OPTIONS " skia_use_metal=true")
+endif()
+
+if("vulkan" IN_LIST FEATURES)
+ list(APPEND required_externals
+ vulkan_headers
+ )
+ string(APPEND OPTIONS " skia_use_vulkan=true skia_vulkan_memory_allocator_dir=\"${CURRENT_INSTALLED_DIR}\"")
+endif()
+
+if("direct3d" IN_LIST FEATURES)
+ list(APPEND required_externals
+ spirv-cross
+ spirv-headers
+ spirv-tools
+ d3d12allocator
+ )
+ string(APPEND OPTIONS " skia_use_direct3d=true")
+endif()
+
+if("graphite" IN_LIST FEATURES)
+ string(APPEND OPTIONS " skia_enable_graphite=true")
+else()
+ string(APPEND OPTIONS " skia_enable_graphite=false")
+endif()
+
+if("dawn" IN_LIST FEATURES)
+ string(APPEND OPTIONS " skia_use_dawn=true")
+ declare_external_from_pkgconfig(dawn PATH "third_party/dawn" MODULES unofficial_webgpu_dawn)
+ list(APPEND required_externals dawn)
+endif()
+
+if("pdf" IN_LIST FEATURES)
+ string(APPEND OPTIONS " skia_enable_pdf=true")
+else()
+ string(APPEND OPTIONS " skia_enable_pdf=false")
+endif()
+
+if("jpeg" IN_LIST FEATURES)
+ list(APPEND required_externals libjpeg)
+ string(APPEND OPTIONS " skia_use_libjpeg_turbo_decode=true skia_use_libjpeg_turbo_encode=true skia_use_no_jpeg_encode=false")
+else()
+ string(APPEND OPTIONS " skia_use_libjpeg_turbo_decode=false skia_use_libjpeg_turbo_encode=false skia_use_no_jpeg_encode=true")
+endif()
+
+if("png" IN_LIST FEATURES)
+ list(APPEND required_externals libpng)
+ string(APPEND OPTIONS " skia_use_libpng_decode=true skia_use_libpng_encode=true skia_use_no_png_encode=false")
+else()
+ string(APPEND OPTIONS " skia_use_libpng_decode=false skia_use_libpng_encode=false skia_use_no_png_encode=true")
+endif()
+
+if("webp" IN_LIST FEATURES)
+ list(APPEND required_externals libwebp)
+ string(APPEND OPTIONS " skia_use_libwebp_decode=true skia_use_libwebp_encode=true skia_use_no_webp_encode=false")
+else()
+ string(APPEND OPTIONS " skia_use_libwebp_decode=false skia_use_libwebp_encode=false skia_use_no_webp_encode=true")
+endif()
+
+if("avif" IN_LIST FEATURES)
+ list(APPEND required_externals libavif)
+ string(APPEND OPTIONS " skia_use_libavif=true")
+else()
+ string(APPEND OPTIONS " skia_use_libavif=false")
+endif()
+
+get_externals(${required_externals})
+if("icu" IN_LIST FEATURES)
+ vcpkg_replace_string("${SOURCE_PATH}/third_party/icu/BUILD.gn"
+ [[config("vcpkg_icu") {]]
+ [[import("icu.gni")
+config("vcpkg_icu") {]])
+endif()
+
+vcpkg_find_acquire_program(PYTHON3)
+vcpkg_replace_string("${SOURCE_PATH}/.gn" "script_executable = \"python3\"" "script_executable = \"${PYTHON3}\"")
+vcpkg_replace_string("${SOURCE_PATH}/gn/toolchain/BUILD.gn" "python3 " "\\\"${PYTHON3}\\\" ")
+
+vcpkg_cmake_get_vars(cmake_vars_file)
+include("${cmake_vars_file}")
+if(VCPKG_TARGET_IS_WINDOWS)
+ string(REGEX REPLACE "[\\]\$" "" WIN_VC "$ENV{VCINSTALLDIR}")
+ string(REGEX REPLACE "[\\]\$" "" WIN_SDK "$ENV{WindowsSdkDir}")
+ string(APPEND OPTIONS " win_vc=\"${WIN_VC}\"")
+ string(APPEND OPTIONS " win_sdk=\"${WIN_SDK}\"")
+elseif(VCPKG_TARGET_IS_ANDROID)
+ string(APPEND OPTIONS " ndk=\"${VCPKG_DETECTED_CMAKE_ANDROID_NDK}\" ndk_api=${VCPKG_DETECTED_CMAKE_SYSTEM_VERSION}")
+else()
+ string(APPEND OPTIONS " \
+ cc=\"${VCPKG_DETECTED_CMAKE_C_COMPILER}\" \
+ cxx=\"${VCPKG_DETECTED_CMAKE_CXX_COMPILER}\"")
+endif()
+
+string_to_gn_list(SKIA_C_FLAGS_DBG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
+string_to_gn_list(SKIA_CXX_FLAGS_DBG "${VCPKG_COMBINED_CXX_FLAGS_DEBUG}")
+string(APPEND OPTIONS_DBG " \
+ extra_cflags_c=${SKIA_C_FLAGS_DBG} \
+ extra_cflags_cc=${SKIA_CXX_FLAGS_DBG}")
+string_to_gn_list(SKIA_C_FLAGS_REL "${VCPKG_COMBINED_C_FLAGS_RELEASE}")
+string_to_gn_list(SKIA_CXX_FLAGS_REL "${VCPKG_COMBINED_CXX_FLAGS_RELEASE}")
+string(APPEND OPTIONS_REL " \
+ extra_cflags_c=${SKIA_C_FLAGS_REL} \
+ extra_cflags_cc=${SKIA_CXX_FLAGS_REL}")
+if(VCPKG_TARGET_IS_UWP)
+ string_to_gn_list(SKIA_LD_FLAGS "-APPCONTAINER WindowsApp.lib")
+ string(APPEND OPTIONS " extra_ldflags=${SKIA_LD_FLAGS}")
+endif()
+
+string(APPEND OPTIONS " skia_use_cpp20=true")
+
+vcpkg_gn_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS "${OPTIONS}"
+ OPTIONS_DEBUG "${OPTIONS_DBG}"
+ OPTIONS_RELEASE "${OPTIONS_REL}"
+)
+
+skia_gn_install(
+ SOURCE_PATH "${SOURCE_PATH}"
+ TARGETS ${SKIA_TARGETS}
+)
+
+# Use skia repository layout in ${CURRENT_PACKAGES_DIR}/include/skia
+file(COPY "${SOURCE_PATH}/include"
+ "${SOURCE_PATH}/modules"
+ "${SOURCE_PATH}/src"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/include/skia"
+ FILES_MATCHING PATTERN "*.h"
+)
+auto_clean("${CURRENT_PACKAGES_DIR}/include/skia")
+set(skia_dll_static "0")
+set(skia_dll_dynamic "1")
+vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/skia/include/private/base/SkAPI.h" "defined(SKIA_DLL)" "${skia_dll_${VCPKG_LIBRARY_LINKAGE}}")
+
+# vcpkg legacy layout omits "include/" component. Just duplicate.
+file(COPY "${CURRENT_PACKAGES_DIR}/include/skia/include/" DESTINATION "${CURRENT_PACKAGES_DIR}/include/skia")
+
+# vcpkg legacy
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/skiaConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/skia")
+
+file(INSTALL
+ "${CMAKE_CURRENT_LIST_DIR}/example/CMakeLists.txt"
+ "${SOURCE_PATH}/tools/convert-to-nia.cpp"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/example"
+)
+file(APPEND "${CURRENT_PACKAGES_DIR}/share/${PORT}/example/convert-to-nia.cpp" [[
+// Test for https://github.com/microsoft/vcpkg/issues/27219
+#include "include/core/SkColorSpace.h"
+]])
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+
+file(GLOB third_party_licenses "${SOURCE_PATH}/third_party_licenses/*")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" ${third_party_licenses})
diff --git a/vcpkg/ports/skia/remove-directwrite-png-dependency.patch b/vcpkg/ports/skia/remove-directwrite-png-dependency.patch
new file mode 100644
index 0000000..3a48f39
--- /dev/null
+++ b/vcpkg/ports/skia/remove-directwrite-png-dependency.patch
@@ -0,0 +1,48 @@
+From 85f9aa5907e3e445dabdf24be64032b8a76455ce Mon Sep 17 00:00:00 2001
+From: Ben Wagner <bungeman@google.com>
+Date: Thu, 9 Oct 2025 10:55:24 -0400
+Subject: [PATCH] Remove DirectWrite direct dependency on png codec
+
+SkScalerContext_DW::generatePngMetrics was still calling the png codec
+directly, while SkScalerContext_DW::drawPngImage used the png codec
+indirectly already. Make generatePngMetrics work like drawPngImage.
+
+Bug: 446241210
+Change-Id: Iddbc76f80e85a12fac2be8126d1efb102fc79d2c
+Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1070816
+Auto-Submit: Ben Wagner <bungeman@google.com>
+Reviewed-by: Kaylee Lubick <kjlubick@google.com>
+Commit-Queue: Kaylee Lubick <kjlubick@google.com>
+---
+ src/ports/SkScalerContext_win_dw.cpp | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
+index b6fc437f3922..deaea1f48993 100644
+--- a/src/ports/SkScalerContext_win_dw.cpp
++++ b/src/ports/SkScalerContext_win_dw.cpp
+@@ -11,8 +11,6 @@
+
+ #undef GetGlyphIndices
+
+-#include "include/codec/SkCodec.h"
+-#include "include/codec/SkPngDecoder.h"
+ #include "include/core/SkBBHFactory.h"
+ #include "include/core/SkBitmap.h"
+ #include "include/core/SkData.h"
+@@ -1737,12 +1735,12 @@ bool SkScalerContext_DW::generatePngMetrics(const SkGlyph& glyph, SkRect* bounds
+ &ReleaseProc,
+ context);
+
+- std::unique_ptr<SkCodec> codec = SkPngDecoder::Decode(std::move(data), nullptr);
+- if (!codec) {
++ sk_sp<SkImage> image = SkImages::DeferredFromEncodedData(std::move(data));
++ if (!image) {
+ return false;
+ }
+
+- SkImageInfo info = codec->getInfo();
++ SkImageInfo info = image->imageInfo();
+ *bounds = SkRect::Make(info.bounds());
+
+ SkMatrix matrix = fSkXform;
diff --git a/vcpkg/ports/skia/skia-functions.cmake b/vcpkg/ports/skia/skia-functions.cmake
new file mode 100644
index 0000000..0a3c0e4
--- /dev/null
+++ b/vcpkg/ports/skia/skia-functions.cmake
@@ -0,0 +1,479 @@
+# Declare a named external dependency for download with vcpkg_from_git,
+# and validate against upstream's DEPS.
+function(declare_external_from_git name)
+ cmake_parse_arguments(PARSE_ARGV 1 arg "" "URL;REF;LICENSE_FILE" "")
+ if(NOT arg_URL OR NOT arg_REF OR NOT arg_LICENSE_FILE)
+ message(FATAL_ERROR "Arguments URL, REF and LICENSE_FILE are required.")
+ endif()
+ set(actual "${arg_URL}@${arg_REF}")
+ file(STRINGS "${SOURCE_PATH}/DEPS" upstream REGEX "\"third_party/externals/${name}\"")
+ string(REPLACE "https://chromium.googlesource.com/external/github.com" "https://github.com" upstream "${upstream}")
+ string(REPLACE "https://skia.googlesource.com/external/github.com" "https://github.com" upstream "${upstream}")
+ string(FIND "${upstream}" "${arg_URL}@${arg_REF}" pos)
+ if(pos STREQUAL "-1")
+ string(REGEX REPLACE "^[^:]*: *" "" upstream "${upstream}")
+ message(WARNING "Dependency ${name} diverges from upstream. Upstream: ${upstream} Actual: \"${actual}\"")
+ endif()
+ set(skia_external_license_${name} "${arg_LICENSE_FILE}" PARENT_SCOPE)
+ list(REMOVE_ITEM ARGN "LICENSE_FILE" "${arg_LICENSE_FILE}")
+ set(skia_external_git_${name} "${ARGN}" PARENT_SCOPE)
+endfunction()
+
+# Declare a named external dependencies to be resolved via pkgconfig.
+function(declare_external_from_pkgconfig name)
+ set(skia_external_pkgconfig_${name} "${ARGN}" PARENT_SCOPE)
+endfunction()
+
+# Declare a named external dependencies to be resolved via vcpkg installed tree.
+function(declare_external_from_vcpkg name)
+ set(skia_external_vcpkg_${name} "${ARGN}" PARENT_SCOPE)
+endfunction()
+
+# Download and integrate named external dependencies.
+# Downlods must be handled before vcpkg in order to support --only-downloads mode.
+function(get_externals)
+ set(licenses_dir "${SOURCE_PATH}/third_party_licenses")
+ file(REMOVE_RECURSE "${licenses_dir}")
+ file(MAKE_DIRECTORY "${licenses_dir}")
+
+ list(REMOVE_DUPLICATES ARGN)
+ set(from_git "")
+ set(from_pkgconfig "")
+ set(from_vcpkg "")
+ foreach(name IN LISTS ARGN)
+ if(DEFINED "skia_external_git_${name}")
+ list(APPEND from_git "${name}")
+ elseif(DEFINED "skia_external_pkgconfig_${name}")
+ list(APPEND from_pkgconfig "${name}")
+ elseif(DEFINED "skia_external_vcpkg_${name}")
+ list(APPEND from_vcpkg "${name}")
+ else()
+ message(FATAL_ERROR "Unknown external dependency '${name}'")
+ endif()
+ endforeach()
+ foreach(name IN LISTS from_git)
+ set(dir "third_party/externals/${name}")
+ if(EXISTS "${SOURCE_PATH}/${dir}")
+ message(STATUS "Using existing ${dir}")
+ continue()
+ endif()
+ message(STATUS "Creating ${dir}")
+ file(MAKE_DIRECTORY "${SOURCE_PATH}/third_party/externals")
+ vcpkg_from_git(
+ OUT_SOURCE_PATH staging_dir
+ ${skia_external_git_${name}}
+ )
+ file(RENAME "${staging_dir}" "${SOURCE_PATH}/${dir}")
+
+ set(license_file "${SOURCE_PATH}/${dir}/${skia_external_license_${name}}")
+ if(NOT EXISTS "${license_file}") # partition_alloc does not have a license file
+ message(WARNING "Missing license file: ${license_file}")
+ else()
+ cmake_path(GET license_file FILENAME filename)
+ file(COPY_FILE "${license_file}" "${licenses_dir}/## ${name} ${filename}")
+ endif()
+ endforeach()
+ foreach(name IN LISTS from_pkgconfig)
+ third_party_from_pkgconfig("${name}" ${skia_external_pkgconfig_${name}})
+ endforeach()
+ foreach(name IN LISTS from_vcpkg)
+ third_party_from_vcpkg("${name}" ${skia_external_vcpkg_${name}})
+ endforeach()
+endfunction()
+
+# Setup a third-party dependency from pkg-config data
+function(third_party_from_pkgconfig gn_group)
+ cmake_parse_arguments(PARSE_ARGV 1 arg "" "PATH" "DEFINES;MODULES")
+ if(NOT arg_PATH)
+ set(arg_PATH "third_party/${gn_group}")
+ endif()
+ if(NOT arg_MODULES)
+ set(arg_MODULES "${gn_group}")
+ endif()
+ if(arg_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unparsed arguments: ${arg_UNPARSED_ARGUMENTS}")
+ endif()
+ x_vcpkg_pkgconfig_get_modules(PREFIX PC_${module} MODULES ${arg_MODULES} CFLAGS LIBS)
+ foreach(config IN ITEMS DEBUG RELEASE)
+ separate_arguments(cflags UNIX_COMMAND "${PC_${module}_CFLAGS_${config}}")
+ set(defines "${cflags}")
+ list(FILTER defines INCLUDE REGEX "^-D" )
+ list(TRANSFORM defines REPLACE "^-D" "")
+ list(APPEND defines ${arg_DEFINES})
+ set(include_dirs "${cflags}")
+ list(FILTER include_dirs INCLUDE REGEX "^-I" )
+ list(TRANSFORM include_dirs REPLACE "^-I" "")
+ separate_arguments(libs UNIX_COMMAND "${PC_${module}_LIBS_${config}}")
+ set(lib_dirs "${libs}")
+ list(FILTER lib_dirs INCLUDE REGEX "^-L" )
+ list(TRANSFORM lib_dirs REPLACE "^-L" "")
+ # Passing link libraries via ldflags, cf. third-party.gn.in
+ set(ldflags "${libs}")
+ list(FILTER ldflags INCLUDE REGEX "^-l" )
+ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ list(TRANSFORM ldflags REPLACE "^-l" "")
+ list(TRANSFORM ldflags APPEND ".lib")
+ set(libs_with_path "")
+ # At least icu must be newer than in Windows SDK
+ foreach(name IN LISTS ldflags)
+ set(filepath NOTFOUND)
+
+ set(possible_names "${name}")
+ string(REGEX REPLACE "\\.lib$" ".dll.lib" dll_lib_name "${name}")
+ if(NOT dll_lib_name STREQUAL name)
+ list(APPEND possible_names "${dll_lib_name}")
+ endif()
+
+ find_file(filepath NAMES ${possible_names} PATHS ${lib_dirs} NO_DEFAULT_PATH NO_CACHE)
+ if(filepath)
+ list(APPEND libs_with_path "${filepath}")
+ else()
+ list(APPEND libs_with_path "${name}")
+ endif()
+ endforeach()
+ set(ldflags "${libs_with_path}")
+ endif()
+ set(GN_OUT_${config} "")
+ foreach(item IN ITEMS defines include_dirs lib_dirs ldflags)
+ set("gn_${item}_${config}" "")
+ if(NOT "${${item}}" STREQUAL "")
+ list(JOIN ${item} [[", "]] list)
+ set("gn_${item}_${config}" "\"${list}\"")
+ endif()
+ endforeach()
+ endforeach()
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/third-party.gn.in" "${SOURCE_PATH}/${arg_PATH}/BUILD.gn" @ONLY)
+endfunction()
+
+# Setup a third-party dependency from vcpkg installed tree
+function(third_party_from_vcpkg gn_group)
+ cmake_parse_arguments(PARSE_ARGV 1 arg "" "PATH" "")
+ if(NOT arg_PATH)
+ set(arg_PATH "third_party/${gn_group}")
+ endif()
+ if(arg_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unparsed arguments: ${arg_UNPARSED_ARGUMENTS}")
+ endif()
+ set(defines "")
+ set(include_dirs "${CURRENT_INSTALLED_DIR}/include")
+ set(libdirs_RELEASE "${CURRENT_INSTALLED_DIR}/lib")
+ set(libdirs_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib")
+ set(ldflags "")
+ foreach(config IN ITEMS DEBUG RELEASE)
+ set(lib_dirs "${libdirs_${config}}")
+ set(GN_OUT_${config} "")
+ foreach(item IN ITEMS defines include_dirs lib_dirs ldflags)
+ set("gn_${item}_${config}" "")
+ if(NOT "${${item}}" STREQUAL "")
+ list(JOIN ${item} [[", "]] list)
+ set("gn_${item}_${config}" "\"${list}\"")
+ endif()
+ endforeach()
+ endforeach()
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/third-party.gn.in" "${SOURCE_PATH}/${arg_PATH}/BUILD.gn" @ONLY)
+endfunction()
+
+# Turn a space separated string into a gn list:
+# "a b c" -> ["a","b","c"]
+function(string_to_gn_list out_var input)
+ separate_arguments(list UNIX_COMMAND "${input}")
+ if(NOT list STREQUAL "")
+ list(JOIN list [[","]] temp)
+ set(list "\"${temp}\"")
+ endif()
+ set("${out_var}" "[${list}]" PARENT_SCOPE)
+endfunction()
+
+# Remove all empty directories.
+function(auto_clean dir)
+ file(GLOB entries "${dir}/*")
+ file(GLOB files LIST_DIRECTORIES false "${dir}/*")
+ foreach(entry IN LISTS entries)
+ if(entry IN_LIST files)
+ continue()
+ endif()
+ file(GLOB_RECURSE children "${entry}/*")
+ if(children)
+ auto_clean("${entry}")
+ else()
+ file(REMOVE_RECURSE "${entry}")
+ endif()
+ endforeach()
+endfunction()
+
+function(list_from_json out_var json) # <path>
+ vcpkg_list(SET list)
+ string(JSON array ERROR_VARIABLE error GET "${json}" ${ARGN})
+ if(NOT error)
+ string(JSON len ERROR_VARIABLE error LENGTH "${array}")
+ if(NOT error AND NOT len STREQUAL "0")
+ math(EXPR last "${len} - 1")
+ foreach(i RANGE "${last}")
+ string(JSON item GET "${array}" "${i}")
+ vcpkg_list(APPEND list "${item}")
+ endforeach()
+ endif()
+ endif()
+ set("${out_var}" "${list}" PARENT_SCOPE)
+endfunction()
+
+# Expand gn targets for installable components.
+function(expand_gn_targets targets_var desc_var source_path)
+ set(expand_gn_targets_components "")
+ set(expand_gn_targets_visited "")
+ foreach(gn_target IN LISTS "${targets_var}")
+ expand_gn_targets_recurse("${gn_target}" "${desc_var}" "${source_path}")
+ endforeach()
+ set("${targets_var}" "${expand_gn_targets_components}" PARENT_SCOPE)
+endfunction()
+
+# Private helper for expand_gn_targets.
+function(expand_gn_targets_recurse gn_target desc_var source_path)
+ # shortcuts
+ if(gn_target IN_LIST expand_gn_targets_components)
+ return()
+ elseif(gn_target IN_LIST expand_gn_targets_visited)
+ return()
+ endif()
+ list(APPEND expand_gn_targets_visited "${gn_target}")
+
+ # current target
+ set(recurse 1)
+ string(JSON current_json GET "${${desc_var}}" "${gn_target}")
+ string(JSON target_type GET "${current_json}" "type")
+ if(target_type STREQUAL "static_library" AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ string(REGEX REPLACE "^//([^:]*):(.*)\$" "${source_path}/\\1/BUILD.gn" build_gn_file "${gn_target}")
+ if(EXISTS "${build_gn_file}")
+ # skia's third-party "dawn_component" creates separate _shared/_static libs.
+ string(REGEX REPLACE "^(.*)(_static|_shared)\$" "(\\1\\2|\\1)" name_pattern "${CMAKE_MATCH_2}")
+ file(STRINGS "${build_gn_file}" maybe_component REGEX "component[(]\"${name_pattern}\"[)]")
+ if(NOT maybe_component STREQUAL "")
+ list(APPEND expand_gn_targets_components "${gn_target}")
+ endif()
+ else()
+ message(WARNING "No ${build_gn_file}")
+ endif()
+ elseif(target_type MATCHES "^(executable|loadable_module|shared_library)\$")
+ list(APPEND expand_gn_targets_components "${gn_target}")
+ elseif(NOT target_type MATCHES "^(group|source_set)\$")
+ set(recurse 0)
+ endif()
+
+ if(recurse)
+ list_from_json(deps "${current_json}" "deps")
+ foreach(dep IN LISTS deps)
+ expand_gn_targets_recurse("${dep}" "${desc_var}" "${source_path}")
+ endforeach()
+ endif()
+
+ set(expand_gn_targets_components "${expand_gn_targets_components}" PARENT_SCOPE)
+ set(expand_gn_targets_visited "${expand_gn_targets_visited}" PARENT_SCOPE)
+endfunction()
+
+# Provide a cmake target name (w/o namespace) in out_var
+function(get_cmake_target out_var gn_target)
+ if(gn_target MATCHES "/([^:/]+):")
+ string(REPLACE "/${CMAKE_MATCH_1}:${CMAKE_MATCH_1}" "/${CMAKE_MATCH_1}" gn_target "${gn_target}")
+ endif()
+ string(REGEX REPLACE "[:/]+" "::" target "unofficial/${PORT}${gn_target}")
+ set("${out_var}" "${target}" PARENT_SCOPE)
+endfunction()
+
+# Put the target's SK_<...> definitions in out_var
+function(get_definitions out_var desc_json target)
+ list_from_json(output "${desc_json}" "${target}" "defines")
+ list(FILTER output INCLUDE REGEX "^SK_")
+ set("${out_var}" "${output}" PARENT_SCOPE)
+endfunction()
+
+# Put the target's link libraries in out_var
+function(get_link_libs out_var desc_json target)
+ # We don't pass this variable explicitly now.
+ separate_arguments(known_standard_libraries NATIVE_COMMAND "${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}")
+ # From ldflags, we only want lib names or filepaths (cf. declare_external_from_pkgconfig)
+ list_from_json(ldflags "${desc_json}" "${target}" "ldflags")
+ string(REPLACE "-isysroot;" "-isysroot " ldflags "${ldflags}")
+ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ list(FILTER ldflags INCLUDE REGEX "[.]lib\$")
+ else()
+ list(FILTER ldflags INCLUDE REGEX "^-l|^/")
+ endif()
+ list(TRANSFORM ldflags REPLACE "^-l" "")
+ list_from_json(libs "${desc_json}" "${target}" "libs")
+ vcpkg_list(SET frameworks)
+ if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
+ list_from_json(frameworks "${desc_json}" "${target}" "frameworks")
+ list(TRANSFORM frameworks REPLACE "^(.*)[.]framework\$" "-framework \\1")
+ endif()
+ vcpkg_list(SET output)
+ foreach(lib IN LISTS frameworks ldflags libs)
+ if(VCPKG_TARGET_IS_WINDOWS)
+ string(TOLOWER "${lib}" lib_key)
+ else()
+ set(lib_key "{lib}")
+ endif()
+ if(lib_key IN_LIST known_standard_libraries)
+ continue()
+ endif()
+ string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${z_vcpkg_${PORT}_root}" lib "${lib}")
+ string(REPLACE "${CURRENT_PACKAGES_DIR}" "\${z_vcpkg_${PORT}_root}" lib "${lib}")
+ if(NOT lib MATCHES "^-L")
+ vcpkg_list(REMOVE_ITEM output "${lib}")
+ endif()
+ vcpkg_list(APPEND output "${lib}")
+ endforeach()
+ set("${out_var}" "${output}" PARENT_SCOPE)
+endfunction()
+
+# A revised variant of vcpkg_gn_install
+function(skia_gn_install_build_type)
+ cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "BUILD_TYPE;SOURCE_PATH;INSTALL_DIR;LABEL" "TARGETS")
+ if(DEFINED arg_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Internal error: skia_gn_install_build_type was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
+ endif()
+
+ set(build_dir "${CURRENT_BUILDTREES_DIR}/${arg_LABEL}")
+
+ # `gn desc json` output is dual-use: logging (early) and further processing
+ # Cf. https://github.com/universeroc/gn/blob/master/docs/reference.md#desc
+ vcpkg_find_acquire_program(GN)
+ vcpkg_execute_required_process(
+ COMMAND "${GN}" desc --format=json --all --testonly=false "${build_dir}" "*"
+ WORKING_DIRECTORY "${arg_SOURCE_PATH}"
+ LOGNAME "desc-${arg_LABEL}"
+ )
+
+ # build
+ set(VCPKG_BUILD_TYPE "${arg_BUILD_TYPE}")
+ vcpkg_build_ninja(TARGETS ${arg_TARGETS})
+
+ # install and export
+ set(logfile "${CURRENT_BUILDTREES_DIR}/install-${arg_LABEL}.log")
+ file(WRITE "${logfile}" "")
+ message(STATUS "Installing (${arg_LABEL})...")
+
+ file(MAKE_DIRECTORY "${arg_INSTALL_DIR}/share/unofficial-${PORT}")
+
+ list(TRANSFORM arg_TARGETS PREPEND "//")
+ file(READ "${CURRENT_BUILDTREES_DIR}/desc-${arg_LABEL}-out.log" desc)
+ string(REGEX REPLACE "^([^{]+)\n{\n" "{\n" desc "${desc}")
+ if(NOT "${CMAKE_MATCH_1}" STREQUAL "")
+ message(STATUS "${CMAKE_MATCH_1}")
+ endif()
+ expand_gn_targets(arg_TARGETS desc "${arg_SOURCE_PATH}")
+
+ string(TOUPPER "${arg_BUILD_TYPE}" cmake_build_type)
+ set(cmake_config_genex [[\$<NOT:\$<CONFIG:DEBUG>>]])
+ if(cmake_build_type STREQUAL "DEBUG")
+ set(cmake_config_genex [[\$<CONFIG:DEBUG>]])
+ endif()
+
+ foreach(gn_target IN LISTS arg_TARGETS)
+ get_cmake_target(cmake_target "${gn_target}")
+ set(add_target "add_library(${cmake_target} INTERFACE IMPORTED)")
+ set(has_location "0")
+ set(imported_location "")
+ set(not_executable "1")
+ string(JSON target_type GET "${desc}" "${gn_target}" "type")
+
+ set(link_language "C")
+ string(JSON sources ERROR_VARIABLE unused GET "${desc}" "${gn_target}" "sources")
+ if(sources MATCHES "[.]cxx|[.]cpp")
+ set(link_language "CXX")
+ endif()
+
+ list_from_json(outputs "${desc}" "${gn_target}" "outputs")
+ foreach(output IN LISTS outputs)
+ if(CMAKE_HOST_WIN32)
+ # absolute path (e.g. /C:/path/to/target.lib)
+ string(REGEX REPLACE "^/([^/]:)" "\\1" output "${output}")
+ endif()
+ # relative path (e.g. //out/Release/target.lib)
+ string(REGEX REPLACE "^//" "${arg_SOURCE_PATH}/" output "${output}")
+
+ cmake_path(GET output FILENAME filename)
+ set(add_target "add_library(${cmake_target} UNKNOWN IMPORTED)")
+ set(destination "${arg_INSTALL_DIR}/lib")
+ set(has_location "1")
+ if(target_type STREQUAL "executable")
+ set(add_target "add_executable(${cmake_target} IMPORTED)")
+ set(destination "${arg_INSTALL_DIR}/tools/${PORT}")
+ set(imported_location "${destination}/${filename}")
+ set(not_executable "0")
+ elseif(filename MATCHES "\\.(dll|pdb)\$")
+ if(CMAKE_MATCH_1 STREQUAL "pdb" AND NOT EXISTS "${output}")
+ continue()
+ endif()
+ set(destination "${arg_INSTALL_DIR}/bin")
+ # Do not set (overwrite) imported_location
+ else()
+ set(imported_location "${destination}/${filename}")
+ endif()
+ # output artifact installation
+ file(APPEND "${logfile}" "Installing: ${destination}/${filename}\n")
+ file(COPY "${output}" DESTINATION "${destination}")
+ endforeach()
+
+ # CMake target properties
+ string(REPLACE "::" "-" basename "${cmake_target}")
+ get_definitions(interface_compile_definitions "${desc}" "${gn_target}")
+ get_link_libs(interface_link_libs "${desc}" "${gn_target}")
+ set(interface_link_targets "")
+ list_from_json(deps "${desc}" "${gn_target}" "deps")
+ foreach(dep IN LISTS deps)
+ if(dep IN_LIST arg_TARGETS)
+ get_cmake_target(cmake_dep "${dep}")
+ list(APPEND interface_link_targets "${cmake_dep}")
+ endif()
+ endforeach()
+ file(APPEND "${logfile}" "Installing: ${arg_INSTALL_DIR}/share/unofficial-${PORT}/${basename}-targets.cmake\n")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-${PORT}-targets.cmake" "${arg_INSTALL_DIR}/share/unofficial-${PORT}/${basename}-targets.cmake" @ONLY)
+ file(APPEND "${logfile}" "Installing: ${arg_INSTALL_DIR}/share/unofficial-${PORT}/${basename}-targets-${arg_BUILD_TYPE}.cmake\n")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-${PORT}-targets-details.cmake" "${arg_INSTALL_DIR}/share/unofficial-${PORT}/${basename}-targets-${arg_BUILD_TYPE}.cmake" @ONLY)
+ endforeach()
+
+ # Main CMake config file
+ file(APPEND "${logfile}" "Installing: ${arg_INSTALL_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake\n")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-${PORT}-config.cmake" "${arg_INSTALL_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake" @ONLY)
+endfunction()
+
+# A revised variant of vcpkg_gn_install
+function(skia_gn_install)
+ cmake_parse_arguments(PARSE_ARGV 0 arg "" "SOURCE_PATH" "TARGETS")
+
+ if(DEFINED arg_UNPARSED_ARGUMENTS)
+ message(WARNING "vcpkg_gn_install was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
+ endif()
+ if(NOT DEFINED arg_SOURCE_PATH)
+ message(FATAL_ERROR "SOURCE_PATH must be specified.")
+ endif()
+
+ set(auto_clean_debug_share TRUE)
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/share")
+ set(auto_clean_debug_share FALSE)
+ endif()
+ skia_gn_install_build_type(
+ BUILD_TYPE debug
+ LABEL "${TARGET_TRIPLET}-dbg"
+ SOURCE_PATH "${arg_SOURCE_PATH}"
+ INSTALL_DIR "${CURRENT_PACKAGES_DIR}/debug"
+ TARGETS ${arg_TARGETS}
+ )
+ endif()
+
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ skia_gn_install_build_type(
+ BUILD_TYPE release
+ LABEL "${TARGET_TRIPLET}-rel"
+ SOURCE_PATH "${arg_SOURCE_PATH}"
+ INSTALL_DIR "${CURRENT_PACKAGES_DIR}"
+ TARGETS ${arg_TARGETS}
+ )
+ endif()
+
+ vcpkg_cmake_config_fixup(PACKAGE_NAME "unofficial-${PORT}")
+ if(auto_clean_debug_share)
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+ endif()
+endfunction()
diff --git a/vcpkg/ports/skia/skia-include-string.patch b/vcpkg/ports/skia/skia-include-string.patch
new file mode 100644
index 0000000..d05f9a5
--- /dev/null
+++ b/vcpkg/ports/skia/skia-include-string.patch
@@ -0,0 +1,13 @@
+diff --git a/src/gpu/ganesh/d3d/GrD3DUtil.h b/src/gpu/ganesh/d3d/GrD3DUtil.h
+index 7a1078b629..bd5605ae91 100644
+--- a/src/gpu/ganesh/d3d/GrD3DUtil.h
++++ b/src/gpu/ganesh/d3d/GrD3DUtil.h
+@@ -8,6 +8,8 @@
+ #ifndef GrD3DUtil_DEFINED
+ #define GrD3DUtil_DEFINED
+
++#include <string>
++
+ #include "include/core/SkImage.h"
+ #include "include/gpu/ganesh/GrTypes.h"
+ #include "include/gpu/ganesh/d3d/GrD3DTypes.h"
diff --git a/vcpkg/ports/skia/skiaConfig.cmake b/vcpkg/ports/skia/skiaConfig.cmake
new file mode 100644
index 0000000..b866057
--- /dev/null
+++ b/vcpkg/ports/skia/skiaConfig.cmake
@@ -0,0 +1,19 @@
+file(READ "${CMAKE_CURRENT_LIST_DIR}/usage" usage)
+message(AUTHOR_WARNING "find_package(skia) is deprecated.\n${usage}")
+include(CMakeFindDependencyMacro)
+find_dependency(unofficial-skia)
+if(NOT TARGET skia)
+ get_filename_component(z_vcpkg_skia_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
+ get_filename_component(z_vcpkg_skia_root "${z_vcpkg_skia_root}" PATH)
+ get_filename_component(z_vcpkg_skia_root "${z_vcpkg_skia_root}" PATH)
+ if(z_vcpkg_skia_root STREQUAL "/")
+ set(z_vcpkg_skia_root "")
+ endif()
+ add_library(skia INTERFACE IMPORTED)
+ set_target_properties(skia PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${z_vcpkg_skia_root}/include"
+ INTERFACE_LINK_LIBRARIES unofficial::skia::skia
+ )
+ add_library(skia::skia ALIAS skia)
+ unset(z_vcpkg_skia_root)
+endif()
diff --git a/vcpkg/ports/skia/skparagraph-dllexport.patch b/vcpkg/ports/skia/skparagraph-dllexport.patch
new file mode 100644
index 0000000..b41e60e
--- /dev/null
+++ b/vcpkg/ports/skia/skparagraph-dllexport.patch
@@ -0,0 +1,231 @@
+diff --git a/modules/skparagraph/BUILD.gn b/modules/skparagraph/BUILD.gn
+index 283eeacebd..742fe4552f 100644
+--- a/modules/skparagraph/BUILD.gn
++++ b/modules/skparagraph/BUILD.gn
+@@ -20,6 +20,9 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_enable_skunicode &&
+ "include",
+ "utils",
+ ]
++ if (is_component_build) {
++ defines += [ "SKPARAGRAPH_DLL" ]
++ }
+ }
+
+ skia_component("skparagraph") {
+@@ -27,6 +30,7 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_enable_skunicode &&
+ public_configs = [ ":public_config" ]
+ public = skparagraph_core_public
+ sources = skparagraph_core_sources
++ defines = [ "SKPARAGRAPH_IMPLEMENTATION=1" ]
+ public_deps = [
+ "../..:skia",
+ "../skunicode",
+diff --git a/modules/skparagraph/include/FontCollection.h b/modules/skparagraph/include/FontCollection.h
+index ae2f9922d0..5b77e997bc 100644
+--- a/modules/skparagraph/include/FontCollection.h
++++ b/modules/skparagraph/include/FontCollection.h
+@@ -16,9 +16,29 @@
+ namespace skia {
+ namespace textlayout {
+
++#if !defined(SKPARAGRAPH_IMPLEMENTATION)
++ #define SKPARAGRAPH_IMPLEMENTATION 0
++#endif
++
++#if !defined(SKPARAGRAPH_API)
++ #if defined(SKPARAGRAPH_DLL)
++ #if defined(_MSC_VER)
++ #if SKPARAGRAPH_IMPLEMENTATION
++ #define SKPARAGRAPH_API __declspec(dllexport)
++ #else
++ #define SKPARAGRAPH_API __declspec(dllimport)
++ #endif
++ #else
++ #define SKPARAGRAPH_API __attribute__((visibility("default")))
++ #endif
++ #else
++ #define SKPARAGRAPH_API
++ #endif
++#endif
++
+ class TextStyle;
+ class Paragraph;
+-class FontCollection : public SkRefCnt {
++class SKPARAGRAPH_API FontCollection : public SkRefCnt {
+ public:
+ FontCollection();
+
+diff --git a/modules/skparagraph/include/ParagraphBuilder.h b/modules/skparagraph/include/ParagraphBuilder.h
+index feac5622bb..72712e121d 100644
+--- a/modules/skparagraph/include/ParagraphBuilder.h
++++ b/modules/skparagraph/include/ParagraphBuilder.h
+@@ -16,7 +16,27 @@
+ namespace skia {
+ namespace textlayout {
+
+-class ParagraphBuilder {
++#if !defined(SKPARAGRAPH_IMPLEMENTATION)
++ #define SKPARAGRAPH_IMPLEMENTATION 0
++#endif
++
++#if !defined(SKPARAGRAPH_API)
++ #if defined(SKPARAGRAPH_DLL)
++ #if defined(_MSC_VER)
++ #if SKPARAGRAPH_IMPLEMENTATION
++ #define SKPARAGRAPH_API __declspec(dllexport)
++ #else
++ #define SKPARAGRAPH_API __declspec(dllimport)
++ #endif
++ #else
++ #define SKPARAGRAPH_API __attribute__((visibility("default")))
++ #endif
++ #else
++ #define SKPARAGRAPH_API
++ #endif
++#endif
++
++class SKPARAGRAPH_API ParagraphBuilder {
+ protected:
+ ParagraphBuilder() {}
+
+diff --git a/modules/skparagraph/include/ParagraphStyle.h b/modules/skparagraph/include/ParagraphStyle.h
+index 98ec228ffb..63e973c7db 100644
+--- a/modules/skparagraph/include/ParagraphStyle.h
++++ b/modules/skparagraph/include/ParagraphStyle.h
+@@ -18,6 +18,26 @@
+ namespace skia {
+ namespace textlayout {
+
++#if !defined(SKPARAGRAPH_IMPLEMENTATION)
++ #define SKPARAGRAPH_IMPLEMENTATION 0
++#endif
++
++#if !defined(SKPARAGRAPH_API)
++ #if defined(SKPARAGRAPH_DLL)
++ #if defined(_MSC_VER)
++ #if SKPARAGRAPH_IMPLEMENTATION
++ #define SKPARAGRAPH_API __declspec(dllexport)
++ #else
++ #define SKPARAGRAPH_API __declspec(dllimport)
++ #endif
++ #else
++ #define SKPARAGRAPH_API __attribute__((visibility("default")))
++ #endif
++ #else
++ #define SKPARAGRAPH_API
++ #endif
++#endif
++
+ struct StrutStyle {
+ StrutStyle();
+
+@@ -75,7 +95,7 @@ private:
+ bool fHalfLeading;
+ };
+
+-struct ParagraphStyle {
++struct SKPARAGRAPH_API ParagraphStyle {
+ ParagraphStyle();
+
+ bool operator==(const ParagraphStyle& rhs) const {
+diff --git a/modules/skparagraph/include/TextStyle.h b/modules/skparagraph/include/TextStyle.h
+index 4bc2fb9dbc..4bee210fb7 100644
+--- a/modules/skparagraph/include/TextStyle.h
++++ b/modules/skparagraph/include/TextStyle.h
+@@ -21,6 +21,26 @@
+ namespace skia {
+ namespace textlayout {
+
++#if !defined(SKPARAGRAPH_IMPLEMENTATION)
++ #define SKPARAGRAPH_IMPLEMENTATION 0
++#endif
++
++#if !defined(SKPARAGRAPH_API)
++ #if defined(SKPARAGRAPH_DLL)
++ #if defined(_MSC_VER)
++ #if SKPARAGRAPH_IMPLEMENTATION
++ #define SKPARAGRAPH_API __declspec(dllexport)
++ #else
++ #define SKPARAGRAPH_API __declspec(dllimport)
++ #endif
++ #else
++ #define SKPARAGRAPH_API __attribute__((visibility("default")))
++ #endif
++ #else
++ #define SKPARAGRAPH_API
++ #endif
++#endif
++
+ static inline bool nearlyZero(SkScalar x, SkScalar tolerance = SK_ScalarNearlyZero) {
+ if (SkIsFinite(x)) {
+ return SkScalarNearlyZero(x, tolerance);
+@@ -148,9 +168,9 @@ struct PlaceholderStyle {
+ SkScalar fBaselineOffset = 0;
+ };
+
+-class TextStyle {
++class SKPARAGRAPH_API TextStyle {
+ public:
+- TextStyle() = default;
++ TextStyle();
+ TextStyle(const TextStyle& other) = default;
+ TextStyle& operator=(const TextStyle& other) = default;
+
+@@ -288,8 +308,6 @@ public:
+ void setPlaceholder() { fIsPlaceholder = true; }
+
+ private:
+- static const std::vector<SkString>* kDefaultFontFamilies;
+-
+ Decoration fDecoration = {
+ TextDecoration::kNoDecoration,
+ // TODO: switch back to kGaps when (if) switching flutter to skparagraph
+@@ -302,7 +320,7 @@ private:
+
+ SkFontStyle fFontStyle;
+
+- std::vector<SkString> fFontFamilies = *kDefaultFontFamilies;
++ std::vector<SkString> fFontFamilies;
+
+ SkScalar fFontSize = 14.0;
+ SkScalar fHeight = 1.0;
+diff --git a/modules/skparagraph/src/TextStyle.cpp b/modules/skparagraph/src/TextStyle.cpp
+index 492f94fe10..9889cc90aa 100644
+--- a/modules/skparagraph/src/TextStyle.cpp
++++ b/modules/skparagraph/src/TextStyle.cpp
+@@ -6,9 +6,13 @@
+ namespace skia {
+ namespace textlayout {
+
+-const std::vector<SkString>* TextStyle::kDefaultFontFamilies =
++static const std::vector<SkString>* kDefaultFontFamilies =
+ new std::vector<SkString>{SkString(DEFAULT_FONT_FAMILY)};
+
++TextStyle::TextStyle() : fFontFamilies(*kDefaultFontFamilies)
++{
++}
++
+ TextStyle TextStyle::cloneForPlaceholder() {
+ TextStyle result;
+ result.fColor = fColor;
+diff --git a/modules/skparagraph/utils/TestFontCollection.cpp b/modules/skparagraph/utils/TestFontCollection.cpp
+index b74a3b99cf..3fe2b129da 100644
+--- a/modules/skparagraph/utils/TestFontCollection.cpp
++++ b/modules/skparagraph/utils/TestFontCollection.cpp
+@@ -57,6 +57,8 @@ bool TestFontCollection::addFontFromFile(const std::string& path, const std::str
+ if (!file) {
+ return false;
+ }
++
++#if 0
+ #if defined(SK_TYPEFACE_FACTORY_FREETYPE)
+ sk_sp<SkTypeface> face =
+ SkTypeface_FreeType::MakeFromStream(std::move(file), SkFontArguments());
+@@ -72,6 +74,7 @@ bool TestFontCollection::addFontFromFile(const std::string& path, const std::str
+ } else {
+ fFontProvider->registerTypeface(std::move(face), SkString(familyName.c_str()));
+ }
++#endif
+
+ return true;
+ }
diff --git a/vcpkg/ports/skia/third-party.gn.in b/vcpkg/ports/skia/third-party.gn.in
new file mode 100644
index 0000000..b637002
--- /dev/null
+++ b/vcpkg/ports/skia/third-party.gn.in
@@ -0,0 +1,25 @@
+# While propagating "libs", gn would omit duplicate items,
+# possibly breaking linking order of static libraries.
+# "ldflags" are propagated literally, via "all_dependent_configs".
+config("vcpkg_@gn_group@") {
+ if(is_debug) {
+ defines = [ @gn_defines_DEBUG@ ]
+ include_dirs = [ @gn_include_dirs_DEBUG@ ]
+ } else {
+ defines = [ @gn_defines_RELEASE@ ]
+ include_dirs = [ @gn_include_dirs_RELEASE@ ]
+ }
+}
+config("vcpkg_@gn_group@_link_libraries") {
+ if(is_debug) {
+ lib_dirs = [ @gn_lib_dirs_DEBUG@ ]
+ ldflags = [ @gn_ldflags_DEBUG@ ]
+ } else {
+ lib_dirs = [ @gn_lib_dirs_RELEASE@ ]
+ ldflags = [ @gn_ldflags_RELEASE@ ]
+ }
+}
+group("@gn_group@") {
+ public_configs = [ ":vcpkg_@gn_group@" ]
+ all_dependent_configs = [ ":vcpkg_@gn_group@_link_libraries" ]
+}
diff --git a/vcpkg/ports/skia/unofficial-skia-config.cmake b/vcpkg/ports/skia/unofficial-skia-config.cmake
new file mode 100644
index 0000000..930511f
--- /dev/null
+++ b/vcpkg/ports/skia/unofficial-skia-config.cmake
@@ -0,0 +1,44 @@
+if(NOT COMMAND z_vcpkg_@PORT@_get_link_libraries)
+ function(z_vcpkg_@PORT@_get_link_libraries out_var type libraries)
+ set(libs "")
+ if(type STREQUAL "DEBUG")
+ set(vcpkg_link_directories "${z_vcpkg_@PORT@_root}/debug/lib" "${z_vcpkg_@PORT@_root}/lib")
+ else()
+ set(vcpkg_link_directories "${z_vcpkg_@PORT@_root}/lib" "${z_vcpkg_@PORT@_root}/debug/lib")
+ endif()
+ foreach(lib IN LISTS libraries)
+ if(lib MATCHES [[^/|^(dl|m|pthread)$|^-framework ]])
+ list(APPEND libs "${lib}")
+ elseif(EXISTS "${lib}")
+ list(APPEND libs "${lib}")
+ else()
+ string(MAKE_C_IDENTIFIER "${out_var}_${lib}_${type}" lib_var)
+ find_library("${lib_var}" NAMES "${lib}" NAMES_PER_DIR PATHS ${vcpkg_link_directories})
+ mark_as_advanced("${lib_var}")
+ if(${lib_var})
+ list(APPEND libs "${${lib_var}}")
+ else()
+ find_library("${lib_var}" NAMES "${lib}" NAMES_PER_DIR PATHS ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES} NO_DEFAULT_PATH)
+ if(${lib_var})
+ list(APPEND libs "${lib}")
+ else()
+ message(WARNING "Omitting '${lib}' from link libraries.")
+ endif()
+ endif()
+ endif()
+ endforeach()
+ set("${out_var}" "${libs}" PARENT_SCOPE)
+ endfunction()
+endif()
+
+get_filename_component(z_vcpkg_@PORT@_root "${CMAKE_CURRENT_LIST_DIR}" PATH)
+get_filename_component(z_vcpkg_@PORT@_root "${z_vcpkg_@PORT@_root}" PATH)
+
+file(GLOB z_vcpkg_@PORT@_config_files "${CMAKE_CURRENT_LIST_DIR}/unofficial-@PORT@-*-targets.cmake")
+foreach(z_vcpkg_@PORT@_config_file IN LISTS z_vcpkg_@PORT@_config_files)
+ include("${z_vcpkg_@PORT@_config_file}")
+endforeach()
+
+unset(z_vcpkg_@PORT@_config_file)
+unset(z_vcpkg_@PORT@_config_files)
+unset(z_vcpkg_@PORT@_root)
diff --git a/vcpkg/ports/skia/unofficial-skia-targets-details.cmake b/vcpkg/ports/skia/unofficial-skia-targets-details.cmake
new file mode 100644
index 0000000..9d74800
--- /dev/null
+++ b/vcpkg/ports/skia/unofficial-skia-targets-details.cmake
@@ -0,0 +1,18 @@
+# Exported from "@gn_target@"
+if("@not_executable@")
+ set_property(TARGET @cmake_target@ APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:\$<@cmake_config_genex@:@interface_link_targets@>>")
+endif()
+if("@has_location@")
+ set_property(TARGET @cmake_target@ APPEND PROPERTY IMPORTED_CONFIGURATIONS "@cmake_build_type@")
+ set_target_properties(@cmake_target@ PROPERTIES IMPORTED_LOCATION_@cmake_build_type@ "@imported_location@")
+ if("@not_executable@")
+ set_property(TARGET @cmake_target@ APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "\$<@cmake_config_genex@:@interface_compile_definitions@>")
+ set_target_properties(@cmake_target@ PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "@CURRENT_PACKAGES_DIR@/include/@PORT@"
+ IMPORTED_LINK_INTERFACE_LANGUAGES_@cmake_build_type@ "@link_language@"
+ )
+ z_vcpkg_@PORT@_get_link_libraries(z_vcpkg_@PORT@_link_libs "@cmake_build_type@" "@interface_link_libs@")
+ set_property(TARGET @cmake_target@ APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:\$<@cmake_config_genex@:${z_vcpkg_@PORT@_link_libs}>>")
+ unset(z_vcpkg_@PORT@_link_libs)
+ endif()
+endif()
diff --git a/vcpkg/ports/skia/unofficial-skia-targets.cmake b/vcpkg/ports/skia/unofficial-skia-targets.cmake
new file mode 100644
index 0000000..7c0c35f
--- /dev/null
+++ b/vcpkg/ports/skia/unofficial-skia-targets.cmake
@@ -0,0 +1,8 @@
+# Exported from "@gn_target@"
+if(NOT TARGET @cmake_target@)
+ @add_target@
+ if("@not_executable@")
+ include("${CMAKE_CURRENT_LIST_DIR}/@basename@-targets-debug.cmake" OPTIONAL)
+ endif()
+ include("${CMAKE_CURRENT_LIST_DIR}/@basename@-targets-release.cmake")
+endif()
diff --git a/vcpkg/ports/skia/usage b/vcpkg/ports/skia/usage
new file mode 100644
index 0000000..7b1bdb3
--- /dev/null
+++ b/vcpkg/ports/skia/usage
@@ -0,0 +1,6 @@
+skia provides CMake targets:
+
+ find_package(unofficial-skia CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE unofficial::skia::skia)
+
+ # Similar for optional components, e.g. unofficial::skia::modules::skparagraph
diff --git a/vcpkg/ports/skia/use-pkgconfig-to-find-gl.patch b/vcpkg/ports/skia/use-pkgconfig-to-find-gl.patch
new file mode 100644
index 0000000..0f82b71
--- /dev/null
+++ b/vcpkg/ports/skia/use-pkgconfig-to-find-gl.patch
@@ -0,0 +1,15 @@
+diff --git a/BUILD.gn b/BUILD.gn
+index ce41442..9a90d00 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -1007,7 +1007,9 @@ optional("gpu") {
+ "src/gpu/ganesh/gl/glx/GrGLMakeGLXInterface.cpp",
+ "src/gpu/ganesh/gl/glx/GrGLMakeNativeInterface_glx.cpp",
+ ]
+- libs += [ "GL" ]
++ deps += [
++ "//third_party/gl"
++ ]
+ } else if (is_mac) {
+ sources += [ "src/gpu/ganesh/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
+ } else if (is_ios) {
diff --git a/vcpkg/ports/skia/vcpkg.json b/vcpkg/ports/skia/vcpkg.json
new file mode 100644
index 0000000..34a5ed1
--- /dev/null
+++ b/vcpkg/ports/skia/vcpkg.json
@@ -0,0 +1,216 @@
+{
+ "name": "skia",
+ "version": "140",
+ "port-version": 2,
+ "description": [
+ "Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and software platforms.",
+ "It serves as the graphics engine for Google Chrome and Chrome OS, Android, Mozilla Firefox and Firefox OS, and many other products.",
+ "Skia is sponsored and managed by Google, but is available for use by anyone under the BSD Free Software License. While engineering of the core components is done by the Skia development team, we consider contributions from any source."
+ ],
+ "homepage": "https://skia.org",
+ "license": "BSD-3-Clause",
+ "supports": "!(windows & arm32) & !mingw",
+ "dependencies": [
+ "abseil",
+ "expat",
+ {
+ "name": "opengl",
+ "default-features": false,
+ "platform": "windows & !arm64 & !uwp"
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-get-vars",
+ "host": true
+ },
+ {
+ "name": "vcpkg-gn",
+ "host": true
+ },
+ {
+ "name": "vcpkg-pkgconfig-get-modules",
+ "host": true
+ },
+ {
+ "name": "vcpkg-tool-gn",
+ "host": true
+ },
+ "zlib"
+ ],
+ "default-features": [
+ {
+ "name": "direct3d",
+ "platform": "uwp"
+ },
+ {
+ "name": "dng",
+ "platform": "!bsd"
+ },
+ {
+ "name": "fontconfig",
+ "platform": "linux | bsd"
+ },
+ {
+ "name": "freetype",
+ "platform": "!(windows | osx | ios)"
+ },
+ {
+ "name": "gl",
+ "platform": "!(windows & arm) & !uwp"
+ },
+ {
+ "name": "harfbuzz",
+ "platform": "!uwp"
+ },
+ {
+ "name": "icu",
+ "platform": "!uwp"
+ },
+ "jpeg",
+ "png",
+ "webp"
+ ],
+ "features": {
+ "avif": {
+ "description": "AVIF support",
+ "dependencies": [
+ "libavif"
+ ]
+ },
+ "dawn": {
+ "description": "dawn support for skia",
+ "supports": "!android & !uwp",
+ "dependencies": [
+ {
+ "name": "dawn",
+ "default-features": false,
+ "features": [
+ "x11"
+ ],
+ "platform": "linux | bsd"
+ },
+ {
+ "name": "dawn",
+ "platform": "osx | windows"
+ },
+ {
+ "name": "skia",
+ "default-features": false,
+ "features": [
+ "graphite"
+ ]
+ }
+ ]
+ },
+ "direct3d": {
+ "description": "Direct3D support for skia",
+ "supports": "windows"
+ },
+ "dng": {
+ "description": "Support for DNG files",
+ "supports": "!bsd"
+ },
+ "fontconfig": {
+ "description": "Fontconfig support",
+ "dependencies": [
+ "fontconfig",
+ {
+ "name": "skia",
+ "default-features": false,
+ "features": [
+ "freetype"
+ ]
+ }
+ ]
+ },
+ "freetype": {
+ "description": "Freetype support",
+ "dependencies": [
+ {
+ "name": "dlfcn-win32",
+ "platform": "windows"
+ },
+ {
+ "name": "freetype",
+ "default-features": false
+ }
+ ]
+ },
+ "gl": {
+ "description": "OpenGL support for skia",
+ "supports": "!(windows & arm) & !uwp",
+ "dependencies": [
+ "opengl-registry"
+ ]
+ },
+ "graphite": {
+ "description": "Graphite support",
+ "dependencies": [
+ {
+ "name": "skia",
+ "default-features": false,
+ "features": [
+ "vulkan"
+ ]
+ }
+ ]
+ },
+ "harfbuzz": {
+ "description": "Harfbuzz support",
+ "dependencies": [
+ {
+ "name": "harfbuzz",
+ "default-features": false
+ },
+ {
+ "name": "skia",
+ "default-features": false,
+ "features": [
+ "icu"
+ ]
+ }
+ ]
+ },
+ "icu": {
+ "description": "Use icu.",
+ "dependencies": [
+ "icu"
+ ]
+ },
+ "jpeg": {
+ "description": "Jpeg support",
+ "dependencies": [
+ "libjpeg-turbo"
+ ]
+ },
+ "metal": {
+ "description": "Metal support for skia",
+ "supports": "ios, osx"
+ },
+ "pdf": {
+ "description": "PDF backend"
+ },
+ "png": {
+ "description": "PNG support",
+ "dependencies": [
+ "libpng"
+ ]
+ },
+ "vulkan": {
+ "description": "Vulkan support for skia",
+ "dependencies": [
+ "vulkan-headers",
+ "vulkan-memory-allocator"
+ ]
+ },
+ "webp": {
+ "description": "WebP support",
+ "dependencies": [
+ "libwebp"
+ ]
+ }
+ }
+}
diff --git a/vcpkg/ports/skia/vulkan-headers.patch b/vcpkg/ports/skia/vulkan-headers.patch
new file mode 100644
index 0000000..358236b
--- /dev/null
+++ b/vcpkg/ports/skia/vulkan-headers.patch
@@ -0,0 +1,43 @@
+diff --git a/BUILD.gn b/BUILD.gn
+index 3626895824..31a7fdbc33 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -938,6 +938,7 @@ optional("gpu_shared") {
+ }
+
+ if (skia_use_vulkan) {
++ public_deps += [ "//third_party/externals/vulkan-headers:vulkan_headers" ]
+ public_defines += [ "SK_VULKAN" ]
+ sources += skia_shared_vk_sources
+ configs += [ ":use_skia_vulkan_headers" ]
+diff --git a/include/private/gpu/vk/SkiaVulkan.h b/include/private/gpu/vk/SkiaVulkan.h
+index 1e962ad60a..535ac6b88f 100644
+--- a/include/private/gpu/vk/SkiaVulkan.h
++++ b/include/private/gpu/vk/SkiaVulkan.h
+@@ -12,6 +12,10 @@
+
+ // IWYU pragma: begin_exports
+
++#ifdef SK_USE_INTERNAL_VULKAN_HEADERS
++# undef SK_USE_INTERNAL_VULKAN_HEADERS
++#endif
++
+ #if defined(SK_USE_INTERNAL_VULKAN_HEADERS) && !defined(SK_BUILD_FOR_GOOGLE3)
+ #include "include/third_party/vulkan/vulkan/vulkan_core.h"
+ #else
+diff --git a/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h b/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h
+index 487ea7cee4..9662c8cbf6 100644
+--- a/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h
++++ b/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h
+@@ -39,7 +39,11 @@
+ // VMA outside of Skia, the client should instead tell Skia not to use VMA.
+ // Then they should wrap their own instance of VMA into an implementation of
+ // Skia's VulkanMemoryAllocator interface, and pass that object into context creation.
++#ifdef _WIN32
++#include "vma/vk_mem_alloc.h" // NO_G3_REWRITE
++#else
+ #include "vk_mem_alloc.h" // NO_G3_REWRITE
++#endif
+ #ifdef GR_NEEDED_TO_DEFINE_VULKAN_H
+ #undef VULKAN_H_
+ #endif