diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/webview2 | |
Diffstat (limited to 'vcpkg/ports/webview2')
| -rw-r--r-- | vcpkg/ports/webview2/portfile.cmake | 53 | ||||
| -rw-r--r-- | vcpkg/ports/webview2/unofficial-webview2-config.cmake | 21 | ||||
| -rw-r--r-- | vcpkg/ports/webview2/vcpkg.json | 12 |
3 files changed, 86 insertions, 0 deletions
diff --git a/vcpkg/ports/webview2/portfile.cmake b/vcpkg/ports/webview2/portfile.cmake new file mode 100644 index 0000000..0611c9f --- /dev/null +++ b/vcpkg/ports/webview2/portfile.cmake @@ -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 dd447d7526e82a0e4522447d0e861f347ad72f2a73dfa82cca2537f633afe54b2764c2d437f717cf22aeb339641f79c04f9cbce0b68a100eef716bd58c1a8989 +) + +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) + +configure_file("${SOURCE_PATH}/LICENSE.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) diff --git a/vcpkg/ports/webview2/unofficial-webview2-config.cmake b/vcpkg/ports/webview2/unofficial-webview2-config.cmake new file mode 100644 index 0000000..60851bc --- /dev/null +++ b/vcpkg/ports/webview2/unofficial-webview2-config.cmake @@ -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() + +unset(_IMPORT_PREFIX) diff --git a/vcpkg/ports/webview2/vcpkg.json b/vcpkg/ports/webview2/vcpkg.json new file mode 100644 index 0000000..f8484bd --- /dev/null +++ b/vcpkg/ports/webview2/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "webview2", + "version": "1.0.3240.44", + "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", + "license": "BSD-3-Clause", + "supports": "windows & (x86 | x64 | arm64)", + "dependencies": [ + "wil" + ] +} |