Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implot: bump imgui for consistency with other packages #23434

Merged
merged 6 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions recipes/implot/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
cmake_minimum_required(VERSION 3.4)
cmake_minimum_required(VERSION 3.15)
project(implot LANGUAGES CXX)

file(GLOB HEADER_FILES ${IMPLOT_SRC_DIR}/*.h)

add_library(${PROJECT_NAME}
${IMPLOT_SRC_DIR}/implot.cpp
${IMPLOT_SRC_DIR}/implot_items.cpp
${IMPLOT_SRC_DIR}/implot_demo.cpp
)
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
target_include_directories(${PROJECT_NAME} PRIVATE ${IMPLOT_SRC_DIR})

find_package(imgui CONFIG REQUIRED)

target_link_libraries(${PROJECT_NAME} PUBLIC imgui::imgui)

target_compile_definitions(${PROJECT_NAME} PRIVATE IMGUI_DEFINE_MATH_OPERATORS)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)

Expand Down
21 changes: 15 additions & 6 deletions recipes/implot/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import get, copy
from conan.tools.files import get, copy, replace_in_file
from conan.tools.scm import Version
from conan.tools.microsoft import is_msvc
import os
Expand Down Expand Up @@ -31,17 +31,15 @@ def export_sources(self):

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC # rm_safe not needed
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def requirements(self):
if Version(self.version) >= "0.15":
self.requires("imgui/1.90", transitive_headers=True)
elif Version(self.version) >= "0.14":
self.requires("imgui/1.89.4", transitive_headers=True)
if Version(self.version) >= "0.14":
self.requires("imgui/1.90.4", transitive_headers=True)
elif Version(self.version) >= "0.13":
# imgui 1.89 renamed ImGuiKeyModFlags_* to ImGuiModFlags_*
self.requires("imgui/1.88", transitive_headers=True)
Expand All @@ -61,11 +59,22 @@ def source(self):
def generate(self):
tc = CMakeToolchain(self)
tc.variables["IMPLOT_SRC_DIR"] = self.source_folder.replace("\\", "/")
if Version(self.version) < "0.16":
# Set in code since v0.16 https://github.com/epezent/implot/commit/33c5a965f55f80057f197257d1d1cdb06523e963
tc.preprocessor_definitions["IMGUI_DEFINE_MATH_OPERATORS"] = ""
tc.generate()
deps = CMakeDeps(self)
deps.generate()

def _patch_sources(self):
if Version(self.version) == "0.14" and Version(self.dependencies["imgui"].ref.version) >= "1.89.7":
# https://github.com/ocornut/imgui/commit/51f564eea6333bae9242f40c983a3e29d119a9c2
replace_in_file(self, os.path.join(self.source_folder, "implot.cpp"),
"ImGuiButtonFlags_AllowItemOverlap",
"ImGuiButtonFlags_AllowOverlap")

def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
cmake.build()
Expand Down
Loading