From e0e32bdadde76192e72f2c44d53aafd78cded942 Mon Sep 17 00:00:00 2001 From: Pinwhell <60289470+pinwhell@users.noreply.github.com> Date: Thu, 19 Sep 2024 03:42:25 -0400 Subject: [PATCH] Backend Targets Impl --- CMakeLists.txt | 4 ++++ backends/CMakeLists.txt | 38 +++++++++++++++++++++++++++++++++++++ cmake/imgui-config.cmake.in | 16 ++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dd8457e4..a26d03cbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,10 @@ project(imgui) option(IMGUI_IMPL_WIN32 "Enable ImGui Win32 implementation" ON) option(IMGUI_IMPL_OPENGL2 "Enable ImGui OpenGL2 implementation" OFF) option(IMGUI_IMPL_OPENGL3 "Enable ImGui OpenGL3 implementation" OFF) +option(IMGUI_IMPL_DX9 "Enable ImGui DirectX9 implementation" OFF) +option(IMGUI_IMPL_DX10 "Enable ImGui DirectX10 implementation" OFF) +option(IMGUI_IMPL_DX11 "Enable ImGui DirectX11 implementation" OFF) +option(IMGUI_IMPL_DX12 "Enable ImGui DirectX12 implementation" OFF) option(IMGUI_ENABLE_PLAYGROUND "Enable playground subdirectory" OFF) set(IMGUI_INC_DIR diff --git a/backends/CMakeLists.txt b/backends/CMakeLists.txt index 960998ea2..ddcf3ecfa 100644 --- a/backends/CMakeLists.txt +++ b/backends/CMakeLists.txt @@ -31,3 +31,41 @@ install_target_and_headers(imgui opengl3 endif() endif() + +if(IMGUI_IMPL_DX9) +add_library_ns(imgui dx9 STATIC imgui_impl_dx9.cpp) +target_include_dir_iface(imgui-dx9 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR}) +target_link_libraries(imgui-dx9 d3d9.lib) +install_target_and_headers(imgui dx9 + imgui_impl_dx9.h + ) +endif() + +if(IMGUI_IMPL_DX10) +add_library_ns(imgui dx10 STATIC imgui_impl_dx10.cpp) +target_include_dir_iface(imgui-dx10 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR}) +target_link_libraries(imgui-dx10 d3d10.lib) +install_target_and_headers(imgui dx10 + imgui_impl_dx10.h + ) +endif() + +if(IMGUI_IMPL_DX11) +add_library_ns(imgui dx11 STATIC imgui_impl_dx11.cpp) +target_include_dir_iface(imgui-dx11 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR}) +target_link_libraries(imgui-dx11 d3d11.lib) +install_target_and_headers(imgui dx11 + imgui_impl_dx11.h + ) +endif() + +if(IMGUI_IMPL_DX12) +add_library_ns(imgui dx12 STATIC imgui_impl_dx12.cpp) +target_include_dir_iface(imgui-dx12 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR}) +target_link_libraries(imgui-dx12 d3d12.lib) +install_target_and_headers(imgui dx12 + imgui_impl_dx12.h + ) +endif() + + diff --git a/cmake/imgui-config.cmake.in b/cmake/imgui-config.cmake.in index f23d956e6..f49506c6d 100644 --- a/cmake/imgui-config.cmake.in +++ b/cmake/imgui-config.cmake.in @@ -28,3 +28,19 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/imgui-opengl3-targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/imgui-opengl3-targets.cmake") endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/imgui-dx9-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/imgui-dx9-targets.cmake") +endif() + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/imgui-dx10-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/imgui-dx10-targets.cmake") +endif() + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/imgui-dx11-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/imgui-dx11-targets.cmake") +endif() + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/imgui-dx12-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/imgui-dx12-targets.cmake") +endif() +