I'm trying to build a c++ project with Imgui with the SDL2 backend, and maybe Vulkan. But it errors when trying to build: 'PFN_D3D12_SERIALIZE_ROOT_SIGNATURE' was not declared in this scope
Setup
MyProject
|-- bin
|-- subprojects
|-- meson.build
# MyProject\meson.build
project('MyProject', default_options : ['cpp_std=c++20'])
vulkan_headers_dep = dependency('vulkan-headers', fallback:['vulkan-headers', 'vulkan_headers_dep'])
sdl2_dep = dependency('sdl2', fallback:['sdl2', 'sdl2_dep'])
imgui_dep = dependency('imgui', fallback:['imgui', 'imgui_dep'])
>meson wrap install vulkan-headers
>meson wrap install sdl2
>meson wrap install imgui
>meson setup bin
I edit subprojects\imgui-1.87\meson_options.txt and disable every feature except for 'sdl_renderer', 'vulkan', and 'sdl2'. Result below
# renderer backends
option('dx9', type : 'feature', value : 'disabled')
option('dx10', type : 'feature', value : 'disabled')
option('dx11', type : 'feature', value : 'disabled')
option('dx12', type : 'feature', value : 'disabled')
option('metal', type : 'feature', value : 'disabled')
option('opengl', type : 'feature', value : 'disabled')
option('sdl_renderer', type : 'feature', value : 'enabled')
option('vulkan', type : 'feature', value : 'enabled')
option('webgpu', type : 'feature', value : 'disabled')
# platform backends
option('glfw', type : 'feature', value : 'disabled')
option('sdl2', type : 'feature', value : 'enabled')
option('osx', type : 'feature', value : 'disabled')
option('win', type : 'feature', value : 'disabled')
# frameworks (renderer + platform)
option('allegro5', type : 'feature', value : 'disabled')
I try to build
cd bin
ninja
Errors
[324/328] Compiling C++ obj...nds_imgui_impl_dx12.cpp.obj
FAILED: subprojects/imgui-1.87/libimgui.dll.p/backends_imgui_impl_dx12.cpp.obj
"c++" "-Isubprojects\imgui-1.87\libimgui.dll.p" "-Isubprojects\imgui-1.87" "-I..\subprojects\imgui-1.87" "-I..\subprojects\imgui-1.87\backends" "-Isubprojects\SDL2-2.0.20\include" "-I..\subprojects\SDL2-2.0.20\include" "-fdiagnostics-color=always" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-std=c++20" "-O0" "-g" "-Wdeclaration-after-statement" "-Wshadow" "-fno-strict-aliasing" -MD -MQ subprojects/imgui-1.87/libimgui.dll.p/backends_imgui_impl_dx12.cpp.obj -MF "subprojects\imgui-1.87\libimgui.dll.p\backends_imgui_impl_dx12.cpp.obj.d" -o subprojects/imgui-1.87/libimgui.dll.p/backends_imgui_impl_dx12.cpp.obj "-c" ../subprojects/imgui-1.87/backends/imgui_impl_dx12.cpp
cc1plus.exe: warning: command-line option '-Wdeclaration-after-statement' is valid for C/ObjC but not for C++
../subprojects/imgui-1.87/backends/imgui_impl_dx12.cpp: In function 'bool ImGui_ImplDX12_CreateDeviceObjects()':
../subprojects/imgui-1.87/backends/imgui_impl_dx12.cpp:517:9: error: 'PFN_D3D12_SERIALIZE_ROOT_SIGNATURE' was not declared in this scope; did you mean 'PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE'?
517 | PFN_D3D12_SERIALIZE_ROOT_SIGNATURE D3D12SerializeRootSignatureFn = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)::GetProcAddress(d3d12_dll, "D3D12SerializeRootSignature");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE
../subprojects/imgui-1.87/backends/imgui_impl_dx12.cpp:518:13: error: 'D3D12SerializeRootSignatureFn' was not declared in this scope; did you mean 'D3D12SerializeRootSignature'?
518 | if (D3D12SerializeRootSignatureFn == NULL) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| D3D12SerializeRootSignature
../subprojects/imgui-1.87/backends/imgui_impl_dx12.cpp:522:13: error: 'D3D12SerializeRootSignatureFn' was not declared in this scope; did you mean 'D3D12SerializeRootSignature'?
522 | if (D3D12SerializeRootSignatureFn(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, NULL) != S_OK)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| D3D12SerializeRootSignature
[325/328] Compiling C++ obj...ibimgui.dll.p/imgui.cpp.obj
cc1plus.exe: warning: command-line option '-Wdeclaration-after-statement' is valid for C/ObjC but not for C++
[326/328] Linking target su...cts/SDL2-2.0.20/libsdl2.dll
ninja: build stopped: subcommand failed.
I don't know how to fix it, and I don't understand why it's even trying to compile "C++ obj...nds_imgui_impl_dx12.cpp.obj", as I have disabled dx12 in the imgui meson_options.txt.