microsoft / DirectXTK12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
https://walbourn.github.io/directx-tool-kit-for-directx-12/
MIT License
1.49k stars 396 forks source link

Add NO_WCHAR_T build option to CMake #178

Closed walbourn closed 1 year ago

walbourn commented 1 year ago

Some usage scenarios build the library with /Zc:wchar_t- but mix both unsigned short* and wchar_t* client usage. For this opt-in build scenario, the library will link with both the non-native and native wchar_t.

Note this works for general use, but not necessarily all use cases. For example, all the effect and texture factory virtual methods are defined only using the type that matches the compiler setting for the library, as there's no easy way to provide an adapter for these. There are also some edge-cases like SpriteFont::GetDefaultCharacter that you can't use a link-time adapter because the overloading rules don't allow only differing by return type.

Also fixes some Code Analysis warnings as you can't use _In_opt_ with std::function<>.