Meta: Add overlay port for skia to patch generated skparagraph.gni

This works around an issue in upstream skia where a debug build with
dynamic libraries includes an extra file in the skparagraph module
that is not compilable on macOS.
This commit is contained in:
Andrew Kaster 2024-11-05 12:56:05 -07:00 committed by Andrew Kaster
parent 064e85a373
commit a283a4fce5
Notes: github-actions[bot] 2024-11-06 17:39:55 +00:00
18 changed files with 1273 additions and 0 deletions

View file

@ -80,3 +80,8 @@ set(XML_PARSER_DEBUG ON)
# set(ANDROID_LOG_DEBUG ON)
# Clogs up build: The BindingsGenerator stuff is run at compile time.
# set(BINDINGS_GENERATOR_DEBUG ON)
# Third-party: skia vcpkg port overlay
# set(gn_defines_DEBUG ON)
# set(gn_include_dirs_DEBUG ON)
# set(gn_ldflags_DEBUG ON)
# set(gn_lib_dirs_DEBUG ON)

View file

@ -0,0 +1,14 @@
diff --git a/modules/bentleyottmann/BUILD.gn b/modules/bentleyottmann/BUILD.gn
index 8a6725592f..fa0d03334c 100644
--- a/modules/bentleyottmann/BUILD.gn
+++ b/modules/bentleyottmann/BUILD.gn
@@ -31,4 +31,9 @@ if (skia_enable_bentleyottmann) {
]
}
}
+} else {
+ group("bentleyottmann") {
+ }
+ group("tests") {
+ }
}

View file

@ -0,0 +1,12 @@
diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
index ba85c3d..901ba99 100644
--- a/gn/toolchain/BUILD.gn
+++ b/gn/toolchain/BUILD.gn
@@ -94,6 +94,7 @@ toolchain("msvc") {
# 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 = ""

View file

@ -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)

View file

@ -0,0 +1,12 @@
diff --git a/include/gpu/graphite/Recorder.h b/include/gpu/graphite/Recorder.h
index 64e9fad..44a9aca 100644
--- a/include/gpu/graphite/Recorder.h
+++ b/include/gpu/graphite/Recorder.h
@@ -11,6 +11,7 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.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/SkTArray.h"

View file

@ -0,0 +1,12 @@
diff --git a/src/pdf/SkPDFSubsetFont.cpp b/src/pdf/SkPDFSubsetFont.cpp
index 09d4aed799..009c2762a3 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;
}

View file

