Skip to content

Commit b6a7593

Browse files
imgui: fixed problem with testengine option (#27776)
* Refactored conandata. Simplified conanfile.py * Fixed * Fixed
1 parent addfe19 commit b6a7593

File tree

2 files changed

+78
-68
lines changed

2 files changed

+78
-68
lines changed

recipes/imgui/all/conandata.yml

Lines changed: 67 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,83 @@
1-
# this package's recipe relies on version suffixes to handle imgui's docking branch and testengine integration.
1+
# this package's recipe relies on version suffixes to handle imgui's docking branch.
22
# Suffix: -docking for docking branch sources
3-
# Suffix: -testengine for testengine integration sources
43
sources:
54
"1.91.8":
6-
url: "https://github.com/ocornut/imgui/archive/v1.91.8.tar.gz"
7-
sha256: "db3a2e02bfd6c269adf0968950573053d002f40bdfb9ef2e4a90bce804b0f286"
5+
core:
6+
url: "https://github.com/ocornut/imgui/archive/v1.91.8.tar.gz"
7+
sha256: "db3a2e02bfd6c269adf0968950573053d002f40bdfb9ef2e4a90bce804b0f286"
8+
testengine:
9+
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.91.8.tar.gz"
10+
sha256: "bdfc31cb819bd6e4df2d5da0316edf92b1011d1c4046293aafd9ae14106570e2"
811
"1.91.8-docking":
9-
url: "https://github.com/ocornut/imgui/archive/v1.91.8-docking.tar.gz"
10-
sha256: "55f5e65abea635f2a8bfa9a92cd966448a363a262cf6dead7cc662fb0ab37612"
11-
"1.91.8-testengine":
12-
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.91.8.tar.gz"
13-
sha256: "bdfc31cb819bd6e4df2d5da0316edf92b1011d1c4046293aafd9ae14106570e2"
12+
core:
13+
url: "https://github.com/ocornut/imgui/archive/v1.91.8-docking.tar.gz"
14+
sha256: "55f5e65abea635f2a8bfa9a92cd966448a363a262cf6dead7cc662fb0ab37612"
15+
testengine:
16+
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.91.8.tar.gz"
17+
sha256: "bdfc31cb819bd6e4df2d5da0316edf92b1011d1c4046293aafd9ae14106570e2"
1418
"1.91.5":
15-
url: "https://github.com/ocornut/imgui/archive/v1.91.5.tar.gz"
16-
sha256: "2aa2d169c569368439e5d5667e0796d09ca5cc6432965ce082e516937d7db254"
19+
core:
20+
url: "https://github.com/ocornut/imgui/archive/v1.91.5.tar.gz"
21+
sha256: "2aa2d169c569368439e5d5667e0796d09ca5cc6432965ce082e516937d7db254"
22+
testengine:
23+
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.91.5.tar.gz"
24+
sha256: "df8cd40d6d0ec4a3a8ea75563b95a619135f3111ae046333eb3e63f8ab028e14"
1725
"1.91.5-docking":
18-
url: "https://github.com/ocornut/imgui/archive/v1.91.5-docking.tar.gz"
19-
sha256: "f66c5d1b28fed044bd8dffa3882b4d1b29b2dbd1167fabe3d9d2219081e81cd8"
20-
"1.91.5-testengine":
21-
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.91.5.tar.gz"
22-
sha256: "df8cd40d6d0ec4a3a8ea75563b95a619135f3111ae046333eb3e63f8ab028e14"
26+
core:
27+
url: "https://github.com/ocornut/imgui/archive/v1.91.5-docking.tar.gz"
28+
sha256: "f66c5d1b28fed044bd8dffa3882b4d1b29b2dbd1167fabe3d9d2219081e81cd8"
29+
testengine:
30+
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.91.5.tar.gz"
31+
sha256: "df8cd40d6d0ec4a3a8ea75563b95a619135f3111ae046333eb3e63f8ab028e14"
2332
"1.90.9":
24-
url: "https://github.com/ocornut/imgui/archive/v1.90.9.tar.gz"
25-
sha256: "04943919721e874ac75a2f45e6eb6c0224395034667bf508923388afda5a50bf"
33+
core:
34+
url: "https://github.com/ocornut/imgui/archive/v1.90.9.tar.gz"
35+
sha256: "04943919721e874ac75a2f45e6eb6c0224395034667bf508923388afda5a50bf"
2636
"1.90.9-docking":
27-
url: "https://github.com/ocornut/imgui/archive/v1.90.9-docking.tar.gz"
28-
sha256: "48e7e4e4f154ad98d0946126a84e2375f849f6a67792129a805817dd60a34330"
37+
core:
38+
url: "https://github.com/ocornut/imgui/archive/v1.90.9-docking.tar.gz"
39+
sha256: "48e7e4e4f154ad98d0946126a84e2375f849f6a67792129a805817dd60a34330"
2940
"1.90.5":
30-
url: "https://github.com/ocornut/imgui/archive/v1.90.5.tar.gz"
31-
sha256: "e94b48dba7311c85ba8e3e6fe7c734d76a0eed21b2b42c5180fd5706d1562241"
41+
core:
42+
url: "https://github.com/ocornut/imgui/archive/v1.90.5.tar.gz"
43+
sha256: "e94b48dba7311c85ba8e3e6fe7c734d76a0eed21b2b42c5180fd5706d1562241"
44+
testengine:
45+
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.90.5.tar.gz"
46+
sha256: "79339246d8c919c5926df0a7bee99be585ebaf67cdaba89a0ac314b1f7846f92"
3247
"1.90.5-docking":
33-
url: "https://github.com/ocornut/imgui/archive/v1.90.5-docking.tar.gz"
34-
sha256: "8a5e1e594d6c8552e46e4c1ba8dd9deb51262067f04937904babc04384533ccc"
35-
"1.90.5-testengine":
36-
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.90.5.tar.gz"
37-
sha256: "79339246d8c919c5926df0a7bee99be585ebaf67cdaba89a0ac314b1f7846f92"
48+
core:
49+
url: "https://github.com/ocornut/imgui/archive/v1.90.5-docking.tar.gz"
50+
sha256: "8a5e1e594d6c8552e46e4c1ba8dd9deb51262067f04937904babc04384533ccc"
51+
testengine:
52+
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.90.5.tar.gz"
53+
sha256: "79339246d8c919c5926df0a7bee99be585ebaf67cdaba89a0ac314b1f7846f92"
3854
"1.89.9":
39-
url: "https://github.com/ocornut/imgui/archive/v1.89.9.tar.gz"
40-
sha256: "1acc27a778b71d859878121a3f7b287cd81c29d720893d2b2bf74455bf9d52d6"
55+
core:
56+
url: "https://github.com/ocornut/imgui/archive/v1.89.9.tar.gz"
57+
sha256: "1acc27a778b71d859878121a3f7b287cd81c29d720893d2b2bf74455bf9d52d6"
58+
testengine:
59+
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.89.9.tar.gz"
60+
sha256: "951f2a45d7e637983265dead44a6e78a0b0dc79d4e9cf44f3f7a48d0aa2053b5"
4161
"1.89.9-docking":
42-
url: "https://github.com/ocornut/imgui/archive/v1.89.9-docking.tar.gz"
43-
sha256: "2481489ce9091239b3cab8a330d0409ffdd9ee607ad1f3fe3a0b0b751c27a8eb"
44-
"1.89.9-testengine":
45-
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.89.9.tar.gz"
46-
sha256: "951f2a45d7e637983265dead44a6e78a0b0dc79d4e9cf44f3f7a48d0aa2053b5"
62+
core:
63+
url: "https://github.com/ocornut/imgui/archive/v1.89.9-docking.tar.gz"
64+
sha256: "2481489ce9091239b3cab8a330d0409ffdd9ee607ad1f3fe3a0b0b751c27a8eb"
65+
testengine:
66+
url: "https://github.com/ocornut/imgui_test_engine/archive/v1.89.9.tar.gz"
67+
sha256: "951f2a45d7e637983265dead44a6e78a0b0dc79d4e9cf44f3f7a48d0aa2053b5"
4768
"1.88":
48-
url: "https://github.com/ocornut/imgui/archive/v1.88.tar.gz"
49-
sha256: "9f14c788aee15b777051e48f868c5d4d959bd679fc5050e3d2a29de80d8fd32e"
69+
core:
70+
url: "https://github.com/ocornut/imgui/archive/v1.88.tar.gz"
71+
sha256: "9f14c788aee15b777051e48f868c5d4d959bd679fc5050e3d2a29de80d8fd32e"
5072
"1.87":
51-
url: "https://github.com/ocornut/imgui/archive/v1.87.tar.gz"
52-
sha256: "b54ceb35bda38766e36b87c25edf7a1cd8fd2cb8c485b245aedca6fb85645a20"
73+
core:
74+
url: "https://github.com/ocornut/imgui/archive/v1.87.tar.gz"
75+
sha256: "b54ceb35bda38766e36b87c25edf7a1cd8fd2cb8c485b245aedca6fb85645a20"
5376
"1.86":
54-
url: "https://github.com/ocornut/imgui/archive/v1.86.tar.gz"
55-
sha256: "6ba6ae8425a19bc52c5e067702c48b70e4403cd339cba02073a462730a63e825"
77+
core:
78+
url: "https://github.com/ocornut/imgui/archive/v1.86.tar.gz"
79+
sha256: "6ba6ae8425a19bc52c5e067702c48b70e4403cd339cba02073a462730a63e825"
5680
"1.85":
57-
url: "https://github.com/ocornut/imgui/archive/v1.85.tar.gz"
58-
sha256: "7ed49d1f4573004fa725a70642aaddd3e06bb57fcfe1c1a49ac6574a3e895a77"
81+
core:
82+
url: "https://github.com/ocornut/imgui/archive/v1.85.tar.gz"
83+
sha256: "7ed49d1f4573004fa725a70642aaddd3e06bb57fcfe1c1a49ac6574a3e895a77"

recipes/imgui/all/conanfile.py

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import os
2+
13
from conan import ConanFile
2-
from conan.tools.files import get, copy, replace_in_file
3-
from conan.tools.scm import Version
44
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
5-
import os
6-
import re
5+
from conan.tools.files import get, copy, replace_in_file
76

87
required_conan_version = ">=1.53.0"
98

@@ -28,21 +27,14 @@ class IMGUIConan(ConanFile):
2827
"fPIC": True,
2928
"enable_test_engine": False
3029
}
31-
32-
def _base_version(self):
33-
return self.version.split('-')[0]
34-
35-
def _is_docking_branch(self):
36-
return self.version.endswith("-docking")
3730

