-1

是否可以使用 cmake 或某些脚本配置 DPI Awareness 值? https://i.stack.imgur.com/ySWvE.png

4

3 回答 3

2

创建一个.manifest包含以下内容的清单文件(很重要):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <asmv3:application>
    <asmv3:windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

请参阅https://docs.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process

然后使用以下命令将其添加到 CMake 中的二进制目标:

target_sources(your-binary PRIVATE path-to-the-file-above.manifest)

您需要 CMake 3.4 或更高版本,请参阅https://cmake.org/cmake/help/v3.4/release/3.4.html#other

于 2021-02-17T22:11:31.090 回答
0

CMake 中没有内部清单支持,但您可以使用它,此站点上有一些提示(例如,人们使用清单,例如因为 UAC 等)。

关于 DPI,在 SO 上搜索其他主题,例如这里

于 2018-04-24T22:59:38.220 回答
0

我发现这很有帮助。使用 cmake 应用清单。

https://gist.github.com/bjornblissing/6fc452fe7ec1fdfe3419

于 2018-05-03T09:11:52.353 回答