From 122c5f53a2d7527b60433e75c4fe802842a83208 Mon Sep 17 00:00:00 2001 From: CodingJellyfish Date: Sat, 26 Oct 2024 23:54:48 +0800 Subject: [PATCH] Fix #4971 (#5195) * DPI aware on Windows * Fix duplicate manifest * Try fix MSVC * Try fix MSVC * Try fix MSVC --- CMakeLists.txt | 14 ++++++++++++++ windows/dpi_aware.manifest | 13 +++++++++++++ windows/windows_config.rc | 3 +++ 3 files changed, 30 insertions(+) create mode 100644 windows/dpi_aware.manifest create mode 100644 windows/windows_config.rc diff --git a/CMakeLists.txt b/CMakeLists.txt index b878b4678d8..010a663f039 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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:\"$\"\;\#1 + -outputresource:\"$\"\;\#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) diff --git a/windows/dpi_aware.manifest b/windows/dpi_aware.manifest new file mode 100644 index 00000000000..2d6e166ea1d --- /dev/null +++ b/windows/dpi_aware.manifest @@ -0,0 +1,13 @@ + + + + + + + + true/pm + + PerMonitorV2,permonitor + + + \ No newline at end of file diff --git a/windows/windows_config.rc b/windows/windows_config.rc new file mode 100644 index 00000000000..f2344001936 --- /dev/null +++ b/windows/windows_config.rc @@ -0,0 +1,3 @@ +#include "winuser.h" + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "dpi_aware.manifest" \ No newline at end of file