Skip to content

Commit

Permalink
ogre: unvendor imgui
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Sep 19, 2024
1 parent c74dc20 commit f90f50e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
6 changes: 6 additions & 0 deletions recipes/ogre/1.x/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ endif()

add_subdirectory(src)

if(TARGET OgreOverlay AND OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)
find_package(imgui REQUIRED CONFIG)
target_sources(OgreOverlay PRIVATE ${CONAN_IMGUI_SRC}/misc/freetype/imgui_freetype.cpp)
target_include_directories(OgreOverlay PRIVATE ${CONAN_IMGUI_SRC}/misc/freetype)
target_link_libraries(OgreOverlay PUBLIC imgui::imgui)
endif()
if(TARGET Codec_FreeImage)
target_link_libraries(Codec_FreeImage PUBLIC freeimage::freeimage)
endif()
Expand Down
19 changes: 13 additions & 6 deletions recipes/ogre/1.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,9 @@ def requirements(self):
self.requires("bullet3/3.25")
if self.options.build_component_overlay:
self.requires("freetype/2.13.2")
# TODO: unvendor imgui
# if self.options.build_component_overlay_imgui:
# # Used in Overlay/OgreImGuiOverlay.h public heder
# self.requires("imgui/1.91.0", transitive_headers=True, transitive_libs=True)
if self.options.build_component_overlay_imgui:
# Used in Overlay/OgreImGuiOverlay.h public heder
self.requires("imgui/1.91.0", transitive_headers=True, transitive_libs=True)
if self.options.build_plugin_assimp:
self.requires("assimp/5.4.2")
if self.options.build_plugin_exrcodec:
Expand Down Expand Up @@ -407,6 +406,8 @@ def generate(self):
tc.variables["OGRE_PLUGINS_PATH"] = self._to_cmake_path(self._plugins_dir)
tc.variables["OGRE_MEDIA_PATH"] = self._to_cmake_path(self._media_dir)
tc.variables["OGRE_CFG_INSTALL_PATH"] = self._to_cmake_path(self._config_dir)
if self.options.get_safe("build_component_overlay_imgui"):
tc.variables["CONAN_IMGUI_SRC"] = os.path.join(self.dependencies["imgui"].package_folder, "res")
tc.generate()

deps = CMakeDeps(self)
Expand All @@ -433,6 +434,12 @@ def _patch_sources(self):
rmdir(self, os.path.join(self.source_folder, "PlugIns", "STBICodec", "src", "stbi"))
replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "STBICodec", "src", "OgreSTBICodec.cpp"),
'#include "stbi/', '#include "')
# Unvendor imgui in Overlay
# https://github.com/OGRECave/ogre/blob/v14.2.6/Components/Overlay/CMakeLists.txt#L21-L43
replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"),
"if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)", "if(0)")
replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"),
"list(REMOVE_ITEM SOURCE_FILES", "# list(REMOVE_ITEM SOURCE_FILES")

def build(self):
self._patch_sources()
Expand Down Expand Up @@ -583,8 +590,8 @@ def _add_plugin_component(comp, *, requires=None):
_add_core_component("MeshLodGenerator")
if self.options.build_component_overlay:
_add_core_component("Overlay", requires=["freetype::freetype"])
# if self.options.get_safe("build_component_overlay_imgui"):
# self.cpp_info.components["Overlay"].requires.append("imgui::imgui")
if self.options.get_safe("build_component_overlay_imgui"):
self.cpp_info.components["Overlay"].requires.append("imgui::imgui")
if self.options.build_component_paging:
_add_core_component("Paging")
if self.options.build_component_property:
Expand Down

0 comments on commit f90f50e

Please sign in to comment.