CesiumGS / cesium-unity

Bringing the 3D geospatial ecosystem to Unity
https://cesium.com/platform/cesium-for-unity/
Apache License 2.0
347 stars 83 forks source link

Statically link C runtime library on Windows #419

Closed kring closed 3 months ago

kring commented 7 months ago

We build the native code in to-be-released versions of Cesium for Unity using Visual Studio 2019 and don't explicitly specify any run-time library options. As a result, I believe we effectively end up using /MD, which means that the appropriate version of the C runtime library must be available at runtime. In other words, end users must have a "Visual C++ Redistributable" installed with a version equal to or higher than the compiler we used to build it (including patches).

Unity itself doesn't require a Visual C++ Redistributable (source), so it's rather inconvenient that Cesium for Unity does. I think if we compile with /MT instead, we won't need any extra DLLs at runtime. Our built DLLs might get noticeably bigger, but it's probably worth it.