Skip to content

Commit

Permalink
imgui: convert -docking versions into a recipe option instead
Browse files Browse the repository at this point in the history
The source() method is meant for configuration-independent source downloads, so I moved it into build() instead, as recommended by the Conan docs.

I kept support for the old -docking versions, but their use should be discontinued after this change.
  • Loading branch information
valgur committed Oct 21, 2024
1 parent d7cd1ea commit e0562fd
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 69 deletions.
118 changes: 61 additions & 57 deletions recipes/imgui/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,71 @@
sources:
"1.91.4":
regular:
url: "https://github.com/ocornut/imgui/archive/v1.91.4.tar.gz"
sha256: "a455c28d987c78ddf56aab98ce0ff0fda791a23a2ec88ade46dd106b837f0923"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.91.4-docking.tar.gz"
sha256: "7405bdaf304b77d6d03e6d17d1f31ca3586fa0c65a466fa1dd71b6ca6a222023"
"1.91.3":
url: "https://github.com/ocornut/imgui/archive/v1.91.3.tar.gz"
sha256: "29949d7b300c30565fbcd66398100235b63aa373acfee0b76853a7aeacd1be28"
"1.91.3-docking":
url: "https://github.com/ocornut/imgui/archive/v1.91.3-docking.tar.gz"
sha256: "d462ccd0ca10cb412f8946c09ebd4cd0f62ca5def544dec5b3ce293c59f089fb"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.91.3.tar.gz"
sha256: "29949d7b300c30565fbcd66398100235b63aa373acfee0b76853a7aeacd1be28"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.91.3-docking.tar.gz"
sha256: "d462ccd0ca10cb412f8946c09ebd4cd0f62ca5def544dec5b3ce293c59f089fb"
"1.91.2":
url: "https://github.com/ocornut/imgui/archive/v1.91.2.tar.gz"
sha256: "a3c4fd857a0a48f6edad3e25de68fa1e96d2437f1665039714d1de9ad579b8d0"
"1.91.2-docking":
url: "https://github.com/ocornut/imgui/archive/v1.91.2-docking.tar.gz"
sha256: "bd6e9e6dc0451060152cea2a610256969c77a360659f4bd3836d6d4c9267229b"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.91.2.tar.gz"
sha256: "a3c4fd857a0a48f6edad3e25de68fa1e96d2437f1665039714d1de9ad579b8d0"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.91.2-docking.tar.gz"
sha256: "bd6e9e6dc0451060152cea2a610256969c77a360659f4bd3836d6d4c9267229b"
"1.91.0":
url: "https://github.com/ocornut/imgui/archive/v1.91.0.tar.gz"
sha256: "6e62c87252e6b3725ba478a1c04dc604aa0aaeec78fedcf4011f1e52548f4cc9"
"1.91.0-docking":
url: "https://github.com/ocornut/imgui/archive/v1.91.0-docking.tar.gz"
sha256: "b08a569eedcf2bf25e763e034754fdbe37dfcb035072310781c92fa6e6504bf7"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.91.0.tar.gz"
sha256: "6e62c87252e6b3725ba478a1c04dc604aa0aaeec78fedcf4011f1e52548f4cc9"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.91.0-docking.tar.gz"
sha256: "b08a569eedcf2bf25e763e034754fdbe37dfcb035072310781c92fa6e6504bf7"
"1.90.9":
url: "https://github.com/ocornut/imgui/archive/v1.90.9.tar.gz"
sha256: "04943919721e874ac75a2f45e6eb6c0224395034667bf508923388afda5a50bf"
"1.90.9-docking":
url: "https://github.com/ocornut/imgui/archive/v1.90.9-docking.tar.gz"
sha256: "48e7e4e4f154ad98d0946126a84e2375f849f6a67792129a805817dd60a34330"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.90.9.tar.gz"
sha256: "04943919721e874ac75a2f45e6eb6c0224395034667bf508923388afda5a50bf"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.90.9-docking.tar.gz"
sha256: "48e7e4e4f154ad98d0946126a84e2375f849f6a67792129a805817dd60a34330"
"1.90.8":
url: "https://github.com/ocornut/imgui/archive/v1.90.8.tar.gz"
sha256: "f606b4fb406aa0f8dad36d4a9dd3d6f0fd39f5f0693e7468abc02d545fb505ae"
"1.90.8-docking":
url: "https://github.com/ocornut/imgui/archive/v1.90.8-docking.tar.gz"
sha256: "51845ed8b8e81490288c3c8165173d47e9bcf92f7d999aea800635f95587b9e7"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.90.8.tar.gz"
sha256: "f606b4fb406aa0f8dad36d4a9dd3d6f0fd39f5f0693e7468abc02d545fb505ae"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.90.8-docking.tar.gz"
sha256: "51845ed8b8e81490288c3c8165173d47e9bcf92f7d999aea800635f95587b9e7"
"1.90.7":
url: "https://github.com/ocornut/imgui/archive/v1.90.7.tar.gz"
sha256: "872574217643d4ad7e9e6df420bb8d9e0d468fb90641c2bf50fd61745e05de99"
"1.90.7-docking":
url: "https://github.com/ocornut/imgui/archive/v1.90.7-docking.tar.gz"
sha256: "582a9061a508b82b0ff6504aa17af6bb449bca9edf0a0f0f33bf729252cd3194"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.90.7.tar.gz"
sha256: "872574217643d4ad7e9e6df420bb8d9e0d468fb90641c2bf50fd61745e05de99"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.90.7-docking.tar.gz"
sha256: "582a9061a508b82b0ff6504aa17af6bb449bca9edf0a0f0f33bf729252cd3194"
"1.90.6":
url: "https://github.com/ocornut/imgui/archive/v1.90.6.tar.gz"
sha256: "70b4b05ac0938e82b4d5b8d59480d3e2ca63ca570dfb88c55023831f387237ad"
"1.90.6-docking":
url: "https://github.com/ocornut/imgui/archive/v1.90.6-docking.tar.gz"
sha256: "fc7f81d009ef718917aee0ac3ea1c74c8a5cfc8016049ad153b4d91d302b8aef"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.90.6.tar.gz"
sha256: "70b4b05ac0938e82b4d5b8d59480d3e2ca63ca570dfb88c55023831f387237ad"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.90.6-docking.tar.gz"
sha256: "fc7f81d009ef718917aee0ac3ea1c74c8a5cfc8016049ad153b4d91d302b8aef"
"1.90.5":
url: "https://github.com/ocornut/imgui/archive/v1.90.5.tar.gz"
sha256: "e94b48dba7311c85ba8e3e6fe7c734d76a0eed21b2b42c5180fd5706d1562241"
"1.90.5-docking":
url: "https://github.com/ocornut/imgui/archive/v1.90.5-docking.tar.gz"
sha256: "8a5e1e594d6c8552e46e4c1ba8dd9deb51262067f04937904babc04384533ccc"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.90.5.tar.gz"
sha256: "e94b48dba7311c85ba8e3e6fe7c734d76a0eed21b2b42c5180fd5706d1562241"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.90.5-docking.tar.gz"
sha256: "8a5e1e594d6c8552e46e4c1ba8dd9deb51262067f04937904babc04384533ccc"
"1.89.9":
url: "https://github.com/ocornut/imgui/archive/v1.89.9.tar.gz"
sha256: "1acc27a778b71d859878121a3f7b287cd81c29d720893d2b2bf74455bf9d52d6"
"1.89.9-docking":
url: "https://github.com/ocornut/imgui/archive/v1.89.9-docking.tar.gz"
sha256: "2481489ce9091239b3cab8a330d0409ffdd9ee607ad1f3fe3a0b0b751c27a8eb"
"1.88":
url: "https://github.com/ocornut/imgui/archive/v1.88.tar.gz"
sha256: "9f14c788aee15b777051e48f868c5d4d959bd679fc5050e3d2a29de80d8fd32e"
"1.87":
url: "https://github.com/ocornut/imgui/archive/v1.87.tar.gz"
sha256: "b54ceb35bda38766e36b87c25edf7a1cd8fd2cb8c485b245aedca6fb85645a20"
"1.86":
url: "https://github.com/ocornut/imgui/archive/v1.86.tar.gz"
sha256: "6ba6ae8425a19bc52c5e067702c48b70e4403cd339cba02073a462730a63e825"
"1.85":
url: "https://github.com/ocornut/imgui/archive/v1.85.tar.gz"
sha256: "7ed49d1f4573004fa725a70642aaddd3e06bb57fcfe1c1a49ac6574a3e895a77"
regular:
url: "https://github.com/ocornut/imgui/archive/v1.89.9.tar.gz"
sha256: "1acc27a778b71d859878121a3f7b287cd81c29d720893d2b2bf74455bf9d52d6"
docking:
url: "https://github.com/ocornut/imgui/archive/v1.89.9-docking.tar.gz"
sha256: "2481489ce9091239b3cab8a330d0409ffdd9ee607ad1f3fe3a0b0b751c27a8eb"
20 changes: 17 additions & 3 deletions recipes/imgui/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ImguiConan(ConanFile):
options = {
"shared": [True, False],
"fPIC": [True, False],
"docking": [True, False],
# Backends
# See https://github.com/ocornut/imgui/blob/master/docs/BACKENDS.md
"build_backends": [True, False],
Expand Down Expand Up @@ -62,6 +63,7 @@ class ImguiConan(ConanFile):
default_options = {
"shared": False,
"fPIC": True,
"docking": False,
# Backends
"build_backends": True,
"backend_android": True,
Expand Down Expand Up @@ -97,6 +99,9 @@ def export_sources(self):
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if self.version.endswith("-docking"):
# Support the old -docking versions for backwards compatibility
self.options.docking = True
if self.settings.os != "Android":
del self.options.backend_android
if self.settings.os != "Windows":
Expand Down Expand Up @@ -152,7 +157,7 @@ def layout(self):

def requirements(self):
# if self.options.get_safe("backend_allegro5"):
# self.requi`res("allegro5/0")
# self.requires("allegro5/0")
if self.options.get_safe("backend_opengl2") or self.options.get_safe("backend_opengl3"):
self.requires("opengl/system")
if self.options.get_safe("backend_glut") and self.settings.os != "Emscripten":
Expand All @@ -178,9 +183,12 @@ def requirements(self):
def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, 11)
if self.version.endswith("-docking"):
self.output.warning("The -docking versions of imgui are deprecated. Use -o imgui/*:docking=True instead.")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
# Handled in build() instead to support self.options.docking.
pass

def generate(self):
tc = CMakeToolchain(self)
Expand Down Expand Up @@ -213,6 +221,11 @@ def generate(self):
deps = CMakeDeps(self)
deps.generate()

def _source(self):
version = self.version.replace("-docking", "")
kind = "docking" if self.options.docking else "regular"
get(self, **self.conan_data["sources"][version][kind], destination=self.source_folder, strip_root=True)

def _configure_header(self):
defines = {}
defines["IMGUI_ENABLE_FREETYPE"] = self.options.enable_freetype
Expand Down Expand Up @@ -248,6 +261,7 @@ def _patch_sources(self):
'#include "imconfig.h"\n\n#include "imgui_export.h"')

def build(self):
self._source()
self._configure_header()
self._patch_sources()
cmake = CMake(self)
Expand Down Expand Up @@ -323,7 +337,7 @@ def _metal_cpp():
_add_binding("win32", system_libs=["dwmapi", "xinput"])
# _add_binding("wgpu", requires=["dawn::dawn"])

self.conf_info.define("user.imgui:with_docking", "-docking" in self.version)
self.conf_info.define("user.imgui:with_docking", bool(self.options.docking))

if self.options.build_programs:
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
11 changes: 2 additions & 9 deletions recipes/imgui/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.91.4":
folder: all
"1.91.3":
folder: all
"1.91.3-docking":
Expand Down Expand Up @@ -35,12 +37,3 @@ versions:
folder: all
"1.89.9-docking":
folder: all
"1.88":
folder: all
"1.87":
folder: all
"1.86":
folder: all
"1.85":
folder: all

0 comments on commit e0562fd

Please sign in to comment.