cesium-native icon indicating copy to clipboard operation
cesium-native copied to clipboard

Debug build installs release dependency libraries

Open ELeeScape opened this issue 1 year ago • 1 comments

In PR #820, specifically this commit, a bunch of changes were made to accommodate the special needs of cesium-unreal, including the fact that the Unreal Engine doesn't have a real debug build; even the debug build of UE links to the release CRT libs, so the debug build of cesium-unreal also links to the release CRT libs, and that cascaded back to cesium-native where as of #820 even a debug build installs the release versions of all of its dependencies (though the Cesium libs themselves are debug versions). This means you can't do a debug build of cesium-native and then link it to a typical debug build of some client other than cesium-unreal, because the CRT lib types will be all mismatched.

The result when you try (at least on Windows with MSVC) is a bunch of errors that look like this:

error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' 

The fix (I think) is that /CMakeLists.txt needs to install libs from ${PACKAGE_DIR}/debug/lib/ (here and here) if it's a debug config AND some special Unreal flag isn't set, otherwise install libs from ${PACKAGE_DIR}/lib/. I'm not sure how to best detect the Unreal condition, though, so I'll leave it to someone who know what they're doing to come up with the PR.

ELeeScape avatar Oct 22 '24 04:10 ELeeScape

@ELeeScape this should be fixed in https://github.com/CesiumGS/cesium-native/pull/962. I haven't tested it in Unreal though.

lilleyse avatar Oct 22 '24 13:10 lilleyse