diff --git a/ports/skia/add-missing-tuple.patch b/ports/skia/add-missing-tuple.patch deleted file mode 100644 index e33d44e3aefa0a..00000000000000 --- a/ports/skia/add-missing-tuple.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/include/private/SkPathRef.h b/include/private/SkPathRef.h -index 7afe4f9..502f83e 100644 ---- a/include/private/SkPathRef.h -+++ b/include/private/SkPathRef.h -@@ -21,6 +21,7 @@ - - #include - #include -+#include - - class SkRBuffer; - class SkWBuffer; diff --git a/ports/skia/dawn_use_vcpkg_spirv.patch b/ports/skia/dawn_use_vcpkg_spirv.patch new file mode 100644 index 00000000000000..08cfa51ab0119f --- /dev/null +++ b/ports/skia/dawn_use_vcpkg_spirv.patch @@ -0,0 +1,13 @@ +diff --git a/src/dawn_native/BUILD.gn b/src/dawn_native/BUILD.gn +index f73bfe24..e37792a0 100644 +--- a/src/dawn_native/BUILD.gn ++++ b/src/dawn_native/BUILD.gn +@@ -145,7 +145,7 @@ source_set("dawn_native_sources") { + ":dawn_native_headers", + ":dawn_native_utils_gen", + "${dawn_root}/src/common", +- "${dawn_root}/third_party/gn/spirv_cross:spirv_cross", ++ "//third_party/spirv-cross:spirv_cross", + "${dawn_spirv_tools_dir}:spvtools_opt", + "${dawn_spirv_tools_dir}:spvtools_val", + "${dawn_tint_dir}/src:libtint", diff --git a/ports/skia/fontconfig.gn b/ports/skia/fontconfig.gn new file mode 100644 index 00000000000000..3814d8a6103a9d --- /dev/null +++ b/ports/skia/fontconfig.gn @@ -0,0 +1,10 @@ +import("../third_party.gni") + +system("fontconfig") { + include_dirs = @_INCLUDES@ + if(is_debug) { + libs = @_LIBS_DBG@ + } else { + libs = @_LIBS_REL@ + } +} diff --git a/ports/skia/portfile.cmake b/ports/skia/portfile.cmake index dc6881eecf5350..90c53f8ff18dbd 100644 --- a/ports/skia/portfile.cmake +++ b/ports/skia/portfile.cmake @@ -1,8 +1,9 @@ vcpkg_from_git( OUT_SOURCE_PATH SOURCE_PATH URL https://skia.googlesource.com/skia.git - REF fb0b35fed5580d49392df7ce9374551b348fffbf - PATCHES add-missing-tuple.patch + REF a40ddcd63d40d647fcc5ed3b11acd2fa8ee834ed + PATCHES + "use_vcpkg_fontconfig.patch" ) function(checkout_in_path PATH URL REF) @@ -19,6 +20,21 @@ function(checkout_in_path PATH URL REF) file(REMOVE_RECURSE "${DEP_SOURCE_PATH}") endfunction() +function(checkout_in_path_with_patch PATH URL REF PATCH) + if(EXISTS "${PATH}") + return() + endif() + + vcpkg_from_git( + OUT_SOURCE_PATH DEP_SOURCE_PATH + URL "${URL}" + REF "${REF}" + PATCHES "${PATCH}" + ) + file(RENAME "${DEP_SOURCE_PATH}" "${PATH}") + file(REMOVE_RECURSE "${DEP_SOURCE_PATH}") +endfunction() + set(EXTERNALS "${SOURCE_PATH}/third_party/externals") file(MAKE_DIRECTORY "${EXTERNALS}") @@ -33,7 +49,7 @@ checkout_in_path("${EXTERNALS}/dng_sdk" ) checkout_in_path("${EXTERNALS}/libgifcodec" "https://skia.googlesource.com/libgifcodec" - "d06d2a6d42baf6c0c91cacc28df2542a911d05fe" + "fd59fa92a0c86788dcdd84d091e1ce81eda06a77" ) checkout_in_path("${EXTERNALS}/piex" "https://android.googlesource.com/platform/external/piex" @@ -94,7 +110,7 @@ set(_INCLUDE_DIR "${CURRENT_INSTALLED_DIR}/include") replace_skia_dep(expat "/include" "libexpat,libexpatd,libexpatdMD" "libexpat,libexpatMD" "") replace_skia_dep(freetype2 "/include" "freetype,freetyped" "freetype" "") -replace_skia_dep(harfbuzz "/include/harfbuzz" "harfbuzz-icu" "harfbuzz-icu" "") +replace_skia_dep(harfbuzz "/include/harfbuzz" "harfbuzz;harfbuzz-icu;harfbuzz-subset" "harfbuzz;harfbuzz-icu;harfbuzz-subset" "") replace_skia_dep(icu "/include" "icuuc,icuucd" "icuuc" "U_USING_ICU_NAMESPACE=0") replace_skia_dep(libjpeg-turbo "/include" "jpeg,jpegd;turbojpeg,turbojpegd" "jpeg;turbojpeg" "") replace_skia_dep(libpng "/include" "libpng16,libpng16d" "libpng16" "") @@ -102,28 +118,115 @@ replace_skia_dep(libwebp "/include" "webp,webpd;webpdemux,webpdemuxd;webpdecoder,webpdecoderd;libwebpmux,libwebpmuxd" "webp;webpdemux;webpdecoder;libwebpmux" "") replace_skia_dep(zlib "/include" "z,zlib,zlibd" "z,zlib" "") +replace_skia_dep(fontconfig "/include" "fontconfig" "fontconfig" "") set(OPTIONS "\ -skia_use_lua=false \ -skia_enable_tools=false \ -skia_enable_spirv_validation=false") - -if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") - set(OPTIONS "${OPTIONS} target_cpu=\"arm64\"") -endif() + skia_use_lua=false \ + skia_enable_tools=false \ + skia_enable_spirv_validation=false \ + target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\"") # used for passing feature-specific definitions to the config file -set(SKIA_PUBLIC_DEFINITIONS "") +set(SKIA_PUBLIC_DEFINITIONS + SK_SUPPORT_PDF + SK_HAS_JPEG_LIBRARY + SK_USE_LIBGIFCODEC + SK_HAS_PNG_LIBRARY + SK_HAS_WEBP_LIBRARY + SK_XML) if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(OPTIONS "${OPTIONS} is_component_build=true") + if(CMAKE_HOST_WIN32) + set(SKIA_PUBLIC_DEFINITIONS SKIA_DLL) + endif() else() set(OPTIONS "${OPTIONS} is_component_build=false") endif() -if("metal" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} skia_use_metal=true") - list(APPEND SKIA_PUBLIC_DEFINITIONS SK_METAL) +if(CMAKE_HOST_APPLE) + if("metal" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} skia_use_metal=true") + list(APPEND SKIA_PUBLIC_DEFINITIONS SK_METAL) + endif() +endif() + +if("vulkan" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} skia_use_vulkan=true") + list(APPEND SKIA_PUBLIC_DEFINITIONS SK_VULKAN) +endif() + +if(CMAKE_HOST_WIN32) + if("direct3d" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} skia_use_direct3d=true") + list(APPEND SKIA_PUBLIC_DEFINITIONS SK_DIRECT3D) + + checkout_in_path("${EXTERNALS}/spirv-cross" + "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross" + "bdbef7b1f3982fe99a62d076043036abe6dd6d80" + ) + + checkout_in_path("${EXTERNALS}/spirv-headers" + "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git" + "cf653e4ca4858583802b0d1656bc934edff6bd7f" + ) + + checkout_in_path("${EXTERNALS}/spirv-tools" + "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git" + "11cd875ed88484f93943071083b4821b4c3d2193" + ) + + checkout_in_path("${EXTERNALS}/d3d12allocator" + "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git" + "169895d529dfce00390a20e69c2f516066fe7a3b" + ) + endif() +endif() + +if("dawn" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} skia_use_dawn=true") + list(APPEND SKIA_PUBLIC_DEFINITIONS SK_DAWN) + + checkout_in_path("${EXTERNALS}/spirv-cross" + "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross" + "bdbef7b1f3982fe99a62d076043036abe6dd6d80" + ) + + checkout_in_path("${EXTERNALS}/spirv-headers" + "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git" + "cf653e4ca4858583802b0d1656bc934edff6bd7f" + ) + + checkout_in_path("${EXTERNALS}/spirv-tools" + "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git" + "11cd875ed88484f93943071083b4821b4c3d2193" + ) + + checkout_in_path("${EXTERNALS}/tint" + "https://dawn.googlesource.com/tint" + "b612c505939bf86c80a55c193b93c41ed0f252a1" + ) + + checkout_in_path("${EXTERNALS}/jinja2" + "https://chromium.googlesource.com/chromium/src/third_party/jinja2" + "a82a4944a7f2496639f34a89c9923be5908b80aa" + ) + + checkout_in_path("${EXTERNALS}/markupsafe" + "https://chromium.googlesource.com/chromium/src/third_party/markupsafe" + "0944e71f4b2cb9a871bcbe353f95e889b64a611a" + ) + + checkout_in_path_with_patch("${EXTERNALS}/dawn" + "https://dawn.googlesource.com/dawn.git" + "9096fc290f8677a0d395e4a5b6bf1443553629d6" + "dawn_use_vcpkg_spirv.patch" + ) +endif() + +if("gl" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} skia_use_gl=true") + list(APPEND SKIA_PUBLIC_DEFINITIONS SK_GL) endif() set(OPTIONS_REL "${OPTIONS} is_official_build=true") @@ -164,17 +267,35 @@ if(CMAKE_HOST_WIN32) endif() -vcpkg_configure_gn( +vcpkg_gn_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS_DEBUG "${OPTIONS_DBG}" OPTIONS_RELEASE "${OPTIONS_REL}" ) -vcpkg_install_gn( +vcpkg_gn_install( SOURCE_PATH "${SOURCE_PATH}" TARGETS ":skia" ) +if("dawn" IN_LIST FEATURES) + if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + vcpkg_gn_install( + SOURCE_PATH "${SOURCE_PATH}" + TARGETS + "third_party/externals/dawn/src/dawn:dawn_proc_shared" + "third_party/externals/dawn/src/dawn_native:dawn_native_shared" + "third_party/externals/dawn/src/dawn_platform:dawn_platform_shared") + else() + vcpkg_gn_install( + SOURCE_PATH "${SOURCE_PATH}" + TARGETS + "third_party/externals/dawn/src/dawn:dawn_proc_static" + "third_party/externals/dawn/src/dawn_native:dawn_native_static" + "third_party/externals/dawn/src/dawn_platform:dawn_platform_static") + endif() +endif() + message(STATUS "Installing: ${CURRENT_PACKAGES_DIR}/include/${PORT}") file(COPY "${SOURCE_PATH}/include" DESTINATION "${CURRENT_PACKAGES_DIR}/include") @@ -188,9 +309,8 @@ endforeach() # get a list of library dependencies for TARGET function(gn_desc_target_libs OUTPUT BUILD_DIR TARGET) - vcpkg_find_acquire_program(GN) execute_process( - COMMAND ${GN} desc "${BUILD_DIR}" "${TARGET}" libs + COMMAND ${VCPKG_GN} desc "${BUILD_DIR}" "${TARGET}" libs WORKING_DIRECTORY "${SOURCE_PATH}" OUTPUT_VARIABLE OUTPUT_ OUTPUT_STRIP_TRAILING_WHITESPACE diff --git a/ports/skia/skiaConfig.cmake.in b/ports/skia/skiaConfig.cmake.in index b4c7c82ce86db9..38654523c589a1 100644 --- a/ports/skia/skiaConfig.cmake.in +++ b/ports/skia/skiaConfig.cmake.in @@ -19,8 +19,9 @@ endif() set(SKIA_DEP_DBG @SKIA_DEP_DBG@) set(SKIA_DEP_REL @SKIA_DEP_REL@) -find_library(SKIA_LIB NAMES skia skia.dll) -target_link_libraries(skia INTERFACE "${SKIA_LIB}") +target_link_libraries(skia INTERFACE + debug "${_IMPORT_PREFIX}/debug/lib/${CMAKE_STATIC_LIBRARY_PREFIX}skia${CMAKE_STATIC_LIBRARY_SUFFIX}" + optimized "${_IMPORT_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}skia${CMAKE_STATIC_LIBRARY_SUFFIX}") function(set_dependencies CONFIG LIBRARIES) foreach(LIB ${LIBRARIES}) @@ -43,44 +44,17 @@ function(set_dependencies CONFIG LIBRARIES) endfunction() set_dependencies(Debug "${SKIA_DEP_DBG}") +set_dependencies(RelWithDebInfo "${SKIA_DEP_REL}") set_dependencies(Release "${SKIA_DEP_REL}") set(SKIA_DEFINITIONS_DBG - _CRT_SECURE_NO_WARNINGS - _HAS_EXCEPTIONS=0 - WIN32_LEAN_AND_MEAN - NOMINMAX - SK_GL SK_ENABLE_DUMP_GPU - SK_SUPPORT_PDF - SK_HAS_JPEG_LIBRARY - SK_USE_LIBGIFCODEC SK_HAS_HEIF_LIBRARY - SK_HAS_PNG_LIBRARY SK_ENABLE_SKSL_INTERPRETER - SK_HAS_WEBP_LIBRARY - SK_XML - SKIA_DLL SK_SUPPORT_ATLAS_TEXT=1) -set(SKIA_DEFINITIONS_REL - _CRT_SECURE_NO_WARNINGS - _HAS_EXCEPTIONS=0 - WIN32_LEAN_AND_MEAN - NOMINMAX - NDEBUG - SK_GL - SK_SUPPORT_PDF - SK_HAS_JPEG_LIBRARY - SK_USE_LIBGIFCODEC - SK_HAS_PNG_LIBRARY - SK_HAS_WEBP_LIBRARY - SK_XML - SKIA_DLL) - target_compile_definitions(skia INTERFACE - $<$:${SKIA_DEFINITIONS_DBG}> - $<$:${SKIA_DEFINITIONS_REL}>) + $<$:${SKIA_DEFINITIONS_DBG}>) target_include_directories(skia INTERFACE ${_IMPORT_PREFIX}/include) target_compile_definitions(skia INTERFACE ${SKIA_PUBLIC_DEFINITIONS}) diff --git a/ports/skia/use_vcpkg_fontconfig.patch b/ports/skia/use_vcpkg_fontconfig.patch new file mode 100644 index 00000000000000..3533e8cf3d5835 --- /dev/null +++ b/ports/skia/use_vcpkg_fontconfig.patch @@ -0,0 +1,42 @@ +diff --git a/BUILD.gn b/BUILD.gn +index aeb46b4664..2ddbcd0ebe 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -452,7 +452,7 @@ optional("fontmgr_fontconfig") { + enabled = skia_enable_fontmgr_fontconfig + + # The public header includes fontconfig.h and uses FcConfig* +- public_deps = [ "//third_party:fontconfig" ] ++ public_deps = [ "//third_party/fontconfig" ] + public = [ "include/ports/SkFontMgr_fontconfig.h" ] + deps = [ ":typeface_freetype" ] + sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ] +@@ -469,7 +469,7 @@ optional("fontmgr_FontConfigInterface") { + + deps = [ + ":typeface_freetype", +- "//third_party:fontconfig", ++ "//third_party/fontconfig", + ] + public = [ + "include/ports/SkFontConfigInterface.h", +diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn +index 63fa748d16..6760e0f41b 100644 +--- a/third_party/BUILD.gn ++++ b/third_party/BUILD.gn +@@ -6,9 +6,9 @@ + declare_args() { + } + +-config("system_fontconfig") { +- libs = [ "fontconfig" ] +-} +-group("fontconfig") { +- public_configs = [ ":system_fontconfig" ] +-} ++#config("system_fontconfig") { ++# libs = [ "fontconfig" ] ++#} ++#group("fontconfig") { ++# public_configs = [ ":system_fontconfig" ] ++#} diff --git a/ports/skia/vcpkg.json b/ports/skia/vcpkg.json index d8991a23706f55..ce821bdff35ee1 100644 --- a/ports/skia/vcpkg.json +++ b/ports/skia/vcpkg.json @@ -1,16 +1,17 @@ { "name": "skia", - "version-date": "2020-05-18", - "port-version": 8, + "version-string": "canvaskit/0.29.0", "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", - "supports": "osx | windows", + "license": "BSD-3-Clause", + "supports": "(x64 | arm64) & (windows | linux | osx)", "dependencies": [ "expat", + "fontconfig", { "name": "freetype", "default-features": false @@ -29,11 +30,30 @@ "name": "vcpkg-cmake-config", "host": true }, + { + "name": "vcpkg-gn", + "host": true + }, "zlib" ], + "default-features": [ + "gl" + ], "features": { + "dawn": { + "description": "dawn support for skia" + }, + "direct3d": { + "description": "Direct3D support for skia" + }, + "gl": { + "description": "OpenGL support for skia" + }, "metal": { - "description": "metal support for skia" + "description": "Metal support for skia" + }, + "vulkan": { + "description": "Vulkan support for skia" } } } diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 306a21b66a2d9a..84784786a3ccf6 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1222,7 +1222,6 @@ signalrclient:x64-uwp=fail signalrclient:arm-uwp=fail skia:arm64-windows=fail skia:arm-uwp=fail -skia:x64-linux=fail skia:x64-uwp=fail skia:x86-windows=fail sleef:x86-windows=fail diff --git a/versions/baseline.json b/versions/baseline.json index 0e72ebba29e5b1..1241e22875be20 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6473,8 +6473,8 @@ "port-version": 0 }, "skia": { - "baseline": "2020-05-18", - "port-version": 8 + "baseline": "canvaskit/0.29.0", + "port-version": 0 }, "skyr-url": { "baseline": "1.13.0", diff --git a/versions/s-/skia.json b/versions/s-/skia.json index 168d625e74968f..df5560e7cc6800 100644 --- a/versions/s-/skia.json +++ b/versions/s-/skia.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "2e82418dcbd10379015587c1aa6a4d099f73fa62", + "version-string": "canvaskit/0.29.0", + "port-version": 0 + }, { "git-tree": "104ba7c5e5e46398000e92e0f9cc3c9f0999e142", "version-date": "2020-05-18",