vcpkg/ports/webview2/portfile.cmake
Frank 00b039f1da
[webview2] Update to 1.0.2277.86 ()
<!-- If your PR fixes issues, please note that here by adding "Fixes
#NNNNNN." for each fixed issue on separate lines. -->
Fix https://github.com/microsoft/vcpkg/issues/36738
<!-- If you are still working on the PR, open it as a Draft:
https://github.blog/2019-02-14-introducing-draft-pull-requests/. -->
The usage has been tested successfully on `x64-windows`.
<!-- If this PR updates an existing port, please uncomment and fill out
this checklist:-->

- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [ ] ~~The "supports" clause reflects platforms that may be fixed by
this new version.~~
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.
<!-- If this PR adds a new port, please uncomment and fill out this
checklist:

- [ ] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] The name of the port matches an existing name for this component
on https://repology.org/ if possible, and/or is strongly associated with
that component on search engines.
- [ ] Optional dependencies are resolved in exactly one way. For
example, if the component is built with CMake, all `find_package` calls
are REQUIRED, are satisfied by `vcpkg.json`'s declared dependencies, or
disabled with
[CMAKE_DISABLE_FIND_PACKAGE_Xxx](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html).
- [ ] The versioning scheme in `vcpkg.json` matches what upstream says.
- [ ] The license declaration in `vcpkg.json` matches what upstream
says.
- [ ] The installed as the "copyright" file matches what upstream says.
- [ ] The source code of the component installed comes from an
authoritative source.
- [ ] The generated "usage text" is accurate. See
[adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md)
for context.
- [ ] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [ ] Only one version is in the new port's versions file.
- [ ] Only one version is added to each modified port's versions file.

END OF NEW PORT CHECKLIST (delete this line) -->
2024-02-21 09:21:10 -08:00

54 lines
2.1 KiB
CMake

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 83384c5232cc95007aca0a5557e1f42a0784fcf57360e65535b3e25421e0de39d6889ebe17f446a94e00123923da917f47fe932817c9d2cc3c3e1fff314476f5
)
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)