diff options
author | 2024-05-10 14:45:29 +0100 | |
---|---|---|
committer | 2024-05-10 15:00:47 +0100 | |
commit | 799a585cd126163c3f6242b4fb0d55302eecbb9e (patch) | |
tree | b7067ce1d7c0e99b183f0ba8ad4978db5d5ea230 /media-libs | |
parent | media-libs/implot: use custom meson.build instead of patch (diff) | |
download | guru-799a585cd126163c3f6242b4fb0d55302eecbb9e.tar.gz guru-799a585cd126163c3f6242b4fb0d55302eecbb9e.tar.bz2 guru-799a585cd126163c3f6242b4fb0d55302eecbb9e.zip |
media-libs/imgui: use custom meson.build instead of patch
* add missing useflags
Signed-off-by: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com>
Diffstat (limited to 'media-libs')
-rw-r--r-- | media-libs/imgui/Manifest | 1 | ||||
-rw-r--r-- | media-libs/imgui/files/imgui-1.89.9-wrapdb-meson-fix.patch | 45 | ||||
-rw-r--r-- | media-libs/imgui/files/imgui-meson.build | 160 | ||||
-rw-r--r-- | media-libs/imgui/files/imgui-meson_options.txt | 19 | ||||
-rw-r--r-- | media-libs/imgui/imgui-1.89.9-r1.ebuild (renamed from media-libs/imgui/imgui-1.89.9.ebuild) | 22 | ||||
-rw-r--r-- | media-libs/imgui/metadata.xml | 2 |
6 files changed, 191 insertions, 58 deletions
diff --git a/media-libs/imgui/Manifest b/media-libs/imgui/Manifest index bcfdfa8f6..5e96536e0 100644 --- a/media-libs/imgui/Manifest +++ b/media-libs/imgui/Manifest @@ -1,2 +1 @@ -DIST imgui-1.89.9-1-meson-wrap.zip 2413 BLAKE2B 01598058869b312e225c6c11fdea057854a4ffd45bbd6d64330093c68294f1c06529ed6033f94efa780be3a4243f2ece70fba9207ea54c14cfd32067b25e91a1 SHA512 5951c70d94d747530afb4603e0322cfd038c58bef1a7285f66889f9b7081ae336e2e933c6578176b2fb48279b656106882596bd797f7c949088dd63cd2943cbc DIST imgui-1.89.9.tar.gz 1609452 BLAKE2B d5f361acf4318b05066720e9da2ed06db760c482440fc7fb2ca95ce5dd88d9a9a010697c831d3e188baec69819c0a0925e98134c191d5e1856ab43e4dbf9b64f SHA512 42021b06b611b58222b09fab8db2c34e992c3dc4fbaa175e09833c66c90d04b4a4e7def16a732535335c0ac5ff014d235835511a5d9a76d32b4395b302146919 diff --git a/media-libs/imgui/files/imgui-1.89.9-wrapdb-meson-fix.patch b/media-libs/imgui/files/imgui-1.89.9-wrapdb-meson-fix.patch deleted file mode 100644 index 30bf42a16..000000000 --- a/media-libs/imgui/files/imgui-1.89.9-wrapdb-meson-fix.patch +++ /dev/null @@ -1,45 +0,0 @@ -# Meson wrapdb's meson.build file doesn't handle installing the library, we patch that here - -diff --git a/meson.build b/imgui-1.81-meson.build -index 3343dd4ad..804f84227 100644 ---- a/meson.build -+++ b/imgui-1.81-meson.build -@@ -112,8 +112,38 @@ - gnu_symbol_visibility: 'hidden', - dependencies: dependencies, - include_directories: include_dirs, -+ version: meson.project_version(), -+ install: true - ) - -+pkg_mod = import('pkgconfig') -+pkg_mod.generate(imgui, -+ description : 'Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies' -+) -+ -+install_headers( -+ 'imconfig.h', -+ 'imgui.h', -+ 'imgui_internal.h', -+ 'imstb_rectpack.h', -+ 'imstb_textedit.h', -+ 'imstb_truetype.h', -+ 'backends/imgui_impl_dx9.h', -+ 'backends/imgui_impl_osx.h', -+ 'backends/imgui_impl_dx10.h', -+ 'backends/imgui_impl_dx11.h', -+ 'backends/imgui_impl_dx12.h', -+ 'backends/imgui_impl_glfw.h', -+ 'backends/imgui_impl_glut.h', -+ 'backends/imgui_impl_wgpu.h', -+ 'backends/imgui_impl_metal.h', -+ 'backends/imgui_impl_win32.h', -+ 'backends/imgui_impl_vulkan.h', -+ 'backends/imgui_impl_opengl2.h', -+ 'backends/imgui_impl_opengl3.h', -+ 'backends/imgui_impl_allegro5.h', -+ subdir: 'imgui') -+ - if host_machine.system() == 'windows' - api = '-DIMGUI_API=@0@'.format(get_option('default_library') != 'static' ? '__declspec(dllimport)' : '') - endif diff --git a/media-libs/imgui/files/imgui-meson.build b/media-libs/imgui/files/imgui-meson.build new file mode 100644 index 000000000..cb27420aa --- /dev/null +++ b/media-libs/imgui/files/imgui-meson.build @@ -0,0 +1,160 @@ +project( + 'imgui', + 'cpp', + license: 'MIT', + version: 'PV', + meson_version: '>=0.50.0', +) + +if host_machine.system() == 'darwin' + add_languages('objcpp') +endif + +include_dirs = include_directories('.', 'backends') +sources = files( + 'misc/cpp/imgui_stdlib.cpp', + 'imgui.cpp', + 'imgui_demo.cpp', + 'imgui_draw.cpp', + 'imgui_tables.cpp', + 'imgui_widgets.cpp', +) + +cpp = meson.get_compiler('cpp') +dependencies = [] + +# renderer backends +dependencies += cpp.find_library('d3dcompiler', required: host_machine.system() == 'windows') +dx9_dep = cpp.find_library('d3d9', required: get_option('dx9')) +if dx9_dep.found() + sources += 'backends/imgui_impl_dx9.cpp' + dependencies += dx9_dep +endif +dx10_dep = cpp.find_library('d3d10', required: get_option('dx10')) +if dx10_dep.found() + sources += 'backends/imgui_impl_dx10.cpp' + dependencies += dx10_dep +endif +dx11_dep = cpp.find_library('d3d11', required: get_option('dx11')) +if dx11_dep.found() + sources += 'backends/imgui_impl_dx11.cpp' + dependencies += dx11_dep +endif +dx12_dep = cpp.find_library('d3d12', required: get_option('dx12')) +# MinGW does not work. See https://github.com/ocornut/imgui/pull/4604 +if dx12_dep.found() and cpp.get_argument_syntax() == 'msvc' + sources += 'backends/imgui_impl_dx12.cpp' + dependencies += dx12_dep +endif +metal_dep = dependency('appleframeworks', modules: ['Foundation', 'AppKit', 'GameController', 'Metal'], required: get_option('metal')) +if metal_dep.found() + sources += 'backends/imgui_impl_metal.mm' + dependencies += metal_dep +endif +libgl_dep = dependency('gl', required: get_option('opengl')) +if libgl_dep.found() + sources += 'backends/imgui_impl_opengl3.cpp' + dependencies += libgl_dep + dependencies += cpp.find_library('dl', required: false) +endif +sdl2_renderer_dep = dependency('sdl2', version: '>=2.0.17', required: get_option('sdl_renderer')) +if sdl2_renderer_dep.found() + sources += 'backends/imgui_impl_sdlrenderer2.cpp' + dependencies += sdl2_renderer_dep +endif +vulkan_dep = dependency('vulkan', required: get_option('vulkan')) +if vulkan_dep.found() + sources += 'backends/imgui_impl_vulkan.cpp' + dependencies += vulkan_dep +endif +if cpp.has_header('webgpu/webgpu.h', required: get_option('webgpu')) + sources += 'backends/imgui_impl_wgpu.cpp' +endif + +# platform backends +glfw_dep = dependency('glfw3', required: get_option('glfw')) +if glfw_dep.found() + sources += 'backends/imgui_impl_glfw.cpp' + dependencies += glfw_dep +endif +sdl2_dep = dependency('sdl2', required: get_option('sdl2')) +if sdl2_dep.found() + sources += 'backends/imgui_impl_sdl2.cpp' + dependencies += sdl2_dep +endif +osx_dep = dependency('appleframeworks', modules: ['Carbon', 'Cocoa', 'GameController'], required: get_option('osx')) +if osx_dep.found() + sources += 'backends/imgui_impl_osx.mm' +endif +win_dep = cpp.find_library('dwmapi', required: get_option('win')) +if win_dep.found() + sources += 'backends/imgui_impl_win32.cpp' + dependencies += win_dep +endif + +# frameworks +allegro5_dep = dependency('allegro-5', required: get_option('allegro5')) +allegro5_primitives_dep = dependency('allegro_primitives-5', required: get_option('allegro5')) +if allegro5_dep.found() and allegro5_primitives_dep.found() + sources += 'backends/imgui_impl_allegro5.cpp' + dependencies += [allegro5_dep, allegro5_primitives_dep] +endif + +api = '-DIMGUI_API=__attribute__((visibility("default")))' +if host_machine.system() == 'windows' + api = '-DIMGUI_API=@0@'.format(get_option('default_library') != 'static' ? '__declspec(dllexport)' : '') +endif + +imgui = library( + 'imgui', + sources, + cpp_args: api, + gnu_symbol_visibility: 'hidden', + dependencies: dependencies, + include_directories: include_dirs, + version: meson.project_version(), + install: true +) + +pkg_mod = import('pkgconfig') +pkg_mod.generate(imgui, + description : 'Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies' +) + +install_headers( + 'imconfig.h', + 'imgui.h', + 'imgui_internal.h', + 'imstb_rectpack.h', + 'imstb_textedit.h', + 'imstb_truetype.h', + 'backends/imgui_impl_allegro5.h', + 'backends/imgui_impl_android.h', + 'backends/imgui_impl_dx10.h', + 'backends/imgui_impl_dx11.h', + 'backends/imgui_impl_dx12.h', + 'backends/imgui_impl_glfw.h', + 'backends/imgui_impl_glut.h', + 'backends/imgui_impl_metal.h', + 'backends/imgui_impl_opengl2.h', + 'backends/imgui_impl_opengl3.h', + 'backends/imgui_impl_opengl3_loader.h', + 'backends/imgui_impl_osx.h', + 'backends/imgui_impl_sdl2.h', + 'backends/imgui_impl_sdl3.h', + 'backends/imgui_impl_sdlrenderer2.h', + 'backends/imgui_impl_sdlrenderer3.h', + 'backends/imgui_impl_vulkan.h', + 'backends/imgui_impl_wgpu.h', + 'backends/imgui_impl_win32.h', + subdir: 'imgui') + +if host_machine.system() == 'windows' + api = '-DIMGUI_API=@0@'.format(get_option('default_library') != 'static' ? '__declspec(dllimport)' : '') +endif + +imgui_dep = declare_dependency( + compile_args: api, + include_directories: include_dirs, + link_with: imgui, +) diff --git a/media-libs/imgui/files/imgui-meson_options.txt b/media-libs/imgui/files/imgui-meson_options.txt new file mode 100644 index 000000000..967c85f64 --- /dev/null +++ b/media-libs/imgui/files/imgui-meson_options.txt @@ -0,0 +1,19 @@ +# renderer backends +option('dx9', type : 'feature', value : 'auto') +option('dx10', type : 'feature', value : 'auto') +option('dx11', type : 'feature', value : 'auto') +option('dx12', type : 'feature', value : 'auto') +option('metal', type : 'feature', value : 'auto') +option('opengl', type : 'feature', value : 'auto') +option('sdl_renderer', type : 'feature', value : 'auto') +option('vulkan', type : 'feature', value : 'auto') +option('webgpu', type : 'feature', value : 'auto') + +# platform backends +option('glfw', type : 'feature', value : 'auto') +option('sdl2', type : 'feature', value : 'auto') +option('osx', type : 'feature', value : 'auto') +option('win', type : 'feature', value : 'auto') + +# frameworks (renderer + platform) +option('allegro5', type : 'feature', value : 'auto') diff --git a/media-libs/imgui/imgui-1.89.9.ebuild b/media-libs/imgui/imgui-1.89.9-r1.ebuild index 44891bc53..bed80af29 100644 --- a/media-libs/imgui/imgui-1.89.9.ebuild +++ b/media-libs/imgui/imgui-1.89.9-r1.ebuild @@ -12,15 +12,12 @@ HOMEPAGE=" https://github.com/ocornut/imgui " -SRC_URI=" - https://github.com/ocornut/imgui/archive/v${PV}.tar.gz -> imgui-${PV}.tar.gz - https://wrapdb.mesonbuild.com/v2/imgui_${PV}-${MESON_WRAP_VER}/get_patch -> imgui-${PV}-${MESON_WRAP_VER}-meson-wrap.zip -" +SRC_URI="https://github.com/ocornut/imgui/archive/v${PV}.tar.gz -> imgui-${PV}.tar.gz" LICENSE="MIT" SLOT="0/${PV}" KEYWORDS="~amd64" -IUSE="opengl vulkan glfw sdl2 marmalade allegro5" +IUSE="opengl vulkan glfw sdl2 sdl_renderer webgpu allegro5" RDEPEND=" dev-libs/stb:= @@ -29,6 +26,7 @@ RDEPEND=" glfw? ( media-libs/glfw:0[${MULTILIB_USEDEP}] ) opengl? ( virtual/opengl[${MULTILIB_USEDEP}] ) sdl2? ( media-libs/libsdl2[${MULTILIB_USEDEP}] ) + sdl_renderer? ( media-libs/libsdl2[${MULTILIB_USEDEP}] ) vulkan? ( media-libs/vulkan-loader[${MULTILIB_USEDEP}] ) " DEPEND=" @@ -37,17 +35,15 @@ DEPEND=" " BDEPEND=" virtual/pkgconfig - app-arch/unzip " -PATCHES=( - "${FILESDIR}/${P}-wrapdb-meson-fix.patch" -) - -src_unpack() { +src_prepare() { default - unpack imgui-${PV}-${MESON_WRAP_VER}-meson-wrap.zip + # Use custom meson.build and meson_options.txt to install instead of relay on packages + cp "${FILESDIR}/${PN}-meson.build" "${S}/meson.build" || die + cp "${FILESDIR}/${PN}-meson_options.txt" "${S}/meson_options.txt" || die + sed -i "s/ version: 'PV',/ version: '${PV}',/g" "${S}/meson.build" || die } multilib_src_configure() { @@ -61,6 +57,8 @@ multilib_src_configure() { $(meson_feature vulkan) $(meson_feature glfw) $(meson_feature sdl2) + $(meson_feature sdl_renderer) + $(meson_feature webgpu) -Dosx=disabled -Dwin=disabled $(meson_feature allegro5) diff --git a/media-libs/imgui/metadata.xml b/media-libs/imgui/metadata.xml index fe2a667a0..6719588bc 100644 --- a/media-libs/imgui/metadata.xml +++ b/media-libs/imgui/metadata.xml @@ -15,5 +15,7 @@ <flag name="opengl">Enable opengl renderer</flag> <flag name="vulkan">Enable vulkan renderer</flag> <flag name="sdl2">Enable SDL2 backend</flag> + <flag name="sdl_renderer">Enable SDL renderer backend</flag> + <flag name="webgpu">Enable webgpu renderer backend</flag> </use> </pkgmetadata> |