DiligentGraphics/DiligentCore

treat warnings as errors cause error when I just want to use direct11

zeroxer opened this issue · 0 comments

My CMakeLists.txt file is:

set(DILIGENT_NO_DIRECT3D12 TRUE CACHE INTERNAL "Disable Direct3D12")
set(DILIGENT_NO_OPENGL TRUE CACHE INTERNAL "Disable OpenGL")
set(DILIGENT_NO_VULKAN TRUE CACHE INTERNAL "Disable Vulkan")
add_subdirectory(${3rdPartyDir}/DiligentCore)

It will stop when compile ArchiverImpl.cpp, there are some code will never reach.

DiligentCore\Graphics\Archiver\src\ArchiverImpl.cpp(732): error C2220
DiligentCore\Graphics\Archiver\src\ArchiverImpl.cpp(732): warning C4702

#if VULKAN_SUPPORTED
    ExtractShadersVk(PSOCreateInfo, ShaderMapVk);
    VERIFY_EXPR(!ShaderMapVk.empty());
#endif
#if D3D12_SUPPORTED
    ExtractShadersD3D12(PSOCreateInfo, ShaderMapD3D12);
    VERIFY_EXPR(!ShaderMapD3D12.empty());
#endif
#if !VULKAN_SUPPORTED && !D3D12_SUPPORTED
    return;
#endif

    // Note: here
    VERIFY(ShaderMapVk.empty() || ShaderMapD3D12.empty() || ShaderMapVk == ShaderMapD3D12,
           "Ray tracing shader map must be same for Vulkan and Direct3D12 backends");

    RayTracingShaderMap ShaderMap;
    if (!ShaderMapVk.empty())
        std::swap(ShaderMap, ShaderMapVk);
    else if (!ShaderMapD3D12.empty())
        std::swap(ShaderMap, ShaderMapD3D12);
    else
        return;

In DiligentCore/CMakeLists.txt

target_compile_options(Diligent-BuildSettings INTERFACE /W4 /WX /wd4100 /wd4201 /wd4505 /MP)

Maybe /WX- is more suitable than /WX.