3831
def export_sources(self):
3932
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
4033

4134
def config_options(self):
4235
if self.settings.os == "Windows":
4336
del self.options.fPIC
44-
45-
if (f"{self._base_version()}-testengine") not in self.conan_data["sources"]:
37+
if "testengine" not in self.conan_data["sources"][self.version]:
4638
self.output.warning("No test engine found for this version, removing test engine option")
4739
del self.options.enable_test_engine
4840

@@ -54,12 +46,10 @@ def layout(self):
5446
cmake_layout(self, src_folder="src")
5547

5648
def source(self):
57-
get(self, **self.conan_data["sources"][self.version], strip_root=True)
58-
base_version = self._base_version()
59-
if (f"{self._base_version()}-testengine") not in self.conan_data["sources"]:
60-
self.output.warning("No test engine found for this version, skipping download")
61-
else:
62-
get(self, **self.conan_data["sources"][f"{base_version}-testengine"], strip_root=True, destination="test_engine")
49+
get(self, **self.conan_data["sources"][self.version]["core"], strip_root=True)
50+
if "testengine" in self.conan_data["sources"][self.version]:
51+
get(self, **self.conan_data["sources"][self.version]["testengine"], strip_root=True, destination="test_engine")
52+
self._patch_sources()
6353

6454
def generate(self):
6555
tc = CMakeToolchain(self)
@@ -81,18 +71,13 @@ def _patch_sources(self):
8171
)
8272

8373
def build(self):
84-
self._patch_sources()
8574
cmake = CMake(self)
8675
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
8776
cmake.build()
8877

8978
def package(self):
9079
copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
91-
base_version = self._base_version()
92-
backends_folder = os.path.join(
93-
self.source_folder,
94-
"backends" if base_version >= "1.80" else "examples"
95-
)
80+
backends_folder = os.path.join(self.source_folder, "backends")
9681
copy(self, pattern="imgui_impl_*",
9782
dst=os.path.join(self.package_folder, "res", "bindings"),
9883
src=backends_folder)
@@ -109,8 +94,8 @@ def package(self):
10994
cmake.install()
11095

11196
def package_info(self):
112-
self.conf_info.define("user.imgui:with_docking", bool(self._is_docking_branch()))
113-
97+
_is_docking_branch = "docking" in str(self.version)
98+
self.conf_info.define("user.imgui:with_docking", _is_docking_branch)
11499
self.cpp_info.libs = ["imgui"]
115100
if self.settings.os == "Linux":
116101
self.cpp_info.system_libs.append("m")

0 commit comments

Comments
 (0)