[skia] Fix incomplete update, build modules, fix android (#34951)

* [skia] Restore simple msvc toolchain fix

* libgifcodec is gone

* Update abseil-cpp

* Use vcpkg abseil-cpp

* Update wuffs

* Update dawn

* Update spirv deps

* Remove tint

* Update vulkan-tools

* versions

* Drop obsolete patch

* Use github directly

* Revert "Use vcpkg abseil-cpp"

This reverts commit 9b4157c980.

* Fix dawn

* Build, install, export modules

* Unroll default-features

* Fix comments

* Fix skresources

* Fix manifest

* WIP

* WIP

* Pass-through lib dirs

* Filter link libs

* WIP

* WIP

* Add feature 'modules'

* Fix SkDebugf visibility

* WIP

* WIP

* Rewrite gn install and export

* No pdb for release

* Omit explicit ouput check

* Update modules config

* Disable skparagraph DLL, no dllexport

* Disable icu on shared windows

* Cleanup

* Cleanup

* Enable android CI

* Android

* Don't export standard libraries

* Disable FontConfigInterface on windows
This commit is contained in:
Kai Pastor 2023-11-29 10:34:00 +01:00 committed by GitHub
parent e942b5ddcf
commit 848c8178ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 422 additions and 217 deletions

View File

@ -1,15 +0,0 @@
diff --git a/BUILD.gn b/BUILD.gn
index 577dd00..07f9882 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1478,6 +1478,10 @@ skia_component("skia") {
defines = []
libs = []
+ if (is_win && target_cpu != "arm64" && !skia_enable_winuwp) {
+ libs += [ "OpenGL32.lib" ] # for src/utils/win/SkWGL_win.cpp
+ }
+
if (skia_enable_sksl) {
deps += [ ":minify_sksl" ]
sources += skia_sksl_sources

View File

@ -0,0 +1,26 @@
diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn
index 24853ced..064b839b 100644
--- a/src/dawn/native/BUILD.gn
+++ b/src/dawn/native/BUILD.gn
@@ -882,6 +882,10 @@ dawn_json_generator("webgpu_dawn_native_proc_gen") {
target = "webgpu_dawn_native_proc"
outputs = [ "src/dawn/native/webgpu_dawn_native_proc.cpp" ]
}
+source_set("webgpu_dawn_native_proc_gen_sources") {
+ sources = get_target_outputs(":webgpu_dawn_native_proc_gen")
+ deps = [ ":webgpu_dawn_native_proc_gen" ]
+}
dawn_component("webgpu_dawn") {
# For a single library - build `webgpu_dawn_shared` with GN args:
@@ -901,9 +905,8 @@ dawn_component("webgpu_dawn") {
DEFINE_PREFIX = "WGPU"
output_name = "webgpu_dawn"
- sources = get_target_outputs(":webgpu_dawn_native_proc_gen")
deps = [
":static",
- ":webgpu_dawn_native_proc_gen",
+ ":webgpu_dawn_native_proc_gen_sources",
]
}

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

@ -4,7 +4,10 @@ project(skia-example)
set(CMAKE_CXX_STANDARD 17)
add_executable(main convert-to-nia.cpp)
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)
target_link_libraries(main PRIVATE unofficial::skia::skia unofficial::skia::modules::skshaper)

View File

@ -6,28 +6,30 @@ vcpkg_from_github(
REF "canvaskit/${VERSION}"
SHA512 4672cfef8c92f37418e27df30a4e3fd6f7ca6273521e9d6b7755d9285800ad1ea6eff66639a17f591e6921ec8b78aa828500399a83295f9984ab58ebaff0ec24
PATCHES
disable-msvc-env-setup.patch
uwp.patch
core-opengl32.patch
disable-dev-test.patch
support-x86-MSVC-build.patch
skdebug-stdio.patch
)
# 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://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git"
REF "c5a424a2a21005660b182516eb7a079cd8021699"
URL "https://github.com/abseil/abseil-cpp.git"
REF "cb436cf0142b4cbe47aae94223443df7f82e2920"
LICENSE_FILE LICENSE
)
declare_external_from_git(d3d12allocator
URL "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git"
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 "30fa0d8d2ced43e44baa522dd4bd4684b14a3099"
REF "6e25bf7674bbcb1d1e613dc0700c958830950037"
LICENSE_FILE LICENSE
PATCHES
dawn-dedup-native-proc-gen.patch
)
declare_external_from_git(dng_sdk
URL "https://android.googlesource.com/platform/external/dng_sdk.git"
@ -39,11 +41,6 @@ declare_external_from_git(jinja2
REF "ee69aa00ee8536f61db6a451f3858745cf587de6"
LICENSE_FILE LICENSE.rst
)
declare_external_from_git(libgifcodec
URL "https://skia.googlesource.com/libgifcodec"
REF "fd59fa92a0c86788dcdd84d091e1ce81eda06a77"
LICENSE_FILE LICENSE.md
)
declare_external_from_git(markupsafe
URL "https://chromium.googlesource.com/chromium/src/third_party/markupsafe"
REF "0944e71f4b2cb9a871bcbe353f95e889b64a611a"
@ -55,38 +52,33 @@ declare_external_from_git(piex
LICENSE_FILE LICENSE
)
declare_external_from_git(sfntly
URL "https://github.com/googlefonts/sfntly.git"
URL "https://github.com/googlei18n/sfntly.git"
REF "b55ff303ea2f9e26702b514cf6a3196a2e3e2974"
LICENSE_FILE README.md
)
declare_external_from_git(spirv-cross
URL "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross"
REF "61c603f3baa5270e04bcfb6acf83c654e3c57679"
URL "https://github.com/KhronosGroup/SPIRV-Cross"
REF "030d0be28c35bafebd20660c112852b1d8c8c6ca"
LICENSE_FILE LICENSE
)
declare_external_from_git(spirv-headers
URL "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git"
REF "0bcc624926a25a2a273d07877fd25a6ff5ba1cfb"
URL "https://github.com/KhronosGroup/SPIRV-Headers.git"
REF "8e2ad27488ed2f87c068c01a8f5e8979f7086405"
LICENSE_FILE LICENSE
)
declare_external_from_git(spirv-tools
URL "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git"
REF "0073a1fa36f7c52ad3d58059cb5d5de8efa825ad"
LICENSE_FILE LICENSE
)
declare_external_from_git(tint
URL "https://dawn.googlesource.com/tint"
REF "200492e32b94f042d9942154fb4fa7f93bb8289a"
URL "https://github.com/KhronosGroup/SPIRV-Tools.git"
REF "93c13345e176f3f8bdb4b07e59c5e3365b3dbf44"
LICENSE_FILE LICENSE
)
declare_external_from_git(vulkan-tools
URL "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools"
REF "d55c7aaf041af331bee8c22fb448a6ff4c797f73"
URL "https://github.com/KhronosGroup/Vulkan-Tools"
REF "2c83dd6cb2ef710bab843b69776997d6f2c12ba4"
LICENSE_FILE LICENSE.txt
)
declare_external_from_git(wuffs
URL "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git"
REF "e3f919ccfe3ef542cfc983a82146070258fb57f8"
URL "https://github.com/google/wuffs-mirror-release-c.git"
REF "a0041ac0310b3156b963e2f2bea09245f25ec073"
LICENSE_FILE LICENSE
)
@ -94,7 +86,7 @@ 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 DEFINES "U_USING_ICU_NAMESPACE=0")
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)
@ -107,10 +99,19 @@ if(NOT VCPKG_TARGET_ARCHITECTURE IN_LIST known_cpus)
message(WARNING "Unknown target cpu '${VCPKG_TARGET_ARCHITECTURE}'.")
endif()
set(OPTIONS "target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\"")
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")
vcpkg_list(SET SKIA_TARGETS :skia :modules)
if(VCPKG_TARGET_IS_ANDROID)
string(APPEND OPTIONS " target_os=\"android\"")
@ -118,11 +119,14 @@ 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 AND NOT VCPKG_TARGET_IS_MINGW)
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")
endif()
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
@ -134,7 +138,6 @@ endif()
set(required_externals
dng_sdk
expat
libgifcodec
libjpeg
libpng
libwebp
@ -147,6 +150,9 @@ set(required_externals
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()
@ -225,7 +231,6 @@ They can be installed on Debian based systems via
spirv-cross
spirv-headers
spirv-tools
tint
jinja2
markupsafe
vulkan_headers
@ -235,17 +240,15 @@ They can be installed on Debian based systems via
## REMOVE ^
dawn
)
string(APPEND OPTIONS " skia_use_dawn=true")
string(REPLACE "dynamic" "shared" DAWN_LINKAGE "${VCPKG_LIBRARY_LINKAGE}")
vcpkg_list(APPEND SKIA_TARGETS
"third_party/externals/dawn/src/dawn:proc_${DAWN_LINKAGE}"
"third_party/externals/dawn/src/dawn/native:${DAWN_LINKAGE}"
"third_party/externals/dawn/src/dawn/platform:${DAWN_LINKAGE}"
)
# cf. external dawn/src/dawn/native/BUILD.gn
string(APPEND OPTIONS " skia_use_dawn=true dawn_use_angle=false 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/generator/dawn_version_generator.py")
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(),"
@ -259,9 +262,11 @@ vcpkg_replace_string("${SOURCE_PATH}/gn/toolchain/BUILD.gn" "python3 " "\\\"${PY
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_IS_WINDOWS)
string(REGEX REPLACE "[\\]\$" "" WIN_VC "$ENV{VCINSTALLDIR}")
string(APPEND OPTIONS " win_vc=\"${WIN_VC}\"")
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}\" \
@ -285,31 +290,12 @@ endif()
vcpkg_gn_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS "${OPTIONS} skia_use_lua=false skia_enable_tools=false skia_enable_spirv_validation=false"
OPTIONS "${OPTIONS}"
OPTIONS_DEBUG "${OPTIONS_DBG}"
OPTIONS_RELEASE "${OPTIONS_REL}"
)
# desc json output is dual-use: logging and further processing
vcpkg_find_acquire_program(GN)
vcpkg_execute_required_process(
COMMAND "${GN}" desc --format=json --all --testonly=false "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" "*"
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "desc-${TARGET_TRIPLET}-rel"
OUTPUT_VARIABLE desc_release
)
file(READ "${CURRENT_BUILDTREES_DIR}/desc-${TARGET_TRIPLET}-rel-out.log" desc_release)
if(NOT VCPKG_BUILD_TYPE)
vcpkg_execute_required_process(
COMMAND "${GN}" desc --format=json --all --testonly=false "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" "*"
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "desc-${TARGET_TRIPLET}-dbg"
OUTPUT_VARIABLE desc_debug
)
file(READ "${CURRENT_BUILDTREES_DIR}/desc-${TARGET_TRIPLET}-dbg-out.log" desc_debug)
endif()
vcpkg_gn_install(
skia_gn_install(
SOURCE_PATH "${SOURCE_PATH}"
TARGETS ${SKIA_TARGETS}
)
@ -329,14 +315,6 @@ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/skia/include/core/SkTypes.
# vcpkg legacy layout omits "include/" component. Just duplicate.
file(COPY "${CURRENT_PACKAGES_DIR}/include/skia/include/" DESTINATION "${CURRENT_PACKAGES_DIR}/include/skia")
get_definitions(SKIA_DEFINITIONS_REL "${desc_release}" "//:skia")
get_link_libs(SKIA_DEP_REL "${desc_release}" "//:skia")
if(NOT VCPKG_BUILD_TYPE)
get_definitions(SKIA_DEFINITIONS_DBG "${desc_debug}" "//:skia")
get_link_libs(SKIA_DEP_DBG "${desc_debug}" "//:skia")
endif()
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/unofficial-skia")
configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-skia-config.cmake" "${CURRENT_PACKAGES_DIR}/share/unofficial-skia/unofficial-skia-config.cmake" @ONLY)
# vcpkg legacy
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/skiaConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/skia")

View File

@ -0,0 +1,12 @@
diff --git a/src/ports/SkDebug_stdio.cpp b/src/ports/SkDebug_stdio.cpp
index 78c7072b..3d5c134d 100644
--- a/src/ports/SkDebug_stdio.cpp
+++ b/src/ports/SkDebug_stdio.cpp
@@ -7,6 +7,7 @@
#include "include/private/base/SkFeatures.h"
#include "include/private/base/SkLoadUserConfig.h"
+#include "include/private/base/SkDebug.h"
#if !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_ANDROID)

View File

@ -7,6 +7,8 @@ function(declare_external_from_git name)
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}")
@ -192,6 +194,68 @@ function(list_from_json out_var json) # <path>
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")
@ -201,6 +265,8 @@ 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}")
@ -218,8 +284,16 @@ function(get_link_libs out_var desc_json target)
endif()
vcpkg_list(SET output)
foreach(lib IN LISTS frameworks ldflags libs)
string(REPLACE "${CURRENT_INSTALLED_DIR}" [[${vcpkg_root}]] lib "${lib}")
string(REPLACE "${CURRENT_PACKAGES_DIR}" [[${vcpkg_root}]] lib "${lib}")
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()
@ -227,3 +301,152 @@ function(get_link_libs out_var desc_json target)
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)
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

