Gentoo Archives: gentoo-commits

From: Adel KARA SLIMANE <adel@×××××××××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: media-libs/imgui/, media-libs/imgui/files/
Date: Sat, 27 Aug 2022 23:00:07
Message-Id: 1661628168.37a299260b8a3396af925f2c46f586dda0e7a28f.adel@gentoo
1 commit: 37a299260b8a3396af925f2c46f586dda0e7a28f
2 Author: Adel KARA SLIMANE <adel.ks <AT> zegrapher <DOT> com>
3 AuthorDate: Sat Aug 27 19:02:21 2022 +0000
4 Commit: Adel KARA SLIMANE <adel <AT> karaslimane <DOT> com>
5 CommitDate: Sat Aug 27 19:22:48 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=37a29926
7
8 media-libs/imgui: add version 1.81 and use meson
9
10 meson was simpler to use to add tweaks that makes
11 this version work with mangohud
12
13 Signed-off-by: Adel KARA SLIMANE <adel.ks <AT> zegrapher.com>
14
15 media-libs/imgui/Manifest | 1 +
16 media-libs/imgui/files/imgui-1.81-meson.build | 137 +++++++++++++++++++++
17 .../imgui/files/imgui-1.81-meson_options.txt | 18 +++
18 media-libs/imgui/imgui-1.81.ebuild | 66 ++++++++++
19 4 files changed, 222 insertions(+)
20
21 diff --git a/media-libs/imgui/Manifest b/media-libs/imgui/Manifest
22 index 6c720b19b..c33c14ca9 100644
23 --- a/media-libs/imgui/Manifest
24 +++ b/media-libs/imgui/Manifest
25 @@ -1,3 +1,4 @@
26 DIST cimgui-1.87.gh.tar.gz 385460 BLAKE2B 0916d53a00234343536ee412035a2c405b01e31a26c3d059cff4d446188ee8a1835a1233a68f671ccebb67be480801b85203a90b0e79fa729f7ac1efdc8bf4a2 SHA512 bf2ed9461e8c12514d29914e6da7f8fae7cd31fcc587c7d89122c950541aed3b4b908d8cd298b3975e9a955a47789335a88db7223ca558cbdf459693a0081bda
27 +DIST imgui-1.81.tar.gz 1413443 BLAKE2B 6f2e63777821b2767da92d9f40f4de7b4313c38817413e959e612c0ce67701645cf29f0748a3b86cfbd41e0b4b2c8099e9a0ca786c637ca1661fffd7b0de0629 SHA512 d7a2b66dea77359f78068a595607d7668e09ddd0b91910f67fc6463cb920b91b0cc1855984bd4d41e6a880b69ca7cd5e3adc064dcf461c0629b9f8c845a4fc3e
28 DIST imgui-1.83.tar.gz 1448389 BLAKE2B 648306bd69181ad8315f12fc5b2c319b23005d6b3fc790ad64caaf1f80304e81b33af5d6f435fa97151fcf1e77eb15455838a09570b7a9c7dd9c56a61510b5a1 SHA512 2150e7101f384b1c749b2e89876b2085a7ff43435f04e88602d0e5e00db7a41c1ace5176bdb0963326845d1c8303b5092a7ca1c9c8e70c522ba96f899ed5bb9c
29 DIST imgui-1.87.gh.tar.gz 1460834 BLAKE2B f73b71400311e7c5f82248e242a932add5090670c78077ca2239f349730bab88a00bfe4deca4e854772ef7f6a2cff1fc0f38f7174a026995f93c9e7b55eb2a1d SHA512 3255b06698ab9c8951953e1e0b6d160d64adfa4c011b21a4288547292a7f8fff586875faf9dae0677818bde65bd7e98da92f16f6beb1e6a66aa835edf32e8ce2
30
31 diff --git a/media-libs/imgui/files/imgui-1.81-meson.build b/media-libs/imgui/files/imgui-1.81-meson.build
32 new file mode 100644
33 index 000000000..1d5e67e38
34 --- /dev/null
35 +++ b/media-libs/imgui/files/imgui-1.81-meson.build
36 @@ -0,0 +1,137 @@
37 +# Copyright (c) 2020 The Meson development team
38 +
39 +# Permission is hereby granted, free of charge, to any person obtaining a copy
40 +# of this software and associated documentation files (the "Software"), to deal
41 +# in the Software without restriction, including without limitation the rights
42 +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43 +# copies of the Software, and to permit persons to whom the Software is
44 +# furnished to do so, subject to the following conditions:
45 +
46 +# The above copyright notice and this permission notice shall be included in all
47 +# copies or substantial portions of the Software.
48 +
49 +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51 +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52 +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53 +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54 +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55 +# SOFTWARE.
56 +
57 +project('imgui', 'cpp',
58 + version: '1.81',
59 + license: 'MIT',
60 +)
61 +
62 +include_dirs = include_directories('.', 'backends')
63 +sources = ['imgui_demo.cpp', 'imgui_draw.cpp', 'imgui_tables.cpp', 'imgui_widgets.cpp', 'imgui.cpp']
64 +
65 +cpp = meson.get_compiler('cpp')
66 +dependencies = []
67 +
68 +# renderer backends
69 +dx9_dep = cpp.find_library('d3d9', required: get_option('dx9'))
70 +if dx9_dep.found()
71 + sources += 'backends/imgui_impl_dx9.cpp'
72 + dependencies += dx9_dep
73 +endif
74 +dx10_dep = cpp.find_library('d3d10', required: get_option('dx10'))
75 +if dx10_dep.found()
76 + sources += 'backends/imgui_impl_dx10.cpp'
77 + dependencies += dx10_dep
78 +endif
79 +dx11_dep = cpp.find_library('d3d11', required: get_option('dx11'))
80 +if dx11_dep.found()
81 + sources += 'backends/imgui_impl_dx11.cpp'
82 + dependencies += dx11_dep
83 +endif
84 +dx12_dep = cpp.find_library('d3d12', required: get_option('dx12'))
85 +if dx12_dep.found()
86 + sources += 'backends/imgui_impl_dx12.cpp'
87 + dependencies += dx12_dep
88 +endif
89 +metal_dep = cpp.find_library('metal', required: get_option('metal'))
90 +if get_option('metal').enabled()
91 + sources += 'backends/imgui_impl_metal.mm'
92 + dependencies += metal_dep
93 +endif
94 +glew_dep = dependency('glew', required: get_option('opengl'))
95 +if glew_dep.found()
96 + sources += 'backends/imgui_impl_opengl3.cpp'
97 + dependencies += glew_dep
98 +endif
99 +vulkan_dep = dependency('vulkan', required: get_option('vulkan'))
100 +if vulkan_dep.found()
101 + sources += 'backends/imgui_impl_vulkan.cpp'
102 + dependencies += vulkan_dep
103 +endif
104 +
105 +# platform backends
106 +glfw_dep = dependency('glfw3', required: get_option('glfw'))
107 +if glfw_dep.found()
108 + sources += 'backends/imgui_impl_glfw.cpp'
109 + dependencies += glfw_dep
110 +endif
111 +sdl2_dep = dependency('sdl2', required: get_option('sdl2'))
112 +if sdl2_dep.found()
113 + sources += 'backends/imgui_impl_sdl.cpp'
114 + dependencies += sdl2_dep
115 +endif
116 +if get_option('osx').enabled() or (get_option('osx').auto() and target_machine.system() == 'darwin')
117 + sources += 'backends/imgui_impl_osx.mm'
118 +endif
119 +if get_option('win').enabled() or (get_option('win').auto() and target_machine.system() == 'windows')
120 + sources += 'backends/imgui_impl_win32.cpp'
121 +endif
122 +
123 +# frameworks
124 +allegro5_dep = dependency('allegro5', required: get_option('allegro5'))
125 +if allegro5_dep.found()
126 + sources += 'backends/imgui_impl_allegro5.cpp'
127 + dependencies += allegro5_dep
128 +endif
129 +marmalade_dep = cpp.find_library('marmalade', required: get_option('marmalade'))
130 +if marmalade_dep.found()
131 + sources += 'backends/imgui_impl_marmalade.cpp'
132 + dependencies += marmalade_dep
133 +endif
134 +
135 +imgui = library('imgui',
136 + sources,
137 + dependencies: dependencies,
138 + include_directories: include_dirs,
139 + version: meson.project_version(),
140 + install: true
141 +)
142 +
143 +pkg_mod = import('pkgconfig')
144 +pkg_mod.generate(imgui,
145 + description : 'Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies'
146 +)
147 +
148 +install_headers(
149 + 'imconfig.h',
150 + 'imgui.h',
151 + 'imgui_internal.h',
152 + 'imstb_rectpack.h',
153 + 'imstb_textedit.h',
154 + 'imstb_truetype.h',
155 + 'backends/imgui_impl_dx9.h',
156 + 'backends/imgui_impl_osx.h',
157 + 'backends/imgui_impl_sdl.h',
158 + 'backends/imgui_impl_dx10.h',
159 + 'backends/imgui_impl_dx11.h',
160 + 'backends/imgui_impl_dx12.h',
161 + 'backends/imgui_impl_glfw.h',
162 + 'backends/imgui_impl_glut.h',
163 + 'backends/imgui_impl_wgpu.h',
164 + 'backends/imgui_impl_metal.h',
165 + 'backends/imgui_impl_win32.h',
166 + 'backends/imgui_impl_vulkan.h',
167 + 'backends/imgui_impl_opengl2.h',
168 + 'backends/imgui_impl_opengl3.h',
169 + 'backends/imgui_impl_allegro5.h',
170 + 'backends/imgui_impl_marmalade.h',
171 + subdir: 'imgui')
172 +
173 +imgui_dep = declare_dependency(include_directories: include_dirs, link_with: imgui)
174
175 diff --git a/media-libs/imgui/files/imgui-1.81-meson_options.txt b/media-libs/imgui/files/imgui-1.81-meson_options.txt
176 new file mode 100644
177 index 000000000..b61e45adc
178 --- /dev/null
179 +++ b/media-libs/imgui/files/imgui-1.81-meson_options.txt
180 @@ -0,0 +1,18 @@
181 +# renderer backends
182 +option('dx9', type : 'feature', value : 'auto')
183 +option('dx10', type : 'feature', value : 'auto')
184 +option('dx11', type : 'feature', value : 'auto')
185 +option('dx12', type : 'feature', value : 'auto')
186 +option('metal', type : 'feature', value : 'auto')
187 +option('opengl', type : 'feature', value : 'auto')
188 +option('vulkan', type : 'feature', value : 'auto')
189 +
190 +# platform backends
191 +option('glfw', type : 'feature', value : 'auto')
192 +option('sdl2', type : 'feature', value : 'auto')
193 +option('osx', type : 'feature', value : 'auto')
194 +option('win', type : 'feature', value : 'auto')
195 +
196 +# frameworks (renderer + platform)
197 +option('marmalade', type : 'feature', value : 'auto')
198 +option('allegro5', type : 'feature', value : 'auto')
199
200 diff --git a/media-libs/imgui/imgui-1.81.ebuild b/media-libs/imgui/imgui-1.81.ebuild
201 new file mode 100644
202 index 000000000..939d77327
203 --- /dev/null
204 +++ b/media-libs/imgui/imgui-1.81.ebuild
205 @@ -0,0 +1,66 @@
206 +# Copyright 1999-2022 Gentoo Authors
207 +# Distributed under the terms of the GNU General Public License v2
208 +
209 +EAPI=8
210 +
211 +inherit meson
212 +
213 +IMGUI_VER="1.81"
214 +IMGUI_MESON_WRAP_VER="1"
215 +
216 +DESCRIPTION="Bloat-free graphical user interface library for C++"
217 +HOMEPAGE="
218 + https://github.com/ocornut/imgui
219 +"
220 +
221 +SRC_URI="
222 + https://github.com/ocornut/imgui/archive/v${IMGUI_VER}.tar.gz -> imgui-${IMGUI_VER}.tar.gz
223 +"
224 +
225 +LICENSE="MIT"
226 +SLOT="0/${PV}"
227 +KEYWORDS="~amd64"
228 +IUSE="dx9 dx10 dx11 dx12 metal opengl vulkan glfw sdl2 osx win marmalade allegro5"
229 +
230 +RDEPEND="
231 + dev-libs/stb:=
232 + media-libs/glew
233 + allegro5? ( media-libs/allegro:5 )
234 + glfw? ( media-libs/glfw:0 )
235 + opengl? ( virtual/opengl )
236 + sdl2? ( media-libs/libsdl2 )
237 + vulkan? ( media-libs/vulkan-loader )
238 +"
239 +DEPEND="
240 + ${RDEPEND}
241 + vulkan? ( dev-util/vulkan-headers )
242 +"
243 +BDEPEND="
244 + virtual/pkgconfig
245 +"
246 +
247 +src_unpack() {
248 + default
249 +
250 + cp ${FILESDIR}/imgui-${IMGUI_VER}-meson.build ${S}/meson.build || die
251 + cp ${FILESDIR}/imgui-${IMGUI_VER}-meson_options.txt ${S}/meson_options.txt || die
252 +}
253 +
254 +src_configure() {
255 + local emesonargs=(
256 + $(meson_feature dx9)
257 + $(meson_feature dx10)
258 + $(meson_feature dx11)
259 + $(meson_feature dx12)
260 + $(meson_feature metal)
261 + $(meson_feature opengl)
262 + $(meson_feature vulkan)
263 + $(meson_feature glfw)
264 + $(meson_feature sdl2)
265 + $(meson_feature osx)
266 + $(meson_feature win)
267 + $(meson_feature marmalade)
268 + $(meson_feature allegro5)
269 + )
270 + meson_src_configure
271 +}