修复处理内容包括公告 WebView、文件预览页、分享页兜底获取下载链接的隐藏 WebView。

This commit is contained in:
2026-05-27 23:47:10 +08:00
parent 12f2c2660e
commit 24d20cbfcb
4 changed files with 545 additions and 242 deletions
+53 -12
View File
@@ -32,21 +32,56 @@ set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
# Use Unicode for all projects.
add_definitions(-DUNICODE -D_UNICODE)
# flutter_inappwebview_windows requires NuGet; help CMake find it
if(NOT DEFINED NUGET OR NUGET STREQUAL "NUGET-NOTFOUND")
find_program(NUGET nuget PATHS
"$ENV{USERPROFILE}\\.local\\bin"
"$ENV{LOCALAPPDATA}\\Microsoft\\WinGet\\Links"
"C:/ProgramData/chocolatey/bin"
NO_DEFAULT_PATH
)
find_program(NUGET nuget)
if(NUGET AND NOT NUGET STREQUAL "NUGET-NOTFOUND")
message(STATUS "Found NuGet: ${NUGET}")
set(NUGET "${NUGET}" CACHE FILEPATH "nuget executable" FORCE)
# flutter_inappwebview_windows requires NuGet. The plugin's own CMake only
# calls find_program(NUGET nuget), so seed the cache with an absolute path.
if(DEFINED NUGET AND NOT NUGET STREQUAL "" AND NOT NUGET STREQUAL "NUGET-NOTFOUND")
if(NOT EXISTS "${NUGET}")
unset(NUGET CACHE)
unset(NUGET)
endif()
endif()
if(NOT DEFINED NUGET OR NUGET STREQUAL "" OR NUGET STREQUAL "NUGET-NOTFOUND")
set(_NUGET_CANDIDATES
"$ENV{SystemRoot}/System32/nuget.exe"
"$ENV{windir}/System32/nuget.exe"
"C:/Windows/System32/nuget.exe"
"$ENV{SystemRoot}/Sysnative/nuget.exe"
"$ENV{windir}/Sysnative/nuget.exe"
"C:/Windows/Sysnative/nuget.exe"
"$ENV{USERPROFILE}/.local/bin/nuget.exe"
"$ENV{LOCALAPPDATA}/Microsoft/WinGet/Links/nuget.exe"
"C:/ProgramData/chocolatey/bin/nuget.exe"
)
foreach(_NUGET_CANDIDATE IN LISTS _NUGET_CANDIDATES)
if(EXISTS "${_NUGET_CANDIDATE}")
set(NUGET "${_NUGET_CANDIDATE}")
break()
endif()
endforeach()
endif()
if(NOT DEFINED NUGET OR NUGET STREQUAL "" OR NUGET STREQUAL "NUGET-NOTFOUND")
find_program(NUGET NAMES nuget.exe nuget)
endif()
if(NUGET AND NOT NUGET STREQUAL "NUGET-NOTFOUND")
set(_PROJECT_NUGET "${CMAKE_BINARY_DIR}/nuget.exe")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${NUGET}" "${_PROJECT_NUGET}"
RESULT_VARIABLE _NUGET_COPY_RESULT
)
if(_NUGET_COPY_RESULT EQUAL 0 AND EXISTS "${_PROJECT_NUGET}")
set(NUGET "${_PROJECT_NUGET}")
else()
message(WARNING "Failed to copy NuGet to ${_PROJECT_NUGET}; using ${NUGET}")
endif()
message(STATUS "Found NuGet: ${NUGET}")
set(NUGET "${NUGET}" CACHE FILEPATH "nuget executable" FORCE)
else()
message(WARNING "NuGet executable was not found. Windows WebView builds may fail.")
endif()
# Compilation settings that should be applied to most targets.
#
# Be cautious about adding new options here, as plugins use this function by
@@ -125,6 +160,12 @@ ENSURE_WINDOWS_ARCHIVE(
# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
if(POLICY CMP0175)
# flutter_inappwebview_windows 0.7.0-beta.3 passes DEPENDS to the TARGET
# form of add_custom_command. Keep older CMake behavior for plugins that do
# not set this policy themselves.
set(CMAKE_POLICY_DEFAULT_CMP0175 OLD)
endif()
include(flutter/generated_plugins.cmake)
if(MSVC)