diff --git a/CMakeLists.txt b/CMakeLists.txt index fb3cda02e..ff6926a57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} $ $ @@ -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() diff --git a/other/manifest/dpimanifest.manifest b/other/manifest/dpimanifest.manifest new file mode 100644 index 000000000..a10c25c22 --- /dev/null +++ b/other/manifest/dpimanifest.manifest @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + True/PM + + + + diff --git a/other/manifest/dpimanifest.rc b/other/manifest/dpimanifest.rc new file mode 100644 index 000000000..9ba70e223 --- /dev/null +++ b/other/manifest/dpimanifest.rc @@ -0,0 +1,2 @@ +#include "winuser.h" +1 RT_MANIFEST dpimanifest.manifest \ No newline at end of file