3b16e8ff36
runner.exe.manifest 已声明 requireAdministrator;链接器默认还会注入 asInvoker 的 UAC 清单,两者 level 冲突 → mt.exe c1010001 → LINK LNK1327,Release 链接失败。 对 runner target 加 /MANIFESTUAC:NO,仅用 manifest 文件的 level。真机 build 通过。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
46 lines
2.1 KiB
CMake
46 lines
2.1 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(runner LANGUAGES CXX)
|
|
|
|
# Define the application target. To change its name, change BINARY_NAME in the
|
|
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
|
|
# work.
|
|
#
|
|
# Any new source files that you add to the application should be added here.
|
|
add_executable(${BINARY_NAME} WIN32
|
|
"flutter_window.cpp"
|
|
"main.cpp"
|
|
"utils.cpp"
|
|
"win32_window.cpp"
|
|
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
|
|
"Runner.rc"
|
|
"runner.exe.manifest"
|
|
)
|
|
|
|
# Apply the standard set of build settings. This can be removed for applications
|
|
# that need different build settings.
|
|
apply_standard_settings(${BINARY_NAME})
|
|
|
|
# Add preprocessor definitions for the build version.
|
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
|
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
|
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
|
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
|
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
|
|
|
|
# Disable Windows macros that collide with C++ standard library functions.
|
|
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
|
|
|
|
# Add dependency libraries and include directories. Add any application-specific
|
|
# dependencies here.
|
|
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
|
|
target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
|
|
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
|
|
|
|
# runner.exe.manifest 已声明 requestedExecutionLevel=requireAdministrator(UAC 提权,
|
|
# sing-box 子进程继承管理员权建 TUN)。关闭链接器自动注入的 UAC 清单(默认 asInvoker),
|
|
# 否则与 runner.exe.manifest 的 level 冲突,mt.exe 报 c1010001 → LINK : LNK1327。
|
|
target_link_options(${BINARY_NAME} PRIVATE "/MANIFESTUAC:NO")
|
|
|
|
# Run the Flutter tool portions of the build. This must not be removed.
|
|
add_dependencies(${BINARY_NAME} flutter_assemble)
|