Platform-specific guides » Windows

Tips and tricks for Windows platforms.

HiDPI support

Windows supports two approaches to advertising HiDPI support — either via the manifest file or through the SetProcessDpiAwareness() API. See the API documentation for more information.

Windows RT

Windows RT is a restricted subset of Windows API, used for UWP / "Metro" / Windows Store apps. The major difference is lack of access to APIs that are common in Win32 world, such as memory-mapped files, DLLs or environment variables.

In particular, Windows RT doesn't provide a direct access to OpenGL, the only possibility to use it is through ANGLE. See Building for ANGLE on Windows and ANGLE for more information.

For Windows RT you need to provide logo images and splash screen, all referenced from the *.appxmanifest file. The file is slightly different for different targets, template for Windows Store and MSVC 2013 is below, others are in the SDL2 bootstrap application.

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="" xmlns:m2="">
  <Identity Name="MyApplication" Publisher="CN=A Publisher" Version="" />
    <DisplayName>My Application</DisplayName>
    <PublisherDisplayName>A Publisher</PublisherDisplayName>
    <Resource Language="x-generate" />
    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="MyApplication.App">
        DisplayName="Magnum Windows Store Application"
        Description="My Application"
        <m2:SplashScreen Image="assets/splash.png" />

The assets are referenced also from the main CMakeLists.txt file. You have to mark all non-source files (except for the *.pfx key) with VS_DEPLOYMENT_CONTENT property and optionally set their location with VS_DEPLOYMENT_LOCATION. If you are using *.resw files, these need to have the VS_TOOL_OVERRIDE property set to PRIResource.

MSVC version mapping

MSVC and Visual Studio use three, er, four different versioning schemes. CMake exposes compiler version equivalent to the _MSC_VER macro, see this handy Wikipedia table for mapping to Visual Studio versions. For example, a check for MSVC 2017 would look like this:

    # Code requiring MSVC 2017