Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
(conan-io#23435) imguizmo: add compatibility with latest imgui versions
Browse files Browse the repository at this point in the history
* imguizmo: add compatibility with latest imgui

* Update recipes/imguizmo/all/conanfile.py

---------

Co-authored-by: Francisco Ramírez <[email protected]>
  • Loading branch information
2 people authored and ericLemanissier committed Apr 16, 2024
1 parent 0c82cd4 commit c818f54
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions recipes/imguizmo/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from conan import ConanFile
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get
from conan.tools.files import copy, get, replace_in_file
from conan.tools.scm import Version

required_conan_version = ">=1.53.0"

Expand Down Expand Up @@ -42,20 +43,26 @@ def layout(self):

def requirements(self):
# 1.89 is the newest imgui version compatible with imguizmo
self.requires("imgui/1.89.3", transitive_headers=True)
self.requires("imgui/1.90.4", transitive_headers=True)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
tc.preprocessor_definitions["IMGUI_DEFINE_MATH_OPERATORS"] = ""
tc.generate()
tc = CMakeDeps(self)
tc.generate()

def build(self):
if Version(self.dependencies["imgui"].ref.version) >= "1.89.4":
# Related to a breaking change: https://github.com/ocornut/imgui/blob/master/docs/CHANGELOG.txt#L912
# Redirection: ImDrawList::AddBezierCurve() -> use ImDrawList::AddBezierCubic()
replace_in_file(self, os.path.join(self.source_folder, "GraphEditor.cpp"),
"AddBezierCurve", "AddBezierCubic")
cmake = CMake(self)
cmake.configure(build_script_folder=self.export_sources_folder)
cmake.configure(build_script_folder=self.source_path.parent)
cmake.build()

def package(self):
Expand Down

0 comments on commit c818f54

Please sign in to comment.