Skip to content

Test updated webview2 vcpkg library#6891

Closed
AenBleidd wants to merge 1 commit intomasterfrom
vko_test_updated_webview_vcpkg_library
Closed

Test updated webview2 vcpkg library#6891
AenBleidd wants to merge 1 commit intomasterfrom
vko_test_updated_webview_vcpkg_library

Conversation

@AenBleidd
Copy link
Member

@AenBleidd AenBleidd commented Feb 25, 2026

Summary by cubic

Adds a custom vcpkg port for Microsoft WebView2 (1.0.3800.47) to make WebView2 available in our Windows builds via vcpkg. Includes an unofficial CMake config that provides a single imported target for static or shared linking.

  • New Features
    • Adds vcpkg portfiles and metadata (download from NuGet, version 1.0.3800.47).
    • Provides unofficial::webview2::webview2 imported CMake target that switches between static and shared loader.
    • Copies headers (include and include-winrt), loader libs/DLLs, and winmd; mirrors libs to debug when needed.
    • Enables empty-package policy as a workaround for failing import libraries; includes license.

Written for commit 0a6a5d8. Summary will update on new commits.

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
Copilot AI review requested due to automatic review settings February 25, 2026 05:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a custom vcpkg port overlay for the Microsoft WebView2 loader, targeting an updated WebView2 NuGet package version.

Changes:

  • Introduces a webview2 port manifest pinned to 1.0.3800.47
  • Adds a CMake package config to expose an imported target (unofficial::webview2::webview2)
  • Implements the portfile to download/extract the NuGet payload and install headers/binaries

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
3rdParty/vcpkg_ports/ports/webview2/vcpkg.json Defines the webview2 port metadata and dependency on wil.
3rdParty/vcpkg_ports/ports/webview2/unofficial-webview2-config.cmake Provides an imported CMake target for consumers via find_package.
3rdParty/vcpkg_ports/ports/webview2/portfile.cmake Downloads the NuGet package and installs headers/libs/dlls into the vcpkg package layout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4 to +19
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()
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.
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.
Comment on lines +5 to +6
"homepage": "https://docs.microsoft.com/en-us/microsoft-edge/webview2",
"documentation": "https://docs.microsoft.com/en-us/microsoft-edge/webview2",
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.
@AenBleidd AenBleidd closed this Feb 25, 2026
@AenBleidd AenBleidd deleted the vko_test_updated_webview_vcpkg_library branch February 25, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants