Commit 5087aa3f authored by Brian Paul's avatar Brian Paul

cmake: create Win10 manifest files for particular executables

On Windows10 (and possibly older versions), UAC (User Account Control)
intervenes when starting an executables with "patch", "update" or "setup"
in their name.  This requires the user to approve execution by clicking
in a dialog window (and even then, causes test failures).  With Cygwin,
you simply get "Permission Denied".

Currently, there are four Piglit tests which need this special treatment:
bin/arb_compute_shader-zero-dispatch-size
bin/arb_tessellation_shader-invalid-patch-vertices-range
bin/glsl-uniform-update
bin/mipmap-setup

A work-around is to create a manifest file for each effected executable.
This patch creates a <foo>.exe.manifest file if "foo" contains any of
the above strings.  There's no effect on non-Windows platforms.

Note: this solution uses the cmake file(GENERATE ...) function.  I think
add_custom_command() is probably the proper approach, but I've been
unsuccessful in getting that to work.
Reviewed-by: Charmaine Lee's avatarCharmaine Lee <charmainel@vmware.com>
parent 639ecb3b
......@@ -58,6 +58,8 @@ endfunction(piglit_include_target_api)
#
function(piglit_add_executable name)
piglit_create_manifest_file(${name})
list(REMOVE_AT ARGV 0)
add_executable(${name} ${ARGV})
add_dependencies(${name} piglit_dispatch_gen)
......@@ -89,3 +91,31 @@ function(piglit_add_library name)
endif()
endfunction(piglit_add_library)
# This is lame, but Windows 10 (and maybe Win8) asks for confirmation
# before running .exe files containing the strings "patch", "setup",
# "update", etc. In Cygwin, we simply get "Permission Denied".
# This causes the Piglit test to fail.
# The work-around is to create a "manifest" file for such executables.
# This function examines the target name and creates the manifest file
# if needed. The file will be named "${target}.exe.manifest".
# See https://answers.microsoft.com/en-us/windows/forum/windows_7-security/uac-prompts-on-any-program-with-the-word-patch-or/c5359497-d16e-43c6-99f2-db3d8eecc9c0?auth=1
function(piglit_create_manifest_file target)
if (WIN32)
# look for known strings
string(FIND ${target} "patch" r1)
string(FIND ${target} "setup" r2)
string(FIND ${target} "update" r3)
# if any of those strings is in the target filename
if((${r1} GREATER -1) OR (${r2} GREATER -1) OR (${r3} GREATER -1))
# XXX we should probably use add_custom_command() here to copy
# the manifest file, but I've been unsuccessful in getting
# that to work.
file(GENERATE
OUTPUT bin/${target}.exe.manifest
INPUT ${CMAKE_SOURCE_DIR}/cmake/win10-manifest.txt)
endif()
endif()
endfunction(piglit_create_manifest_file)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<!-- Make sure that UAC believes
that it does not require administrative privilege -->
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment