Skip to content

Commit

Permalink
Fix #4971 (#5195)
Browse files Browse the repository at this point in the history
* DPI aware on Windows

* Fix duplicate manifest

* Try fix MSVC

* Try fix MSVC

* Try fix MSVC
  • Loading branch information
CodingJellyfish authored Oct 26, 2024
1 parent 9e62028 commit 122c5f5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,20 @@ if(MSVC OR MINGW)
add_custom_target(stkshaders SOURCES ${STK_SHADERS})
endif()

if(MSVC)
SET(CMAKE_SHARED_LINKER_FLAGS /MANIFEST:NO)
add_custom_command(
TARGET supertuxkart POST_BUILD COMMAND "mt.exe"
-manifest \"${PROJECT_SOURCE_DIR}\\windows\\dpi_aware.manifest\"
-inputresource:\"$<TARGET_FILE:supertuxkart>\"\;\#1
-outputresource:\"$<TARGET_FILE:supertuxkart>\"\;\#1)
endif()

if(MINGW)
SET(CMAKE_SHARED_LINKER_FLAGS /MANIFEST:NO)
target_sources(supertuxkart PRIVATE windows/windows_config.rc)
endif()

if(MINGW)
target_link_libraries(supertuxkart -ldxguid -ldnsapi)
if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
Expand Down
13 changes: 13 additions & 0 deletions windows/dpi_aware.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity type="win32" name="MyApplication" version="1.0.0.0" processorArchitecture="amd64"/>

<asmv3:application>
<asmv3:windowsSettings>
<!-- fallback for Windows 7 and 8 -->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<!-- adding v1 as fallback would result in v2 not being applied to dialogs on capable systems -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,permonitor</dpiAwareness>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
3 changes: 3 additions & 0 deletions windows/windows_config.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "winuser.h"

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "dpi_aware.manifest"

0 comments on commit 122c5f5

Please sign in to comment.