diff --git a/recipes/imgui/all/CMakeLists.txt b/recipes/imgui/all/CMakeLists.txt index c4f4c9ace4c4f..16c2740fbe0ca 100644 --- a/recipes/imgui/all/CMakeLists.txt +++ b/recipes/imgui/all/CMakeLists.txt @@ -117,6 +117,10 @@ if(IMGUI_IMPL_METAL) "-framework QuartzCore" ) install(FILES backends/imgui_impl_metal.h DESTINATION include) + if(IMGUI_IMPL_METAL_CPP) + find_package(metal-cpp CONFIG REQUIRED) + target_link_libraries(imgui-metal PRIVATE metal-cpp::metal-cpp) + endif() list(APPEND IMGUI_COMPONENTS imgui-metal) endif() @@ -148,6 +152,10 @@ if(IMGUI_IMPL_OSX) "-framework GameController" ) install(FILES backends/imgui_impl_osx.h DESTINATION include) + if(IMGUI_IMPL_METAL_CPP_EXTENSIONS) + find_package(metal-cpp CONFIG REQUIRED) + target_link_libraries(imgui-osx PRIVATE metal-cpp::metal-cpp) + endif() list(APPEND IMGUI_COMPONENTS imgui-osx) endif() diff --git a/recipes/imgui/all/conanfile.py b/recipes/imgui/all/conanfile.py index 81005301a2a4e..f690e168482f0 100644 --- a/recipes/imgui/all/conanfile.py +++ b/recipes/imgui/all/conanfile.py @@ -142,6 +142,10 @@ def configure(self): self.options.rm_safe("backend_wgpu") if not self.options.enable_freetype: self.options.rm_safe("enable_freetype_lunasvg") + if not self.options.get_safe("backend_osx"): + self.options.rm_safe("enable_osx_clipboard") + if not self.options.get_safe("backend_osx") and not self.options.get_safe("backend_metal"): + self.options.rm_safe("enable_metal_cpp") def layout(self): cmake_layout(self, src_folder="src") @@ -168,6 +172,8 @@ def requirements(self): self.requires("freetype/2.13.2") if self.options.get_safe("enable_freetype_lunasvg"): self.requires("lunasvg/2.4.1") + if self.options.get_safe("enable_metal_cpp"): + self.requires("metal-cpp/14.2", transitive_headers=bool(self.options.get_safe("backend_metal"))) def validate(self): if self.settings.compiler.cppstd: @@ -200,6 +206,8 @@ def generate(self): tc.cache_variables["IMGUI_FREETYPE"] = self.options.enable_freetype tc.cache_variables["IMGUI_FREETYPE_LUNASVG"] = self.options.get_safe("enable_freetype_lunasvg", False) tc.cache_variables["IMGUI_BUILD_PROGRAMS"] = self.options.build_programs + tc.cache_variables["IMGUI_IMPL_METAL_CPP"] = self.options.get_safe("enable_metal_cpp", False) + tc.cache_variables["IMGUI_IMPL_METAL_CPP_EXTENSIONS"] = self.options.get_safe("enable_metal_cpp", False) tc.generate() deps = CMakeDeps(self) @@ -285,6 +293,9 @@ def _add_binding(name, requires=None, system_libs=None, frameworks=None): self.cpp_info.components[name].system_libs = system_libs or [] self.cpp_info.components[name].frameworks = frameworks or [] + def _metal_cpp(): + return ["metal-cpp::metal-cpp"] if self.options.get_safe("enable_metal_cpp") else [] + # _add_binding("allegro5", requires=[ # "allegro::allegro", # "allegro::allegro_ttf", @@ -298,10 +309,10 @@ def _add_binding(name, requires=None, system_libs=None, frameworks=None): _add_binding("dx12", system_libs=["d3d12"]) _add_binding("glfw", requires=["glfw::glfw"] if self.settings.os != "Emscripten" else []) _add_binding("glut", requires=["freeglut::freeglut"] if self.settings.os != "Emscripten" else []) - _add_binding("metal", frameworks=["Foundation", "Metal", "QuartzCore"]) + _add_binding("metal", frameworks=["Foundation", "Metal", "QuartzCore"], requires=_metal_cpp()) _add_binding("opengl2", requires=["opengl::opengl"]) _add_binding("opengl3", requires=["opengl::opengl"]) - _add_binding("osx", frameworks=["AppKit", "Carbon", "Cocoa", "Foundation", "GameController"]) + _add_binding("osx", frameworks=["AppKit", "Carbon", "Cocoa", "Foundation", "GameController"], requires=_metal_cpp()) _add_binding("sdl2", requires=["sdl::sdl"]) _add_binding("sdlrenderer2", requires=["sdl::sdl"]) # _add_binding("sdlrenderer3", requires=["sdl::sdl"])