mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-30 18:34:34 +01:00
Refactors & Abstractions
This commit is contained in:
parent
e0e32bdadd
commit
a6c1620a17
@ -2,70 +2,59 @@ if(IMGUI_IMPL_OPENGL2 OR IMGUI_IMPL_OPENGL3)
|
|||||||
find_package(OpenGL)
|
find_package(OpenGL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(IMGUI_IMPL_WIN32)
|
macro(add_backend backend)
|
||||||
add_library_ns(imgui win32 STATIC imgui_impl_win32.cpp)
|
# Construct source and header file names from the backend name
|
||||||
target_include_dir_iface(imgui-win32 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR})
|
set(SOURCE_FILE "imgui_impl_${backend}.cpp")
|
||||||
install_target_and_headers(imgui win32
|
set(HEADER_FILE "imgui_impl_${backend}.h")
|
||||||
imgui_impl_win32.h
|
|
||||||
|
# Add a library for the backend
|
||||||
|
add_library_ns(imgui ${backend} STATIC ${SOURCE_FILE})
|
||||||
|
|
||||||
|
# Set up include directories
|
||||||
|
target_include_dir_iface(imgui-${backend} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR})
|
||||||
|
|
||||||
|
# Install the target and the corresponding header file
|
||||||
|
install_target_and_headers(imgui ${backend}
|
||||||
|
${HEADER_FILE}
|
||||||
)
|
)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if(IMGUI_IMPL_WIN32)
|
||||||
|
add_backend(win32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(OpenGL_FOUND)
|
if(OpenGL_FOUND)
|
||||||
|
|
||||||
if(IMGUI_IMPL_OPENGL2)
|
if(IMGUI_IMPL_OPENGL2)
|
||||||
add_library_ns(imgui opengl2 STATIC imgui_impl_opengl2.cpp)
|
add_backend(opengl2)
|
||||||
target_include_dir_iface(imgui-opengl2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR})
|
|
||||||
target_link_libraries(imgui-opengl2 OpenGL::GL)
|
target_link_libraries(imgui-opengl2 OpenGL::GL)
|
||||||
install_target_and_headers(imgui opengl2
|
|
||||||
imgui_impl_opengl2.h
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(IMGUI_IMPL_OPENGL3)
|
if(IMGUI_IMPL_OPENGL3)
|
||||||
add_library_ns(imgui opengl3 STATIC imgui_impl_opengl3.cpp)
|
add_backend(opengl3)
|
||||||
target_include_dir_iface(imgui-opengl3 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR})
|
|
||||||
target_link_libraries(imgui-opengl3 OpenGL::GL)
|
target_link_libraries(imgui-opengl3 OpenGL::GL)
|
||||||
install_target_and_headers(imgui opengl3
|
|
||||||
imgui_impl_opengl3.h
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(IMGUI_IMPL_DX9)
|
if(IMGUI_IMPL_DX9)
|
||||||
add_library_ns(imgui dx9 STATIC imgui_impl_dx9.cpp)
|
add_backend(dx9)
|
||||||
target_include_dir_iface(imgui-dx9 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR})
|
|
||||||
target_link_libraries(imgui-dx9 d3d9.lib)
|
target_link_libraries(imgui-dx9 d3d9.lib)
|
||||||
install_target_and_headers(imgui dx9
|
|
||||||
imgui_impl_dx9.h
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(IMGUI_IMPL_DX10)
|
if(IMGUI_IMPL_DX10)
|
||||||
add_library_ns(imgui dx10 STATIC imgui_impl_dx10.cpp)
|
add_backend(dx10)
|
||||||
target_include_dir_iface(imgui-dx10 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR})
|
|
||||||
target_link_libraries(imgui-dx10 d3d10.lib)
|
target_link_libraries(imgui-dx10 d3d10.lib)
|
||||||
install_target_and_headers(imgui dx10
|
|
||||||
imgui_impl_dx10.h
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(IMGUI_IMPL_DX11)
|
if(IMGUI_IMPL_DX11)
|
||||||
add_library_ns(imgui dx11 STATIC imgui_impl_dx11.cpp)
|
add_backend(dx11)
|
||||||
target_include_dir_iface(imgui-dx11 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR})
|
|
||||||
target_link_libraries(imgui-dx11 d3d11.lib)
|
target_link_libraries(imgui-dx11 d3d11.lib)
|
||||||
install_target_and_headers(imgui dx11
|
|
||||||
imgui_impl_dx11.h
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(IMGUI_IMPL_DX12)
|
if(IMGUI_IMPL_DX12)
|
||||||
add_library_ns(imgui dx12 STATIC imgui_impl_dx12.cpp)
|
add_backend(dx12)
|
||||||
target_include_dir_iface(imgui-dx12 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} include PRIVATE ${IMGUI_INC_DIR})
|
|
||||||
target_link_libraries(imgui-dx12 d3d12.lib)
|
target_link_libraries(imgui-dx12 d3d12.lib)
|
||||||
install_target_and_headers(imgui dx12
|
|
||||||
imgui_impl_dx12.h
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user