@ -0,0 +1,335 @@
include("${CMAKE_CURRENT_LIST_DIR}/skia-functions.cmake")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/skia
REF "501e9efaa2fc929ec67c44da6dbaf9335264b559"
SHA512 978af9894d23d7b97d95d402bbf6c0c1401d63990361aae80166b620b0aa06d9dc2c75537850ff4c2df539735b4a12713cb29840613a15cbbff68590c48c4fac
PATCHES
disable-msvc-env-setup.patch
# disable-dev-test.patch
skia-include-string.patch
bentleyottmann-build.patch
graphite.patch
vulkan-headers.patch
pdfsubsetfont-uwp.diff
skparagraph-gni.diff
)
# 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(abseil-cpp
URL "https://github.com/abseil/abseil-cpp.git"
REF "65a55c2ba891f6d2492477707f4a2e327a0b40dc"
LICENSE_FILE LICENSE
)
declare_external_from_git(d3d12allocator
URL "https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git"
REF "169895d529dfce00390a20e69c2f516066fe7a3b"
LICENSE_FILE LICENSE.txt
)
declare_external_from_git(dawn
URL "https://dawn.googlesource.com/dawn.git"
REF "db1fa936ad0a58846f179c81cdf60f55267099b9"
LICENSE_FILE LICENSE
)
declare_external_from_git(dng_sdk
URL "https://android.googlesource.com/platform/external/dng_sdk.git"
REF "679499cc9b92cfb0ae1dccbfd7e97ce719d23576"
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(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 "1b75a4ae0b4289014b4c369301dc925c366f78a6"
LICENSE_FILE LICENSE
)
declare_external_from_git(spirv-tools
URL "https://github.com/KhronosGroup/SPIRV-Tools.git"
REF "87fcbaf1bc8346469e178711eff27cfd20aa1960"
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(expat)
declare_external_from_pkgconfig(fontconfig PATH "third_party")
declare_external_from_pkgconfig(freetype2)
declare_external_from_pkgconfig(harfbuzz MODULES harfbuzz harfbuzz-subset)
declare_external_from_pkgconfig(icu MODULES icu-uc)
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_skparagraph=false")
string(APPEND OPTIONS " skia_enable_bentleyottmann=false")
endif()
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
string(APPEND OPTIONS " is_component_build=true")
else()
string(APPEND OPTIONS " is_component_build=false")
endif()
set(required_externals
dng_sdk
expat
libjpeg
libpng
libwebp
piex
zlib
wuffs
)
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)
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")
endif()
if("dawn" IN_LIST FEATURES)
if (VCPKG_TARGET_IS_LINUX)
message(WARNING
[[
dawn support requires the following libraries from the system package manager:
libx11-xcb-dev mesa-common-dev
They can be installed on Debian based systems via
apt-get install libx11-xcb-dev mesa-common-dev
]]
)
endif()
list(APPEND required_externals
spirv-cross
spirv-headers
spirv-tools
jinja2
markupsafe
vulkan_headers
## Remove
abseil-cpp
## REMOVE ^
dawn
)
file(REMOVE_RECURSE "${SOURCE_PATH}/third_party/externals/opengl-registry")
file(INSTALL "${CURRENT_INSTALLED_DIR}/share/opengl/" DESTINATION "${SOURCE_PATH}/third_party/externals/opengl-registry/xml")
# cf. external dawn/src/dawn/native/BUILD.gn
string(APPEND OPTIONS " skia_use_dawn=true dawn_use_swiftshader=false")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(APPEND OPTIONS " dawn_complete_static_libs=true")
endif()
endif()
get_externals(${required_externals})
if(EXISTS "${SOURCE_PATH}/third_party/externals/dawn")
vcpkg_find_acquire_program(GIT)
vcpkg_replace_string("${SOURCE_PATH}/third_party/externals/dawn/generator/dawn_version_generator.py"
"get_git(),"
"\"${GIT}\","
)
endif()
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()
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})

View file

