90d013695d
- Replace window class with cbt::opengl::context - Add buffer resource (VBO, EBO, UBO, SSBO) with move semantics - Add texture resource with format/type enums and filtering - Add descriptor_set for Vulkan-style resource binding - All resources use RAII with proper cleanup
60 lines
2.3 KiB
CMake
60 lines
2.3 KiB
CMake
# ==============================================================================
|
|
# Find imgui
|
|
# ==============================================================================
|
|
# Builds Dear ImGui from the bundled sources in deps/imgui/.
|
|
#
|
|
# Targets provided:
|
|
# imgui::imgui - The Dear ImGui library target
|
|
#
|
|
# Variables set:
|
|
# imgui_FOUND - TRUE if imgui is available
|
|
# imgui_LIBRARIES - The imgui library target (imgui::imgui)
|
|
# imgui_INCLUDE_DIR - Include directories for imgui
|
|
#
|
|
# Configuration (set before find_package):
|
|
# IMGUI_BACKEND_PLATFORM - Platform backend (default: glfw)
|
|
# IMGUI_BACKEND_RENDERER - Renderer backend (default: opengl3)
|
|
# IMGUI_BUILD_DEMO - Include demo sources (default: ON)
|
|
# ==============================================================================
|
|
|
|
if (DEFINED _FINDIMGUI_INCLUDED)
|
|
return()
|
|
endif()
|
|
set(_FINDIMGUI_INCLUDED TRUE)
|
|
|
|
set(IMGUI_BACKEND_PLATFORM "glfw" CACHE STRING "Dear ImGui platform backend")
|
|
set(IMGUI_BACKEND_RENDERER "opengl3" CACHE STRING "Dear ImGui renderer backend")
|
|
option(IMGUI_BUILD_DEMO "Include Dear ImGui demo window sources" ON)
|
|
|
|
set(_imgui_source_dir "${CMAKE_CURRENT_LIST_DIR}/imgui")
|
|
|
|
if (NOT EXISTS "${_imgui_source_dir}/imgui.cpp")
|
|
message(FATAL_ERROR "imgui sources not found at '${_imgui_source_dir}'")
|
|
endif()
|
|
|
|
# On Emscripten, GLFW is provided by compiler flags (-sUSE_GLFW=3), not a CMake target.
|
|
# Create a stub interface target so imgui's CMakeLists skips find_package(glfw3).
|
|
if (IS_EMSCRIPTEN AND NOT TARGET glfw)
|
|
add_library(glfw INTERFACE)
|
|
endif()
|
|
|
|
add_subdirectory("${_imgui_source_dir}" "${CMAKE_BINARY_DIR}/_deps/imgui-build" EXCLUDE_FROM_ALL)
|
|
|
|
if (NOT TARGET imgui::imgui)
|
|
message(FATAL_ERROR "imgui: target imgui::imgui was not created")
|
|
endif()
|
|
|
|
set(imgui_FOUND TRUE)
|
|
set(imgui_LIBRARIES imgui::imgui)
|
|
get_target_property(_imgui_inc imgui INTERFACE_INCLUDE_DIRECTORIES)
|
|
set(imgui_INCLUDE_DIR "${_imgui_inc}")
|
|
|
|
# Mark imgui includes as SYSTEM to suppress warnings from its headers
|
|
if (_imgui_inc AND TARGET imgui)
|
|
set_target_properties(imgui PROPERTIES
|
|
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_imgui_inc}"
|
|
)
|
|
endif()
|
|
|
|
set(IMGUI_LICENSE_FILE "${_imgui_source_dir}/LICENSE.txt" CACHE FILEPATH "Path to Dear ImGui license file")
|