File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ def requirements(self):
106106 if self .options .use_imgui :
107107 self .requires ("imgui/1.90.5" )
108108 self .requires ("implot/0.16" )
109+ self .requires ("glfw/3.4" )
109110
110111 # 4. call for conan install
111112 def build_requirements (self ):
Original file line number Diff line number Diff line change @@ -54,7 +54,12 @@ IF(CPP_STARTER_USE_SLINT)
5454 ADD_SUBDIRECTORY (slint )
5555ENDIF ()
5656
57- FIND_PACKAGE (docopt REQUIRED )
57+ # imgui example
58+ IF (CPP_STARTER_USE_IMGUI)
59+ MESSAGE ("Using imgui" )
60+ ADD_SUBDIRECTORY (imgui )
61+ ENDIF ()
62+
5863FIND_PACKAGE (spdlog REQUIRED )
5964FIND_PACKAGE (fmt REQUIRED )
6065# Generic test that uses conan libs
Original file line number Diff line number Diff line change 1+ FIND_PACKAGE (ImGui REQUIRED )
2+ FIND_PACKAGE (ImPlot REQUIRED )
3+ FIND_PACKAGE (glfw3 REQUIRED )
4+ FIND_PACKAGE (OpenGL REQUIRED )
5+
6+ # Retrieve the imgui package include directory.
7+ # Conan's CMakeDeps sets INTERFACE_INCLUDE_DIRECTORIES to a real path at configure time,
8+ # so GET_TARGET_PROPERTY works here without config-specific suffixes like _DEBUG/_RELEASE.
9+ GET_TARGET_PROPERTY (_imgui_incdirs imgui::imgui INTERFACE_INCLUDE_DIRECTORIES )
10+ LIST (GET _imgui_incdirs 0 IMGUI_INCLUDE_DIR)
11+
12+ # Backend sources were copied from res/bindings -> include/backends by conanfile.py generate()
13+ ADD_EXECUTABLE (test_imgui
14+ main.cpp
15+ ${IMGUI_INCLUDE_DIR} /backends/imgui_impl_glfw.cpp
16+ ${IMGUI_INCLUDE_DIR} /backends/imgui_impl_opengl3.cpp
17+ )
18+
19+ TARGET_LINK_LIBRARIES (test_imgui PRIVATE
20+ imgui::imgui
21+ implot::implot
22+ glfw
23+ OpenGL::GL
24+ )
25+
26+ # On Windows and Linux, copy runtime DLLs/SOs next to the binary
27+ IF (WIN32 )
28+ ADD_CUSTOM_COMMAND (TARGET test_imgui POST_BUILD
29+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
30+ $<TARGET_RUNTIME_DLLS :test_imgui >
31+ $<TARGET_FILE_DIR :test_imgui >
32+ COMMAND_EXPAND_LISTS
33+ )
34+ ENDIF ()
You can’t perform that action at this time.
0 commit comments