diff --git a/ports/skia/portfile.cmake b/ports/skia/portfile.cmake index 1d6c0adb071a81..f07d07d61f5762 100644 --- a/ports/skia/portfile.cmake +++ b/ports/skia/portfile.cmake @@ -77,11 +77,6 @@ declare_external_from_git(tint REF "200492e32b94f042d9942154fb4fa7f93bb8289a" LICENSE_FILE LICENSE ) -declare_external_from_git(vulkan-headers - URL "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers" - REF "c896e2f920273bfee852da9cca2a356bc1c2031e" - LICENSE_FILE LICENSE.txt -) declare_external_from_git(vulkan-tools URL "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools" REF "d55c7aaf041af331bee8c22fb448a6ff4c797f73" @@ -98,6 +93,8 @@ 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}'.") @@ -178,8 +175,17 @@ if("metal" IN_LIST FEATURES) endif() if("vulkan" IN_LIST FEATURES) + list(APPEND required_externals + vulkan_headers + vulkan-tools + ) string(APPEND OPTIONS " skia_use_vulkan=true") - file(COPY "${CURRENT_INSTALLED_DIR}/include/vk_mem_alloc.h" DESTINATION "${SOURCE_PATH}/third_party/vulkanmemoryallocator") + file(COPY "${CURRENT_INSTALLED_DIR}/include/vk_mem_alloc.h" DESTINATION "${SOURCE_PATH}/third_party/externals/vulkanmemoryallocator/include") + # Cf. third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator.h:25 + vcpkg_replace_string("${SOURCE_PATH}/third_party/externals/vulkanmemoryallocator/include/vk_mem_alloc.h" + "#include " + "#ifndef VULKAN_H_\n #include \n#endif" + ) endif() if("direct3d" IN_LIST FEATURES) @@ -214,8 +220,8 @@ They can be installed on Debian based systems via tint jinja2 markupsafe + vulkan_headers ## Remove - vulkan-headers vulkan-tools abseil-cpp ## REMOVE ^ diff --git a/ports/skia/skia-functions.cmake b/ports/skia/skia-functions.cmake index d41631c70c9e54..609313e68f9dc3 100644 --- a/ports/skia/skia-functions.cmake +++ b/ports/skia/skia-functions.cmake @@ -22,6 +22,11 @@ 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) @@ -32,11 +37,14 @@ function(get_externals) 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() @@ -62,6 +70,9 @@ function(get_externals) 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 @@ -109,6 +120,34 @@ function(third_party_from_pkgconfig gn_group) 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}/lib/debug") + 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) diff --git a/ports/skia/vcpkg.json b/ports/skia/vcpkg.json index 83703ad499d73a..b8bb03a5bfc932 100644 --- a/ports/skia/vcpkg.json +++ b/ports/skia/vcpkg.json @@ -1,7 +1,7 @@ { "name": "skia", "version": "0.36.0", - "port-version": 7, + "port-version": 8, "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.", @@ -43,7 +43,10 @@ ], "features": { "dawn": { - "description": "dawn support for skia" + "description": "dawn support for skia", + "dependencies": [ + "vulkan-headers" + ] }, "default-features": { "description": "Default feature configuration", @@ -136,7 +139,7 @@ "vulkan": { "description": "Vulkan support for skia", "dependencies": [ - "vulkan", + "vulkan-headers", "vulkan-memory-allocator" ] } diff --git a/versions/baseline.json b/versions/baseline.json index f8606686afcc2f..fadce7d285cbba 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7590,7 +7590,7 @@ }, "skia": { "baseline": "0.36.0", - "port-version": 7 + "port-version": 8 }, "skyr-url": { "baseline": "1.13.0", diff --git a/versions/s-/skia.json b/versions/s-/skia.json index 886fade10384c1..ee8bed49024928 100644 --- a/versions/s-/skia.json +++ b/versions/s-/skia.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "59bcc7110298012cf8f0d6e68ec8d04a4cb01e8b", + "version": "0.36.0", + "port-version": 8 + }, { "git-tree": "508710af38e0b50675532741bf899ec4c3f20c3b", "version": "0.36.0",