This commit is contained in:
Yuhang Zhao 2023-08-15 11:21:21 +08:00
parent f18329aa8c
commit 67eda16e55
1 changed files with 36 additions and 13 deletions

View File

@ -1500,7 +1500,7 @@ END
endfunction()
function(generate_win32_manifest_file)
cmake_parse_arguments(MF_ARGS "UTF8_CODEPAGE;VISTA_COMPAT;WIN7_COMPAT;WIN8_COMPAT;WIN8_1_COMPAT;WIN10_COMPAT;WIN11_COMPAT;XAML_ISLANDS_COMPAT;REQUIRE_ADMIN" "PATH;ID;VERSION;DESCRIPTION" "" ${ARGN})
cmake_parse_arguments(MF_ARGS "UTF8_CODEPAGE;VISTA_COMPAT;WIN7_COMPAT;WIN8_COMPAT;WIN8_1_COMPAT;WIN10_COMPAT;WIN11_COMPAT;XAML_ISLANDS_COMPAT;REQUIRE_ADMIN" "PATH;ID;VERSION;DESCRIPTION;ARCHITECTURE;LANGUAGE;PUBLIC_KEY_TOKEN" "" ${ARGN})
if(NOT MF_ARGS_PATH)
message(AUTHOR_WARNING "generate_win32_manifest_file: You need to specify where to put the generated rc file for this function!")
return()
@ -1514,7 +1514,7 @@ function(generate_win32_manifest_file)
return()
endif()
set(__id "${MF_ARGS_ID}")
set(__version)
set(__version "")
if(MF_ARGS_VERSION)
if(MF_ARGS_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+")
set(__version "${MF_ARGS_VERSION}")
@ -1530,42 +1530,60 @@ function(generate_win32_manifest_file)
else()
set(__version "0.0.0.0")
endif()
set(__description)
set(__architecture "")
if(MF_ARGS_ARCHITECTURE)
set(__architecture "${MF_ARGS_ARCHITECTURE}")
else()
set(__architecture "*")
endif()
set(__language "")
if(MF_ARGS_LANGUAGE)
set(__language "${MF_ARGS_LANGUAGE}")
else()
set(__language "*")
endif()
set(__public_key_token "")
if(MF_ARGS_PUBLIC_KEY_TOKEN)
set(__public_key_token "publicKeyToken=\"${MF_ARGS_PUBLIC_KEY_TOKEN}\" ")
endif()
set(__description "")
if(MF_ARGS_DESCRIPTION)
set(__description "<description>${MF_ARGS_DESCRIPTION}</description>")
endif()
set(__execution_level)
set(__execution_level "")
if(MF_ARGS_REQUIRE_ADMIN)
set(__execution_level "requireAdministrator")
else()
set(__execution_level "asInvoker")
endif()
set(__vista_compat)
set(__vista_compat "")
if(MF_ARGS_VISTA_COMPAT)
set(__vista_compat "<!-- Windows Vista and Windows Server 2008 -->
<supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\"/>")
endif()
set(__win7_compat)
set(__win7_compat "")
if(MF_ARGS_WIN7_COMPAT)
set(__win7_compat "<!-- Windows 7 and Windows Server 2008 R2 -->
<supportedOS Id=\"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}\"/>")
endif()
set(__win8_compat)
set(__win8_compat "")
if(MF_ARGS_WIN8_COMPAT)
set(__win8_compat "<!-- Windows 8 and Windows Server 2012 -->
<supportedOS Id=\"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}\"/>")
endif()
set(__win8_1_compat)
set(__win8_1_compat "")
if(MF_ARGS_WIN8_1_COMPAT)
set(__win8_1_compat "<!-- Windows 8.1 and Windows Server 2012 R2 -->
<supportedOS Id=\"{1f676c76-80e1-4239-95bb-83d0f6d0da78}\"/>")
endif()
set(__win10_11_compat)
set(__win10_11_compat "")
if(MF_ARGS_WIN10_COMPAT OR MF_ARGS_WIN11_COMPAT)
set(__win10_11_compat "<!-- Windows 10 and Windows 11 -->
set(__win10_11_compat "<!-- Windows 10, Windows 11, Windows Server 2016, Windows Server 2019 and Windows Server 2022 -->
<supportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\"/>")
endif()
set(__xaml_islands_compat "<!-- Windows 10 Version 1809 (October 2018 Update) -->
set(__xaml_islands_compat "")
if(MF_ARGS_XAML_ISLANDS_COMPAT)
set(__xaml_islands_compat "<!-- Windows 10 Version 1809 (October 2018 Update) -->
<maxversiontested Id=\"10.0.17763.0\"/>
<!-- Windows 10 Version 1903 (May 2019 Update) -->
<maxversiontested Id=\"10.0.18362.0\"/>
@ -1585,7 +1603,8 @@ function(generate_win32_manifest_file)
<maxversiontested Id=\"10.0.22000.0\"/>
<!-- Windows 11 Version 22H2 (October 2022 Update) -->
<maxversiontested Id=\"10.0.22621.0\"/>")
set(__utf8_codepage)
endif()
set(__utf8_codepage "")
if(MF_ARGS_UTF8_CODEPAGE)
set(__utf8_codepage "<activeCodePage xmlns=\"http://schemas.microsoft.com/SMI/2019/WindowsSettings\">UTF-8</activeCodePage>")
endif()
@ -1594,7 +1613,7 @@ function(generate_win32_manifest_file)
<!-- This file is auto-generated by CMake. DO NOT EDIT! ALL MODIFICATIONS WILL BE LOST! -->
<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">
<assemblyIdentity type=\"win32\" name=\"${__id}\" version=\"${__version}\"/>
<assemblyIdentity type=\"win32\" name=\"${__id}\" version=\"${__version}\" processorArchitecture=\"${__architecture}\" ${__public_key_token}language=\"${__language}\"/>
${__description}
<dependency>
<dependentAssembly>
@ -1626,6 +1645,10 @@ function(generate_win32_manifest_file)
<longPathAware xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">True</longPathAware>
<heapType xmlns=\"http://schemas.microsoft.com/SMI/2020/WindowsSettings\">SegmentHeap</heapType>
${__utf8_codepage}
<disableWindowFiltering xmlns=\"http://schemas.microsoft.com/SMI/2011/WindowsSettings\">True</disableWindowFiltering>
<highResolutionScrollingAware>True</highResolutionScrollingAware>
<ultraHighResolutionScrollingAware>True</ultraHighResolutionScrollingAware>
<!-- <gdiScaling xmlns=\"http://schemas.microsoft.com/SMI/2017/WindowsSettings\">True</gdiScaling> -->
</windowsSettings>
</application>
</assembly>