Truly independent web browser
Meta: Build Skia with clang-cl on Windows
Zaggy1024a3f8b57295e0
diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/001-bentleyottmann-build.patch b/Meta/CMake/vcpkg/overlay-ports/skia/001-bentleyottmann-build.patchnew file mode 100644index 00000000000..336aa1a05a5--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/001-bentleyottmann-build.patch@@ -0,0 +1,14 @@+diff --git a/modules/bentleyottmann/BUILD.gn b/modules/bentleyottmann/BUILD.gn+index 86ba8f9d3d..8e5ad3ab99 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/Meta/CMake/vcpkg/overlay-ports/skia/002-graphite.patch b/Meta/CMake/vcpkg/overlay-ports/skia/002-graphite.patchnew file mode 100644index 00000000000..ed12521bd39--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/002-graphite.patch@@ -0,0 +1,12 @@+diff --git a/include/gpu/graphite/Recorder.h b/include/gpu/graphite/Recorder.h+index ca03913a63..e26bac0ed4 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/core/SkSurface.h"++#include "include/gpu/graphite/ImageProvider.h"+ #include "include/gpu/graphite/GraphiteTypes.h"+ #include "include/gpu/graphite/Recording.h"+ #include "include/private/base/SingleOwner.h"diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/003-vulkan-headers.patch b/Meta/CMake/vcpkg/overlay-ports/skia/003-vulkan-headers.patchnew file mode 100644index 00000000000..ca75b87f1a3--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/003-vulkan-headers.patch@@ -0,0 +1,43 @@+diff --git a/BUILD.gn b/BUILD.gn+index 0c14a659a2..a5bf3bf31e 100644+--- a/BUILD.gn++++ b/BUILD.gn+@@ -908,6 +908,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 aa7329fa9e..6910d12c97 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 bfcb8950a6..f82e7b5d03 100644+--- a/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h++++ b/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h+@@ -45,7 +45,11 @@+ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi"+ #endif+++#ifdef _WIN32++#include "vma/vk_mem_alloc.h" // NO_G3_REWRITE++#else+ #include "vk_mem_alloc.h" // NO_G3_REWRITE++#endif++ #if defined(__clang__)+ #pragma clang diagnostic popdiff --git a/Meta/CMake/vcpkg/overlay-ports/skia/004-pdfsubsetfont-uwp.patch b/Meta/CMake/vcpkg/overlay-ports/skia/004-pdfsubsetfont-uwp.patchnew file mode 100644index 00000000000..3980b5951e7--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/004-pdfsubsetfont-uwp.patch@@ -0,0 +1,12 @@+diff --git a/src/pdf/SkPDFSubsetFont.cpp b/src/pdf/SkPDFSubsetFont.cpp+index a8aa48a92b..69bfa17827 100644+--- a/src/pdf/SkPDFSubsetFont.cpp++++ b/src/pdf/SkPDFSubsetFont.cpp+@@ -199,6 +199,7 @@ bool SkPDFCanSubsetTableBasedFonts() {++ #else+++#include "include/core/SkData.h"+ sk_sp<SkData> SkPDFSubsetFont(const SkTypeface&, const SkPDFGlyphUse&) {+ return nullptr;+ }diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/005-skparagraph-dllexport.patch b/Meta/CMake/vcpkg/overlay-ports/skia/005-skparagraph-dllexport.patchnew file mode 100644index 00000000000..fb2620e2e32--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/005-skparagraph-dllexport.patch@@ -0,0 +1,194 @@+diff --git a/modules/skparagraph/BUILD.gn b/modules/skparagraph/BUILD.gn+index e4b94d06e2..6c31b04b5b 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 ce297c224f..5707d4a4cd 100644+--- a/modules/skparagraph/include/FontCollection.h++++ b/modules/skparagraph/include/FontCollection.h+@@ -8,6 +8,7 @@+ #include "include/core/SkFontMgr.h"+ #include "include/core/SkRefCnt.h"+ #include "include/core/SkSpan.h"++#include "modules/skparagraph/include/skparagraph_export.h"+ #include "modules/skparagraph/include/FontArguments.h"+ #include "modules/skparagraph/include/ParagraphCache.h"+ #include "modules/skparagraph/include/TextStyle.h"+@@ -17,7 +18,7 @@ namespace textlayout {++ class TextStyle;+ class Paragraph;+-class FontCollection : public SkRefCnt {++class SKPARAGRAPH_API FontCollection : public SkRefCnt {+ public:+ FontCollection();+ ~FontCollection() override;+diff --git a/modules/skparagraph/include/ParagraphBuilder.h b/modules/skparagraph/include/ParagraphBuilder.h+index 983dfc27d3..cb1907781b 100644+--- a/modules/skparagraph/include/ParagraphBuilder.h++++ b/modules/skparagraph/include/ParagraphBuilder.h+@@ -7,6 +7,7 @@+ #include <string>+ #include <tuple>+ #include <vector>++#include "modules/skparagraph/include/skparagraph_export.h"+ #include "modules/skparagraph/include/FontCollection.h"+ #include "modules/skparagraph/include/Paragraph.h"+ #include "modules/skparagraph/include/ParagraphStyle.h"+@@ -16,7 +17,7 @@+ namespace skia {+ namespace textlayout {++-class ParagraphBuilder {++class SKPARAGRAPH_API ParagraphBuilder {+ protected:+ ParagraphBuilder() {}++diff --git a/modules/skparagraph/include/ParagraphStyle.h b/modules/skparagraph/include/ParagraphStyle.h+index 0c969729b6..932ed33965 100644+--- a/modules/skparagraph/include/ParagraphStyle.h++++ b/modules/skparagraph/include/ParagraphStyle.h+@@ -5,6 +5,7 @@+ #include "include/core/SkFontStyle.h"+ #include "include/core/SkScalar.h"+ #include "include/core/SkString.h"++#include "modules/skparagraph/include/skparagraph_export.h"+ #include "modules/skparagraph/include/DartTypes.h"+ #include "modules/skparagraph/include/TextStyle.h"++@@ -75,7 +76,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 9a65834b8e..abc44b4c7f 100644+--- a/modules/skparagraph/include/TextStyle.h++++ b/modules/skparagraph/include/TextStyle.h+@@ -10,6 +10,7 @@+ #include "include/core/SkFontStyle.h"+ #include "include/core/SkPaint.h"+ #include "include/core/SkScalar.h"++#include "modules/skparagraph/include/skparagraph_export.h"+ #include "modules/skparagraph/include/DartTypes.h"+ #include "modules/skparagraph/include/FontArguments.h"+ #include "modules/skparagraph/include/ParagraphPainter.h"+@@ -148,9 +149,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;++@@ -297,8 +298,6 @@ public:+ SkFontHinting getFontHinting() const { return fHinting; }++ private:+- static const std::vector<SkString>* kDefaultFontFamilies;+-+ Decoration fDecoration = {+ TextDecoration::kNoDecoration,+ // TODO: switch back to kGaps when (if) switching flutter to skparagraph+@@ -311,7 +310,7 @@ private:++ SkFontStyle fFontStyle;++- std::vector<SkString> fFontFamilies = *kDefaultFontFamilies;++ std::vector<SkString> fFontFamilies;++ SkScalar fFontSize = 14.0;+ SkFont::Edging fEdging = SkFont::Edging::kAntiAlias;+diff --git a/modules/skparagraph/include/skparagraph_export.h b/modules/skparagraph/include/skparagraph_export.h+new file mode 100644+index 0000000000..a19b83df57+--- /dev/null++++ b/modules/skparagraph/include/skparagraph_export.h+@@ -0,0 +1,21 @@++#pragma once++++#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+diff --git a/modules/skparagraph/src/TextStyle.cpp b/modules/skparagraph/src/TextStyle.cpp+index de2dee3116..8787df30b3 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 7340c6bcaa..f04f496d43 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/Meta/CMake/vcpkg/overlay-ports/skia/006-use-pkgconfig-to-find-gl.patch b/Meta/CMake/vcpkg/overlay-ports/skia/006-use-pkgconfig-to-find-gl.patchnew file mode 100644index 00000000000..72a04f22a07--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/006-use-pkgconfig-to-find-gl.patch@@ -0,0 +1,15 @@+diff --git a/BUILD.gn b/BUILD.gn+index a5bf3bf31e..11eb26aa93 100644+--- a/BUILD.gn++++ b/BUILD.gn+@@ -993,7 +993,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/Meta/CMake/vcpkg/overlay-ports/skia/007-dont-use-response-file.patch b/Meta/CMake/vcpkg/overlay-ports/skia/007-dont-use-response-file.patchnew file mode 100644index 00000000000..00fe0163833--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/007-dont-use-response-file.patch@@ -0,0 +1,13 @@+diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn+index 4357b64d19..b71d062b82 100644+--- a/gn/toolchain/BUILD.gn++++ b/gn/toolchain/BUILD.gn+@@ -312,7 +312,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/Meta/CMake/vcpkg/overlay-ports/skia/008-fix-bsd.patch b/Meta/CMake/vcpkg/overlay-ports/skia/008-fix-bsd.patchnew file mode 100644index 00000000000..bf064019d87--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/008-fix-bsd.patch@@ -0,0 +1,48 @@+diff --git a/src/base/SkAutoLocaleSetter.h b/src/base/SkAutoLocaleSetter.h+index 90bcbb32bc..68a0f8a9e3 100644+--- a/src/base/SkAutoLocaleSetter.h++++ b/src/base/SkAutoLocaleSetter.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);+ #endifdiff --git a/Meta/CMake/vcpkg/overlay-ports/skia/009-allow-disabling-lib-dl.patch b/Meta/CMake/vcpkg/overlay-ports/skia/009-allow-disabling-lib-dl.patchnew file mode 100644index 00000000000..9ac54d25ae0--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/009-allow-disabling-lib-dl.patch@@ -0,0 +1,28 @@+diff --git a/BUILD.gn b/BUILD.gn+index 11eb26aa93..051b1da05e 100644+--- a/BUILD.gn++++ b/BUILD.gn+@@ -2009,7 +2009,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 442a4b4ba7..cd92ea657a 100644+--- a/gn/skia.gni++++ b/gn/skia.gni+@@ -113,6 +113,8 @@ declare_args() {++ skia_build_rust_targets = false+++ skia_vcpkg_has_lib_dl = true+++ # PartitionAlloc is Chrome's memory allocator.+ #+ # This is useful to:diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/010-always-build-pathops.patch b/Meta/CMake/vcpkg/overlay-ports/skia/010-always-build-pathops.patchnew file mode 100644index 00000000000..a0ff6e3b01e--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/010-always-build-pathops.patch@@ -0,0 +1,12 @@+diff --git a/BUILD.gn b/BUILD.gn+index 051b1da05e..9ed770cd94 100644+--- a/BUILD.gn++++ b/BUILD.gn+@@ -1903,6 +1903,7 @@ skia_component("skia") {+ ":gpu",+ ":graphite",+ ":jpeg_encode",++ ":pathops",+ ":pdf",+ ":pdf_jpeg_helpers",+ ":png_decode_libpng",diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/011-skstrendswith-dllexport.patch b/Meta/CMake/vcpkg/overlay-ports/skia/011-skstrendswith-dllexport.patchnew file mode 100644index 00000000000..d8e7385b154--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/011-skstrendswith-dllexport.patch@@ -0,0 +1,15 @@+diff --git a/include/core/SkString.h b/include/core/SkString.h+index fa6ace7395..9773330af3 100644+--- a/include/core/SkString.h++++ b/include/core/SkString.h+@@ -33,8 +33,8 @@ static inline bool SkStrStartsWith(const char string[], char prefixChar) {+ return (prefixChar == *string);+ }++-bool SkStrEndsWith(const char string[], const char suffixStr[]);+-bool SkStrEndsWith(const char string[], char suffixChar);++SK_API bool SkStrEndsWith(const char string[], const char suffixStr[]);++SK_API bool SkStrEndsWith(const char string[], char suffixChar);++ int SkStrStartsWithOneOf(const char string[], const char prefixes[]);+diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/012-dawn.patch b/Meta/CMake/vcpkg/overlay-ports/skia/012-dawn.patchnew file mode 100644index 00000000000..b742724a9f3--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/012-dawn.patch@@ -0,0 +1,24 @@+diff --git a/BUILD.gn b/BUILD.gn+index 9ed770cd94..5abbd2a7e3 100644+--- a/BUILD.gn++++ b/BUILD.gn+@@ -15,7 +15,6 @@ if (defined(skia_settings)) {+ }++ import("gn/ios.gni")+-import("third_party/dawn/args.gni")++ # Skia public API, generally provided by :skia.+ config("skia_public") {+diff --git a/tools/window/BUILD.gn b/tools/window/BUILD.gn+index 917715dd05..1a96a0a646 100644+--- a/tools/window/BUILD.gn++++ b/tools/window/BUILD.gn+@@ -4,7 +4,6 @@+ # found in the LICENSE file.++ import("../../gn/skia.gni")+-import("../../third_party/dawn/args.gni")++ config("public_config") {+ defines = []diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/013-skcms-dllexport.patch b/Meta/CMake/vcpkg/overlay-ports/skia/013-skcms-dllexport.patchnew file mode 100644index 00000000000..7fccac39aab--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/013-skcms-dllexport.patch@@ -0,0 +1,28 @@+diff --git a/modules/skcms/BUILD.gn b/modules/skcms/BUILD.gn+index 5d037a94c9..0ef92c4762 100644+--- a/modules/skcms/BUILD.gn++++ b/modules/skcms/BUILD.gn+@@ -85,12 +85,22 @@ static_library("skcms") {+ if (!is_win || is_clang) {+ cflags += [ "-std=c11" ]+ }++++ defines = []+ if (target_cpu != "x64" || target_os == "android") {+- defines = [++ defines += [+ "SKCMS_DISABLE_HSW",+ "SKCMS_DISABLE_SKX",+ ]+ }++++ if (is_component_build) {++ defines += [++ "SKCMS_DLL",++ "SKCMS_IMPLEMENTATION=1",++ ]++ }+++ public = skcms_public_headers+ sources = skcms_public + skcms_TransformBaseline+ deps = [diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/014-fix-direct3d.patch b/Meta/CMake/vcpkg/overlay-ports/skia/014-fix-direct3d.patchnew file mode 100644index 00000000000..111c20e8930--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/014-fix-direct3d.patch@@ -0,0 +1,39 @@+diff --git a/include/gpu/ganesh/d3d/GrD3DTypes.h b/include/gpu/ganesh/d3d/GrD3DTypes.h+index 3e6fbcd719..2759109113 100644+--- a/include/gpu/ganesh/d3d/GrD3DTypes.h++++ b/include/gpu/ganesh/d3d/GrD3DTypes.h+@@ -216,7 +216,7 @@ struct GrD3DTextureResourceInfo {+ , fSampleQualityPattern(info.fSampleQualityPattern)+ , fProtected(info.fProtected) {}++-#if defined(GPU_TEST_UTILS)++#if 1+ bool operator==(const GrD3DTextureResourceInfo& that) const {+ return fResource == that.fResource && fResourceState == that.fResourceState &&+ fFormat == that.fFormat && fSampleCount == that.fSampleCount &&+diff --git a/include/private/gpu/ganesh/GrD3DTypesMinimal.h b/include/private/gpu/ganesh/GrD3DTypesMinimal.h+index 84db9c1567..2bf9c2755d 100644+--- a/include/private/gpu/ganesh/GrD3DTypesMinimal.h++++ b/include/private/gpu/ganesh/GrD3DTypesMinimal.h+@@ -48,7 +48,7 @@ struct GrD3DBackendSurfaceInfo {+ GrD3DTextureResourceInfo snapTextureResourceInfo() const;++ bool isProtected() const;+-#if defined(GPU_TEST_UTILS)++#if 1+ bool operator==(const GrD3DBackendSurfaceInfo& that) const;+ #endif++diff --git a/src/gpu/ganesh/d3d/GrD3DTypesMinimal.cpp b/src/gpu/ganesh/d3d/GrD3DTypesMinimal.cpp+index a8388a80fd..f2ed2fa886 100644+--- a/src/gpu/ganesh/d3d/GrD3DTypesMinimal.cpp++++ b/src/gpu/ganesh/d3d/GrD3DTypesMinimal.cpp+@@ -54,7 +54,7 @@ bool GrD3DBackendSurfaceInfo::isProtected() const {+ return fTextureResourceInfo->fProtected == GrProtected::kYes;+ }++-#if defined(GPU_TEST_UTILS)++#if 1+ bool GrD3DBackendSurfaceInfo::operator==(const GrD3DBackendSurfaceInfo& that) const {+ GrD3DTextureResourceInfo cpyInfoThis = *fTextureResourceInfo;+ GrD3DTextureResourceInfo cpyInfoThat = *that.fTextureResourceInfo;diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/example/CMakeLists.txt b/Meta/CMake/vcpkg/overlay-ports/skia/example/CMakeLists.txtnew file mode 100644index 00000000000..e89443780ea--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/example/CMakeLists.txt@@ -0,0 +1,20 @@+cmake_minimum_required(VERSION 3.15)++project(skia-example)++set(CMAKE_CXX_STANDARD 20)++add_executable(legacy convert-to-nia.cpp)+find_package(skia CONFIG REQUIRED)+target_link_libraries(legacy PRIVATE skia)++find_package(unofficial-skia CONFIG REQUIRED)++add_executable(main convert-to-nia.cpp)+target_link_libraries(main PRIVATE unofficial::skia::skia unofficial::skia::modules::skshaper)++add_executable(skcms skcms.cpp)+target_link_libraries(skcms PRIVATE unofficial::skia::skia)++add_executable(skpathediting skpathediting.cpp)+target_link_libraries(skpathediting PRIVATE unofficial::skia::skia)diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/example/skcms.cpp b/Meta/CMake/vcpkg/overlay-ports/skia/example/skcms.cppnew file mode 100644index 00000000000..c9bb18f2890--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/example/skcms.cpp@@ -0,0 +1,12 @@+#include <modules/skcms/skcms.h>++int main() {+ float src_pixels[4] = {0.8f, 0.3f, 0.2f, 1.0f};+ float dst_pixels[4] = {};++ skcms_Transform(+ src_pixels, skcms_PixelFormat_RGBA_ffff, skcms_AlphaFormat_Unpremul, skcms_sRGB_profile(),+ dst_pixels, skcms_PixelFormat_RGBA_ffff, skcms_AlphaFormat_Unpremul, skcms_XYZD50_profile(),+ 1+ );+}diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/example/skpathediting.cpp b/Meta/CMake/vcpkg/overlay-ports/skia/example/skpathediting.cppnew file mode 100644index 00000000000..a5368189c3d--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/example/skpathediting.cpp@@ -0,0 +1,11 @@+#include <core/SkPath.h>+#include <core/SkPathBuilder.h>++int main() {+ SkPathBuilder builder;+ builder.moveTo(50, 50);+ builder.lineTo(150, 50);+ builder.lineTo(100, 150);+ builder.close();+ SkPath path = builder.detach();+}diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/portfile.cmake b/Meta/CMake/vcpkg/overlay-ports/skia/portfile.cmakenew file mode 100644index 00000000000..c9c32662bb8--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/portfile.cmake@@ -0,0 +1,368 @@+include("${CMAKE_CURRENT_LIST_DIR}/skia-functions.cmake")++vcpkg_from_github(+ OUT_SOURCE_PATH SOURCE_PATH+ REPO google/skia+ REF e7c90ecca9444fe09598f1630ab7cee2c0ee027a+ SHA512 f52286fcac1d1b2b45046d7df72cee384b664f0b512c4b4a76bca743747f2113fef6991059b4e71ad804d0209103003ba0f01aa90afac786de20a52e8484018d+ PATCHES+ 001-bentleyottmann-build.patch+ 002-graphite.patch+ 003-vulkan-headers.patch+ 004-pdfsubsetfont-uwp.patch+ 005-skparagraph-dllexport.patch+ 006-use-pkgconfig-to-find-gl.patch+ 007-dont-use-response-file.patch+ 008-fix-bsd.patch+ 009-allow-disabling-lib-dl.patch+ 010-always-build-pathops.patch+ 011-skstrendswith-dllexport.patch+ 012-dawn.patch+ 013-skcms-dllexport.patch++ # Used in src/gpu/ganesh/d3d/GrD3DBackendSurface.cpp:118, next time we update skia port, check if this patch is still needed+ 014-fix-direct3d.patch+)++# De-vendor+file(REMOVE_RECURSE "${SOURCE_PATH}/include/third_party/vulkan")+file(REMOVE_RECURSE "${SOURCE_PATH}/third_party/dawn")++# 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 "c3027d884967773057bf74b957e3fea87e5df4d7"+ LICENSE_FILE LICENSE.rst+)+declare_external_from_git(markupsafe+ URL "https://chromium.googlesource.com/chromium/src/third_party/markupsafe"+ REF "4256084ae14175d38a3ff7d739dca83ae49ccec6"+ LICENSE_FILE LICENSE+)+declare_external_from_git(partition_alloc+ URL "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git"+ REF "b8c0688f577c1bbce6c2c1ce4753cd685ca0f634"+ 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 "6dd7ba990830f7c15ac1345ff3b43ef6ffdad216"+ LICENSE_FILE LICENSE+)+declare_external_from_git(spirv-tools+ URL "https://github.com/KhronosGroup/SPIRV-Tools.git"+ REF "2d14d2e76aa7de72404b17078eda15c20a6a0389"+ 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_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)+ string(APPEND OPTIONS " skia_use_egl=true")+ 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)+ if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")+ list(APPEND required_externals+ spirv-tools+ spirv-headers+ )+ endif()+ 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+ 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}\"")+ if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "Clang")+ cmake_path(GET VCPKG_DETECTED_CMAKE_CXX_COMPILER PARENT_PATH llvm_bin_dir)+ cmake_path(GET llvm_bin_dir PARENT_PATH llvm_dir)+ if(EXISTS "${llvm_dir}/bin/clang-cl.exe" AND EXISTS "${llvm_dir}/bin/lld-link.exe" AND IS_DIRECTORY "${llvm_dir}/lib/clang")+ string(APPEND OPTIONS " clang_win=\"${llvm_dir}\"")+ else()+ message(WARNING "${VCPKG_DETECTED_CMAKE_CXX_COMPILER} is not in an LLVM release layout, so Skia will be built with MSVC.")+ endif()+ endif()+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()++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")++# 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"+ "${CMAKE_CURRENT_LIST_DIR}/example/skcms.cpp"+ "${CMAKE_CURRENT_LIST_DIR}/example/skpathediting.cpp"+ "${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/Meta/CMake/vcpkg/overlay-ports/skia/skia-functions.cmake b/Meta/CMake/vcpkg/overlay-ports/skia/skia-functions.cmakenew file mode 100644index 00000000000..0a3c0e4236e--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-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/Meta/CMake/vcpkg/overlay-ports/skia/skiaConfig.cmake b/Meta/CMake/vcpkg/overlay-ports/skia/skiaConfig.cmakenew file mode 100644index 00000000000..b86605711c5--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-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/Meta/CMake/vcpkg/overlay-ports/skia/third-party.gn.in b/Meta/CMake/vcpkg/overlay-ports/skia/third-party.gn.innew file mode 100644index 00000000000..b2c981692fa--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-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/Meta/CMake/vcpkg/overlay-ports/skia/unofficial-skia-config.cmake b/Meta/CMake/vcpkg/overlay-ports/skia/unofficial-skia-config.cmakenew file mode 100644index 00000000000..930511feff8--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-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/Meta/CMake/vcpkg/overlay-ports/skia/unofficial-skia-targets-details.cmake b/Meta/CMake/vcpkg/overlay-ports/skia/unofficial-skia-targets-details.cmakenew file mode 100644index 00000000000..9d74800ed7f--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-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/Meta/CMake/vcpkg/overlay-ports/skia/unofficial-skia-targets.cmake b/Meta/CMake/vcpkg/overlay-ports/skia/unofficial-skia-targets.cmakenew file mode 100644index 00000000000..7c0c35f190f--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-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}/@[email protected]" OPTIONAL)+ endif()+ include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")+endif()diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/usage b/Meta/CMake/vcpkg/overlay-ports/skia/usagenew file mode 100644index 00000000000..7b1bdb3f45b--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-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::skparagraphdiff --git a/Meta/CMake/vcpkg/overlay-ports/skia/vcpkg.json b/Meta/CMake/vcpkg/overlay-ports/skia/vcpkg.jsonnew file mode 100644index 00000000000..00aee8729b0--- /dev/null+++ b/Meta/CMake/vcpkg/overlay-ports/skia/vcpkg.json@@ -0,0 +1,216 @@+{+ "name": "skia",+ "version": "148",+ "port-version": 1,+ "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/Meta/Linters/lint_clang_format.py b/Meta/Linters/lint_clang_format.pyindex 6a5dbc041e1..66377ed2b21 100755--- a/Meta/Linters/lint_clang_format.py+++ b/Meta/Linters/lint_clang_format.py@@ -72,6 +72,7 @@ def get_files_to_format(use_git: bool, additional_files: List[str]) -> List[str]"*.h","*.mm",":!:Base",+ ":!:Meta/CMake/vcpkg/overlay-ports/skia/example",],return_output=True,)diff --git a/Tests/LibWeb/Screenshot/input/css-compositing.html b/Tests/LibWeb/Screenshot/input/css-compositing.htmlindex 28b96004a30..7ee286b5b9f 100644--- a/Tests/LibWeb/Screenshot/input/css-compositing.html+++ b/Tests/LibWeb/Screenshot/input/css-compositing.html@@ -1,5 +1,5 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-3;totalPixels=0-3529">+<meta name="fuzzy" content="maxDifference=0-3;totalPixels=0-2915"><style>div {position: absolute;diff --git a/Tests/LibWeb/Screenshot/input/css-filter.html b/Tests/LibWeb/Screenshot/input/css-filter.htmlindex 63ef54af099..1fbc8383a2d 100644--- a/Tests/LibWeb/Screenshot/input/css-filter.html+++ b/Tests/LibWeb/Screenshot/input/css-filter.html@@ -1,6 +1,6 @@<!DOCTYPE html><html>-<meta name="fuzzy" content="maxDifference=0-2;totalPixels=0-4587">+<meta name="fuzzy" content="maxDifference=0-2;totalPixels=0-1742"><style>body {font-size: 0;diff --git a/Tests/LibWeb/Screenshot/input/css-gradients.html b/Tests/LibWeb/Screenshot/input/css-gradients.htmlindex 0e5b555ee18..5187280f085 100644--- a/Tests/LibWeb/Screenshot/input/css-gradients.html+++ b/Tests/LibWeb/Screenshot/input/css-gradients.html@@ -1,6 +1,6 @@<!DOCTYPE html><!-- Rounding at the cached chevron tile's hard stops can differ at 20 pixels per tile across 25 tiles. -->-<meta name="fuzzy" content="maxDifference=0-162;totalPixels=0-610">+<meta name="fuzzy" content="maxDifference=0-162;totalPixels=0-575"><style>body {background-color: white;diff --git a/Tests/LibWeb/Screenshot/input/gradient-interpolation-method.html b/Tests/LibWeb/Screenshot/input/gradient-interpolation-method.htmlindex 4887737d7d6..158d44696d5 100644--- a/Tests/LibWeb/Screenshot/input/gradient-interpolation-method.html+++ b/Tests/LibWeb/Screenshot/input/gradient-interpolation-method.html@@ -1,5 +1,5 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-13">+<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-31"><style>div {width: 480px;diff --git a/Tests/LibWeb/Screenshot/input/image-transformation-anti-aliasing.html b/Tests/LibWeb/Screenshot/input/image-transformation-anti-aliasing.htmlindex f0b32125e3b..502faaafe36 100644--- a/Tests/LibWeb/Screenshot/input/image-transformation-anti-aliasing.html+++ b/Tests/LibWeb/Screenshot/input/image-transformation-anti-aliasing.html@@ -1,5 +1,5 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-858">+<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-552"><style>div {perspective: 900px;diff --git a/Tests/LibWeb/Screenshot/input/object-fit-position.html b/Tests/LibWeb/Screenshot/input/object-fit-position.htmlindex 75e0eedb36c..e8abad88e92 100644--- a/Tests/LibWeb/Screenshot/input/object-fit-position.html+++ b/Tests/LibWeb/Screenshot/input/object-fit-position.html@@ -1,5 +1,5 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-625">+<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-550"><style>.images img {border: 1px solid black;diff --git a/Tests/LibWeb/Screenshot/input/svg-feTurbulence-fractalNoise.html b/Tests/LibWeb/Screenshot/input/svg-feTurbulence-fractalNoise.htmlindex 29bce0e44b4..45b4a18e9a9 100644--- a/Tests/LibWeb/Screenshot/input/svg-feTurbulence-fractalNoise.html+++ b/Tests/LibWeb/Screenshot/input/svg-feTurbulence-fractalNoise.html@@ -1,5 +1,4 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-2"><style>* { margin: 0; }body { background-color: white; }diff --git a/Tests/LibWeb/Screenshot/input/svg-gradient-componentTransfer.html b/Tests/LibWeb/Screenshot/input/svg-gradient-componentTransfer.htmlindex 3242b7bce05..f6d3591b374 100644--- a/Tests/LibWeb/Screenshot/input/svg-gradient-componentTransfer.html+++ b/Tests/LibWeb/Screenshot/input/svg-gradient-componentTransfer.html@@ -1,5 +1,4 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-6;totalPixels=0-16500"><style>svg {margin: 5px;diff --git a/Tests/LibWeb/Screenshot/input/svg-gradient-spreadMethod.html b/Tests/LibWeb/Screenshot/input/svg-gradient-spreadMethod.htmlindex 0d78ac437f6..6bfd319a289 100644--- a/Tests/LibWeb/Screenshot/input/svg-gradient-spreadMethod.html+++ b/Tests/LibWeb/Screenshot/input/svg-gradient-spreadMethod.html@@ -1,5 +1,5 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-44">+<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-43"><style>* {margin: 0;diff --git a/Tests/LibWeb/Screenshot/input/svg-stroke-paintstyle-with-opacity.html b/Tests/LibWeb/Screenshot/input/svg-stroke-paintstyle-with-opacity.htmlindex 0b840c3cee1..13552c09f48 100644--- a/Tests/LibWeb/Screenshot/input/svg-stroke-paintstyle-with-opacity.html+++ b/Tests/LibWeb/Screenshot/input/svg-stroke-paintstyle-with-opacity.html@@ -1,5 +1,5 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-5600">+<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-2540"><style>body {background-color: white;diff --git a/Tests/LibWeb/Screenshot/input/video-object-fit.html b/Tests/LibWeb/Screenshot/input/video-object-fit.htmlindex 10f6cd57dee..8e79f617f88 100644--- a/Tests/LibWeb/Screenshot/input/video-object-fit.html+++ b/Tests/LibWeb/Screenshot/input/video-object-fit.html@@ -1,5 +1,5 @@<!DOCTYPE html>-<meta name="fuzzy" content="maxDifference=0-3;totalPixels=0-1240666">+<meta name="fuzzy" content="maxDifference=0-2;totalPixels=0-1240081"><html class="reftest-wait"><div><h2>480x240</h2>