@ -1,13 +0,0 @@
diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
index dcf79cc..599629a 100644
--- a/gn/toolchain/BUILD.gn
+++ b/gn/toolchain/BUILD.gn
@@ -89,7 +89,7 @@ toolchain("msvc") {
if (target_cpu == "x86") {
# Toolchain asset includes a script that configures for x86 building.
# We don't support x86 builds with local MSVC installations.
- env_setup = "$shell $win_sdk/bin/SetEnv.cmd /x86 && "
+ env_setup = "$shell set \"PATH=%PATH%;$win_vc\\Tools\\MSVC\\$win_toolchain_version\\bin\\HostX64\\x86\" && "
} else if (target_cpu == "arm64") {
# 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\" && "

View File

@ -5,17 +5,17 @@ config("vcpkg_@gn_group@") {
if(is_debug) {
defines = [ @gn_defines_DEBUG@ ]
include_dirs = [ @gn_include_dirs_DEBUG@ ]
lib_dirs = [ @gn_lib_dirs_DEBUG@ ]
} else {
defines = [ @gn_defines_RELEASE@ ]
include_dirs = [ @gn_include_dirs_RELEASE@ ]
lib_dirs = [ @gn_lib_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@ ]
}
}

View File

@ -1,11 +1,16 @@
if(NOT TARGET unofficial::skia::skia)
function(z_vcpkg_skia_get_link_libraries out_var path libraries)
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(path "${z_vcpkg_@PORT@_root}/debug/lib" "${z_vcpkg_@PORT@_root}/lib")
else()
set(path "${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}")
else()
string(MAKE_C_IDENTIFIER "${out_var}_${lib}" lib_var)
string(MAKE_C_IDENTIFIER "${out_var}_${lib}_${type}" lib_var)
find_library("${lib_var}" NAMES "${lib}" NAMES_PER_DIR PATH "${path}")
mark_as_advanced("${lib_var}")
if(${lib_var})
@ -17,62 +22,16 @@ if(NOT TARGET unofficial::skia::skia)
endforeach()
set("${out_var}" "${libs}" PARENT_SCOPE)
endfunction()
# Compute the installation prefix relative to this file.
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(unofficial::skia::skia UNKNOWN IMPORTED)
set_target_properties(unofficial::skia::skia PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${z_vcpkg_skia_root}/include/skia"
)
find_library(z_vcpkg_skia_lib_release NAMES skia skia.dll PATHS "${z_vcpkg_skia_root}/lib" NO_DEFAULT_PATH)
find_library(z_vcpkg_skia_lib_debug NAMES skia skia.dll PATHS "${z_vcpkg_skia_root}/debug/lib" NO_DEFAULT_PATH)
mark_as_advanced(z_vcpkg_skia_lib_release z_vcpkg_skia_lib_debug)
set(z_vcpkg_skia_config_debug "\$<CONFIG:Debug>")
if(NOT z_vcpkg_skia_lib_debug)
set(z_vcpkg_skia_config_debug "0")
endif()
z_vcpkg_skia_get_link_libraries(
z_vcpkg_skia_link_libs_release
"${z_vcpkg_skia_root}/lib;${z_vcpkg_skia_root}/debug/lib"
"@SKIA_DEP_REL@"
)
set_target_properties(unofficial::skia::skia PROPERTIES
IMPORTED_CONFIGURATIONS RELEASE
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${z_vcpkg_skia_lib_release}"
INTERFACE_COMPILE_DEFINITIONS "\$<\$<NOT:${z_vcpkg_skia_config_debug}>:@SKIA_DEFINITIONS_REL@>"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:\$<\$<NOT:${z_vcpkg_skia_config_debug}>:${z_vcpkg_skia_link_libs_release}>>"
)
if(z_vcpkg_skia_lib_debug)
z_vcpkg_skia_get_link_libraries(
z_vcpkg_skia_link_libs_debug
"${z_vcpkg_skia_root}/debug/lib;${z_vcpkg_skia_root}/lib"
"@SKIA_DEP_DBG@"
)
set_property(TARGET unofficial::skia::skia APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG
)
set_target_properties(unofficial::skia::skia PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
IMPORTED_LOCATION_DEBUG "${z_vcpkg_skia_lib_debug}"
)
set_property(TARGET unofficial::skia::skia APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS "\$<\$<CONFIG:Debug>:@SKIA_DEFINITIONS_DBG@>"
)
set_property(TARGET unofficial::skia::skia APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:\$<\$<CONFIG:Debug>:${z_vcpkg_skia_link_libs_debug}>>"
)
endif()
unset(z_vcpkg_skia_config_debug)
unset(z_vcpkg_skia_root)
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_target_properties(@cmake_target@ PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "\$<@cmake_config_genex@:@interface_compile_definitions@>"
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

@ -2,3 +2,5 @@ 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

@ -1,6 +1,7 @@
{
"name": "skia",
"version": "0.38.2",
"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.",
@ -8,7 +9,7 @@
],
"homepage": "https://skia.org",
"license": null,
"supports": "!(windows & arm & !arm64)",
"supports": "!(windows & arm32) & !mingw",
"dependencies": [
"expat",
"libjpeg-turbo",
@ -19,6 +20,10 @@
"default-features": false,
"platform": "windows & !arm64 & !uwp"
},
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-cmake-get-vars",
"host": true
@ -38,7 +43,30 @@
"zlib"
],
"default-features": [
"default-features"
{
"name": "direct3d",
"platform": "uwp"
},
{
"name": "fontconfig",
"platform": "linux"
},
{
"name": "freetype",
"platform": "!(windows | osx | ios)"
},
{
"name": "gl",
"platform": "!uwp"
},
{
"name": "harfbuzz",
"platform": "!uwp"
},
{
"name": "icu",
"platform": "!uwp & !(windows & !static)"
}
],
"features": {
"dawn": {
@ -47,45 +75,6 @@
"vulkan-headers"
]
},
"default-features": {
"description": "Default feature configuration",
"dependencies": [
{
"name": "skia",
"default-features": false,
"features": [
"direct3d"
],
"platform": "uwp"
},
{
"name": "skia",
"default-features": false,
"features": [
"fontconfig"
],
"platform": "linux"
},
{
"name": "skia",
"default-features": false,
"features": [
"gl",
"harfbuzz",
"icu"
],
"platform": "!uwp"
},
{
"name": "skia",
"default-features": false,
"features": [
"freetype"
],
"platform": "!(windows | osx | ios)"
}
]
},
"direct3d": {
"description": "Direct3D support for skia",
"supports": "windows"
@ -130,7 +119,8 @@
]
},
"icu": {
"description": "Use icu",
"description": "Use icu.",
"supports": "!(windows & !static)",
"dependencies": [
"icu"
]

View File

@ -1083,9 +1083,6 @@ simd:x64-android=fail
sjpeg:arm-neon-android=fail
sjpeg:arm64-android=fail
sjpeg:x64-android=fail
skia:arm-neon-android=fail
skia:arm64-android=fail
skia:x64-android=fail
sleef:arm-neon-android=fail
sleef:arm64-android=fail
sleef:x64-android=fail

View File

@ -1,16 +1,16 @@
{
"name": "vcpkg-ci-skia",
"version-date": "2022-11-24",
"version-date": "2023-11-12",
"description": "Builds an app in order to validate the skia port.",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "skia",
"default-features": false
},
{
"name": "vcpkg-cmake",
"host": true
}
]
}

View File

@ -7914,7 +7914,7 @@
},
"skia": {
"baseline": "0.38.2",
"port-version": 0
"port-version": 1
},
"skyr-url": {
"baseline": "1.13.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "7363d84372c8a2a6e3c06a7fcc6c1ef1d1b7b97a",
"version": "0.38.2",
"port-version": 1
},
{
"git-tree": "5a7376b3d299acc253980a36193079fbb42eea1b",
"version": "0.38.2",