feat(imgui): embeddable plot widget and demo
This commit is contained in:
1 parent
fb2c2f5e4d
commit
15931a2405
9 files changed
+1072
-38
No files matched your search
@@ -1,44 +1,10 @@
|
||||
# The GLFW adapter: the reference host for the library. It owns the window, the
|
||||
# context and the loop, and translates GLFW's events into plot::input events.
|
||||
#
|
||||
# Dependency discovery follows the design spec's order: find_package first,
|
||||
# pkg-config next, FetchContent only when neither can supply GLFW (the last
|
||||
# resort, because it needs the network).
|
||||
set(plot_glfw_dep "")
|
||||
|
||||
find_package(glfw3 3.3 QUIET)
|
||||
if(TARGET glfw)
|
||||
set(plot_glfw_dep glfw)
|
||||
elseif(TARGET glfw3::glfw3)
|
||||
set(plot_glfw_dep glfw3::glfw3)
|
||||
endif()
|
||||
|
||||
if(NOT plot_glfw_dep)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(GLFW_PC QUIET IMPORTED_TARGET glfw3)
|
||||
if(TARGET PkgConfig::GLFW_PC)
|
||||
set(plot_glfw_dep PkgConfig::GLFW_PC)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT plot_glfw_dep)
|
||||
message(STATUS "plot: glfw3 not found via find_package or pkg-config; fetching it")
|
||||
include(FetchContent)
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_Declare(glfw
|
||||
GIT_REPOSITORY https://github.com/glfw/glfw.git
|
||||
GIT_TAG 3.4
|
||||
GIT_SHALLOW TRUE)
|
||||
FetchContent_MakeAvailable(glfw)
|
||||
set(plot_glfw_dep glfw)
|
||||
endif()
|
||||
|
||||
message(STATUS "plot: GLFW adapter dependency: ${plot_glfw_dep}")
|
||||
# GLFW is resolved by the shared plot_find_glfw() (cmake/plot_options.cmake), so a
|
||||
# build that also enables the Dear ImGui adapter -- which needs GLFW for
|
||||
# imgui_impl_glfw -- discovers (and at worst fetches) a single copy.
|
||||
plot_find_glfw(plot_glfw_dep)
|
||||
|
||||
add_library(plot_glfw STATIC glfw_host.cpp)
|
||||
add_library(plot::glfw ALIAS plot_glfw)
|
||||
|
||||
Reference in new issue
Block a user