Skip to content

Commit

Permalink
[build] Fix Findimgui.cmake -- still not working since libimgui.so do…
Browse files Browse the repository at this point in the history
…esn't include backends defs

(cherry picked from commit d12b7aa0e1c2738fbfe817f59bb0424d4161bd02)
  • Loading branch information
jslee02 committed Jun 30, 2024
1 parent fd22b31 commit f8e4b09
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions cmake/Findimgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,33 @@ find_package(PkgConfig QUIET)
# Check to see if pkgconfig is installed.
pkg_check_modules(PC_imgui imgui QUIET)

# Include directories
find_path(imgui_INCLUDE_DIRS
# Find the path containing imgui.h
find_path(imgui_INCLUDE_DIR
NAMES imgui.h
HINTS ${PC_imgui_INCLUDEDIR}
PATHS "${CMAKE_INSTALL_PREFIX}/include"
PATHS
"${CMAKE_INSTALL_PREFIX}/include"
"${CMAKE_INSTALL_PREFIX}/include/imgui"
)

# Find the path containing imgui_impl_opengl2.h
find_path(imgui_backends_INCLUDE_DIR
NAMES imgui_impl_opengl2.h
HINTS
${PC_imgui_INCLUDEDIR}
${PC_imgui_INCLUDEDIR}/backends
PATHS
"${CMAKE_INSTALL_PREFIX}/include"
"${CMAKE_INSTALL_PREFIX}/include/imgui/backends"
)

# Combine both paths into imgui_INCLUDE_DIRS
if (imgui_INCLUDE_DIR AND imgui_backends_INCLUDE_DIR)
set(imgui_INCLUDE_DIRS ${imgui_INCLUDE_DIR} ${imgui_backends_INCLUDE_DIR})
else()
message(FATAL_ERROR "Could not find the required imgui headers")
endif()

# Library
find_library(imgui_LIBRARIES
NAMES imgui
Expand Down

0 comments on commit f8e4b09

Please sign in to comment.