Closed sdcb closed 5 years ago
I'm certainly open to the idea of maintaining cmake support, so I'll keep it in mind.
That said, I've yet to find any sound technical reason why having DirectXTK as a DLL is at all desirable. The main value of a DLL is being able to replace the binary DLL code without having to change the client of the DLL, which requires a consistent ABI. There is no such ABI for DirectXTK. It doesn't use COM or C-linkage, minimal use of virtual indirection, and I make no guarantees from version to version of a consistent public interface in terms of linkage. Furthermore, since I make use the Standard C++ Library, there's no consistent ABI between versions of Visual C++ so you still need to generate version-specific DLLs. Plus I make use of inline functions in a number of public interfaces.
Past experience with the D3DX utiltiy library as a DLL has also shown that it's quite problematic in terms of distribution and matinainence, with little upside. DLL exporting means turning all methods into indirect calls with little value to the runtime selection flexibility, and since I make use of pImpl many methods would actually become double-indirections. This also greatly limits the optmization options of LTCG, in game scenarios it introduces aditional attack surface for cheaters, and can potentially lead to multiple versions of the CRT being bound to a process simultaenously.
Just to chime in, I would suggest directing those interested to use vcpkg for out of the box cmake support. It takes a lot of the burden off the project maintainers and moves it to a consistent platform for finding and installing packages. The only downside is if you have a lot of customization, you have to learn a new package management system. We only continue to use a custom cmake file because our version of directxtk is highly modified.
Note that this pull request includes cmake files. With VS 2019 Update 1, it's a lot easier for me to maintain now and get some value out of if by using clang for conformance validation.
I hope you can provide the cmake support.
Reference here: https://github.com/Microsoft/vcpkg/pull/538
By switch build from msbuild to cmake, directxtk can easier to port to dynamic linkage,I created a test CMakeLists.txt here: https://gist.github.com/sdcb/8ee863c79a70406d4ed8a9e3f10019a2
But it's still not done yet because the dllimport/dllexport is not specified.