Merge pull request #917 from Jupeyy/master

Add DPI awareness support for MSVC compiling for Win8.1 and Win10
This commit is contained in:
Dennis Felsing 2017-10-23 09:42:47 +02:00 committed by GitHub
commit fdc475f20e
3 changed files with 53 additions and 0 deletions

View file

@ -753,8 +753,14 @@ if(CLIENT)
if(TARGET_OS STREQUAL "windows")
set(CLIENT_ICON "other/icons/DDNet.rc")
if(MINGW)
set(CLIENT_MANIFEST "other/manifest/dpimanifest.rc")
else()
set(CLIENT_MANIFEST)
endif()
else()
set(CLIENT_ICON)
set(CLIENT_MANIFEST)
endif()
# Target
@ -762,6 +768,7 @@ if(CLIENT)
add_executable(${TARGET_CLIENT}
${CLIENT_SRC}
${CLIENT_ICON}
${CLIENT_MANIFEST}
${DEPS_CLIENT}
$<TARGET_OBJECTS:engine-shared>
$<TARGET_OBJECTS:game-shared>
@ -1295,3 +1302,19 @@ foreach(target ${TARGETS_DEP})
target_compile_options(${target} PRIVATE /W0)
endif()
endforeach()
if(MSVC)
if(CMAKE_VERSION VERSION_LESS 3)
message(WARNING "CMake version 3 or newer is required to enable dpi awareness")
elseif(CMAKE_VERSION VERSION_LESS 3.4)
add_custom_command(
TARGET ${CLIENT_EXECUTABLE}
POST_BUILD
COMMAND
"mt.exe" -manifest \"${CMAKE_SOURCE_DIR}/other/manifest/dpimanifest.manifest\" -outputresource:\"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CLIENT_EXECUTABLE}.exe\"\;\#1
COMMENT "Adding DPI awareness"
)
else()
target_sources(${TARGET_CLIENT} PRIVATE other/manifest/dpimanifest.manifest)
endif()
endif()

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="DDNet.exe"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
</application>
</compatibility>
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings
xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</asmv1:assembly>

View file

@ -0,0 +1,2 @@
#include "winuser.h"
1 RT_MANIFEST dpimanifest.manifest