Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions 3rdParty/vcpkg_ports/ports/webview2/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
if(VCPKG_TARGET_IS_UWP)
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
endif()

vcpkg_download_distfile(ARCHIVE
URLS "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/${VERSION}"
FILENAME "microsoft.web.webview2.${VERSION}.zip"
SHA512 10048ce88c166b7f29a563fcdb9487d71bac5723777cd0a98b5c5a0e71cff344551a0bc27410b0cb0f8482a9ecdec7454a45ad0d2a7ae998fc347ead15598889
)

vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
SOURCE_BASE "${VERSION}"
NO_REMOVE_ONE_LEVEL
)

file(COPY
"${SOURCE_PATH}/build/native/include/"
DESTINATION "${CURRENT_PACKAGES_DIR}/include")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(COPY
"${SOURCE_PATH}/build/native/${VCPKG_TARGET_ARCHITECTURE}/WebView2LoaderStatic.lib"
DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
else()
file(COPY
"${SOURCE_PATH}/build/native/include-winrt/"
DESTINATION "${CURRENT_PACKAGES_DIR}/include")
file(COPY
"${SOURCE_PATH}/lib/Microsoft.Web.WebView2.Core.winmd"
DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(COPY
"${SOURCE_PATH}/build/native/${VCPKG_TARGET_ARCHITECTURE}/WebView2Loader.dll.lib"
DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(COPY
"${SOURCE_PATH}/build/native/${VCPKG_TARGET_ARCHITECTURE}/WebView2Loader.dll"
"${SOURCE_PATH}/runtimes/win-${VCPKG_TARGET_ARCHITECTURE}/native_uap/Microsoft.Web.WebView2.Core.dll"
DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
endif()
if(NOT VCPKG_BUILD_TYPE)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(COPY "${CURRENT_PACKAGES_DIR}/bin" DESTINATION "${CURRENT_PACKAGES_DIR}/debug")
endif()
file(COPY "${CURRENT_PACKAGES_DIR}/lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug")
endif()

file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-webview2-config.cmake"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-webview2")

# The import libraries for webview fail with "Could not find proper second linker member"
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VCPKG_POLICY_EMPTY_PACKAGE is intended to allow truly empty packages to pass vcpkg validation. This port installs headers and libraries/dlls, so enabling this policy is misleading and may hide packaging problems rather than addressing them. Prefer removing this policy and fixing the underlying import-library validation issue (or, if the intent is to ship headers only, stop installing libs/dlls and keep the policy with a clearer rationale).

Suggested change
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

Copilot uses AI. Check for mistakes.

configure_file("${SOURCE_PATH}/LICENSE.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)

if(NOT TARGET unofficial::webview2::webview2)
if(EXISTS "${_IMPORT_PREFIX}/lib/WebView2LoaderStatic.lib")
add_library(unofficial::webview2::webview2 STATIC IMPORTED)
set_target_properties(unofficial::webview2::webview2
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
IMPORTED_LOCATION "${_IMPORT_PREFIX}/lib/WebView2LoaderStatic.lib")
else()
add_library(unofficial::webview2::webview2 SHARED IMPORTED)
set_target_properties(unofficial::webview2::webview2
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
IMPORTED_LOCATION "${_IMPORT_PREFIX}/bin/WebView2Loader.dll"
IMPORTED_IMPLIB "${_IMPORT_PREFIX}/lib/WebView2Loader.dll.lib")
endif()
endif()
Comment on lines +4 to +19
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The port declares a dependency on wil in vcpkg.json, but the generated CMake package does not call find_dependency(wil) nor link the dependency on the exported target. This can break consumers that rely on find_package(unofficial-webview2 CONFIG) to transitively provide required include dirs/compile definitions from wil. Consider using include(CMakeFindDependencyMacro) + find_dependency(wil CONFIG REQUIRED) and adding the appropriate WIL target to INTERFACE_LINK_LIBRARIES of unofficial::webview2::webview2.

Copilot uses AI. Check for mistakes.

unset(_IMPORT_PREFIX)
12 changes: 12 additions & 0 deletions 3rdParty/vcpkg_ports/ports/webview2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "webview2",
"version": "1.0.3800.47",
"description": "The WebView2 control allows you to embed web technologies (HTML, CSS, and JavaScript) using Microsoft Edge",
"homepage": "https://docs.microsoft.com/en-us/microsoft-edge/webview2",
"documentation": "https://docs.microsoft.com/en-us/microsoft-edge/webview2",
Comment on lines +5 to +6
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs.microsoft.com has been superseded by learn.microsoft.com for Microsoft documentation. Consider updating these URLs to the current Learn domain to avoid redirects and keep metadata current.

Suggested change
"homepage": "https://docs.microsoft.com/en-us/microsoft-edge/webview2",
"documentation": "https://docs.microsoft.com/en-us/microsoft-edge/webview2",
"homepage": "https://learn.microsoft.com/en-us/microsoft-edge/webview2",
"documentation": "https://learn.microsoft.com/en-us/microsoft-edge/webview2",

Copilot uses AI. Check for mistakes.
"license": "BSD-3-Clause",
"supports": "windows & (x86 | x64 | arm64)",
"dependencies": [
"wil"
]
}