@ -0,0 +1,468 @@
# 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}}")
cmake_path(GET license_file FILENAME filename)
file(COPY_FILE "${license_file}" "${licenses_dir}/## ${name} ${filename}")
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)
find_file(filepath NAMES "${name}" 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()

View file

@ -0,0 +1,11 @@
--- a/src/gpu/ganesh/d3d/GrD3DUtil.h 2024-01-23 22:09:34
+++ b/src/gpu/ganesh/d3d/GrD3DUtil.h 2024-02-01 18:09:20
@@ -8,6 +8,8 @@
#ifndef GrD3DUtil_DEFINED
#define GrD3DUtil_DEFINED
+#include <string>
+
#include "include/core/SkImage.h"
#include "include/gpu/GrTypes.h"
#include "include/gpu/d3d/GrD3DTypes.h"

View file

@ -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()

View file

@ -0,0 +1,57 @@
diff --git a/bazel/exporter_tool/main.go b/bazel/exporter_tool/main.go
index 7d08bba939..e0ce13509a 100644
--- a/bazel/exporter_tool/main.go
+++ b/bazel/exporter_tool/main.go
@@ -614,12 +614,10 @@ var gniExportDescs = []exporter.GNIExportDesc{
{GNI: "modules/skparagraph/skparagraph.gni", Vars: []exporter.GNIFileListExportDesc{
{Var: "skparagraph_public",
Rules: []string{
- "//modules/skparagraph/include:hdrs",
- "//modules/skparagraph/utils:utils_hdrs"}},
+ "//modules/skparagraph/include:hdrs"}},
{Var: "skparagraph_sources",
Rules: []string{
- "//modules/skparagraph/src:srcs",
- "//modules/skparagraph/utils:utils_srcs"}},
+ "//modules/skparagraph/src:srcs"}},
{Var: "skparagraph_utils",
Rules: []string{
"//modules/skparagraph/utils:utils_hdrs",
diff --git a/modules/skparagraph/skparagraph.gni b/modules/skparagraph/skparagraph.gni
index 1356b5dc8a..b9caea20b9 100644
--- a/modules/skparagraph/skparagraph.gni
+++ b/modules/skparagraph/skparagraph.gni
@@ -11,9 +11,7 @@
_modules = get_path_info("../../modules", "abspath")
-# List generated by Bazel rules:
-# //modules/skparagraph/include:hdrs
-# //modules/skparagraph/utils:utils_hdrs
+# Generated by Bazel rule //modules/skparagraph/include:hdrs
skparagraph_public = [
"$_modules/skparagraph/include/DartTypes.h",
"$_modules/skparagraph/include/FontArguments.h",
@@ -27,12 +25,9 @@ skparagraph_public = [
"$_modules/skparagraph/include/TextShadow.h",
"$_modules/skparagraph/include/TextStyle.h",
"$_modules/skparagraph/include/TypefaceFontProvider.h",
- "$_modules/skparagraph/utils/TestFontCollection.h",
]
-# List generated by Bazel rules:
-# //modules/skparagraph/src:srcs
-# //modules/skparagraph/utils:utils_srcs
+# Generated by Bazel rule //modules/skparagraph/src:srcs
skparagraph_sources = [
"$_modules/skparagraph/src/Decorations.cpp",
"$_modules/skparagraph/src/Decorations.h",
@@ -58,7 +53,6 @@ skparagraph_sources = [
"$_modules/skparagraph/src/TextWrapper.cpp",
"$_modules/skparagraph/src/TextWrapper.h",
"$_modules/skparagraph/src/TypefaceFontProvider.cpp",
- "$_modules/skparagraph/utils/TestFontCollection.cpp",
]
# List generated by Bazel rules:

View file

@ -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" ]
}

View file

@ -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)

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -0,0 +1,171 @@
{
"name": "skia",
"version": "129",
"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": null,
"supports": "!(windows & arm32) & !mingw",
"dependencies": [
"expat",
"libjpeg-turbo",
"libpng",
"libwebp",
{
"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": "fontconfig",
"platform": "linux"
},
{
"name": "freetype",
"platform": "!(windows | osx | ios)"
},
{
"name": "gl",
"platform": "!(windows & arm) & !uwp"
},
{
"name": "harfbuzz",
"platform": "!uwp"
},
{
"name": "icu",
"platform": "!uwp"
}
],
"features": {
"dawn": {
"description": "dawn support for skia",
"dependencies": [
"egl-registry",
"opengl-registry",
{
"name": "skia",
"default-features": false,
"features": [
"graphite",
"vulkan"
]
},
"vulkan-utility-libraries"
]
},
"direct3d": {
"description": "Direct3D support for skia",
"supports": "windows"
},
"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"
]
},
"metal": {
"description": "Metal support for skia",
"supports": "ios, osx"
},
"vulkan": {
"description": "Vulkan support for skia",
"dependencies": [
"vulkan-headers",
"vulkan-memory-allocator"
]
}
}
}

View file

@ -0,0 +1,43 @@
diff --git a/BUILD.gn b/BUILD.gn
index 04ab422..5ae82e5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -913,6 +913,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
if (skia_enable_vulkan_debug_layers) {
diff --git a/include/private/gpu/vk/SkiaVulkan.h b/include/private/gpu/vk/SkiaVulkan.h
index 412dbf535f..93608dc2be 100644
--- a/include/private/gpu/vk/SkiaVulkan.h
+++ b/include/private/gpu/vk/SkiaVulkan.h
@@ -12,6 +12,10 @@
// IWYU pragma: begin_exports
+#ifndef SK_USE_EXTERNAL_VULKAN_HEADERS
+# define SK_USE_EXTERNAL_VULKAN_HEADERS
+#endif
+
#if (SKIA_IMPLEMENTATION || !defined(SK_VULKAN)) && !defined(SK_USE_EXTERNAL_VULKAN_HEADERS)
#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 487ea7c..9662c8c 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