Add DPI Awareness option to CMake

For VS solutions, the DPI aware manifest is added as additional manifest.
For makefiles, the DPI aware manifest is included via the resource file.

Set the default DPI Awareness to per-monitor.
This commit is contained in:
Maarten Bent
2019-10-29 00:33:43 +01:00
parent 8a40d23b27
commit 6f02c3a897
7 changed files with 179 additions and 6 deletions

View File

@@ -658,7 +658,27 @@ function(wx_add_sample name)
else()
set(exe_type WIN32 MACOSX_BUNDLE)
endif()
if (WXMSW AND DEFINED wxUSE_DPI_AWARE_MANIFEST)
set(wxDPI_MANIFEST_PRFIX "wx")
if (wxARCH_SUFFIX)
set(wxDPI_MANIFEST_PRFIX "amd64")
endif()
set(wxUSE_DPI_AWARE_MANIFEST_VALUE 0)
if (${wxUSE_DPI_AWARE_MANIFEST} MATCHES "system")
set(wxUSE_DPI_AWARE_MANIFEST_VALUE 1)
list(APPEND src_files "${wxSOURCE_DIR}/include/wx/msw/${wxDPI_MANIFEST_PRFIX}-dpi-aware.manifest")
elseif(${wxUSE_DPI_AWARE_MANIFEST} MATCHES "per-monitor")
set(wxUSE_DPI_AWARE_MANIFEST_VALUE 2)
list(APPEND src_files "${wxSOURCE_DIR}/include/wx/msw/${wxDPI_MANIFEST_PRFIX}-dpi-aware-pmv2.manifest")
endif()
endif()
add_executable(${target_name} ${exe_type} ${src_files})
if (DEFINED wxUSE_DPI_AWARE_MANIFEST_VALUE)
target_compile_definitions(${target_name} PRIVATE wxUSE_DPI_AWARE_MANIFEST=${wxUSE_DPI_AWARE_MANIFEST_VALUE})
endif()
endif()
# All samples use at least the base library other libraries
# will have to be added with wx_link_sample_libraries()