From 3e12b65f0dc89e9f147f1055a0157c729ebf0fe8 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Wed, 20 Sep 2023 19:38:19 +0200 Subject: media-libs/imgui: install all the generated cimgui files Signed-off-by: Alessandro Barbieri --- media-libs/imgui/files/cimgui-1.87-CMakeLists.txt | 26 +++-- media-libs/imgui/imgui-1.87-r7.ebuild | 113 ++++++++++++++++++++++ 2 files changed, 133 insertions(+), 6 deletions(-) create mode 100644 media-libs/imgui/imgui-1.87-r7.ebuild (limited to 'media-libs') diff --git a/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt b/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt index 713125ec6..a1c735bca 100644 --- a/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt +++ b/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt @@ -43,13 +43,22 @@ if(IMGUI_VULKAN) list(APPEND GENERATOR_ARGS vulkan) endif() list(APPEND GENERATOR_ARGS ${IMGUI_COMMON_FLAGS} ${CMAKE_CPP_FLAGS}) -file(GLOB GENERATOR_OUTPUT_FILES "${CMAKE_SOURCE_DIR}/generator/output/*") -list(APPEND - GENERATOR_OUTPUT_FILES +set(CIMGUI_EXTRA_STUFF + ${CMAKE_SOURCE_DIR}/generator/output/definitions.json + ${CMAKE_SOURCE_DIR}/generator/output/definitions.lua + ${CMAKE_SOURCE_DIR}/generator/output/impl_definitions.json + ${CMAKE_SOURCE_DIR}/generator/output/impl_definitions.lua + ${CMAKE_SOURCE_DIR}/generator/output/overloads.txt + ${CMAKE_SOURCE_DIR}/generator/output/structs_and_enums.json + ${CMAKE_SOURCE_DIR}/generator/output/structs_and_enums.lua + ${CMAKE_SOURCE_DIR}/generator/output/typedefs_dict.json + ${CMAKE_SOURCE_DIR}/generator/output/typedefs_dict.lua +) +set(GENERATOR_OUTPUT_FILES ${CMAKE_SOURCE_DIR}/cimgui.cpp ${CMAKE_SOURCE_DIR}/cimgui.h - ${CMAKE_SOURCE_DIR}/generator/output/cimgui_nopreprocess.cpp - ${CMAKE_SOURCE_DIR}/generator/output/cimgui_nopreprocess.h + ${CMAKE_SOURCE_DIR}/generator/output/cimgui_impl.h + ${CIMGUI_EXTRA_STUFF} ) ADD_CUSTOM_COMMAND(VERBATIM OUTPUT ${GENERATOR_OUTPUT_FILES} @@ -57,7 +66,10 @@ ADD_CUSTOM_COMMAND(VERBATIM WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/generator" ) set(CIMGUI_SOURCES "${CMAKE_SOURCE_DIR}/cimgui.cpp") -set(CIMGUI_INCLUDE_FILES "${CMAKE_SOURCE_DIR}/cimgui.h") +set(CIMGUI_INCLUDE_FILES + "${CMAKE_SOURCE_DIR}/cimgui.h" + "${CMAKE_SOURCE_DIR}/generator/output/cimgui_impl.h" +) target_sources(cimgui PUBLIC @@ -70,6 +82,7 @@ include(GNUInstallDirs) #install install(TARGETS cimgui LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${CIMGUI_INCLUDE_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/imgui") +install(FILES ${CIMGUI_EXTRA_STUFF} DESTINATION "${CMAKE_INSTALL_DATADIR}/cimgui") #test set(CIMGUI_TEST "no" CACHE STRING "Enable compilation of a test unit based on imgui null") @@ -78,3 +91,4 @@ if (CIMGUI_TEST) add_subdirectory(test) endif () endif() + diff --git a/media-libs/imgui/imgui-1.87-r7.ebuild b/media-libs/imgui/imgui-1.87-r7.ebuild new file mode 100644 index 000000000..49227f0f4 --- /dev/null +++ b/media-libs/imgui/imgui-1.87-r7.ebuild @@ -0,0 +1,113 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +DESCRIPTION="Bloat-free graphical user interface library for C++" +HOMEPAGE=" + https://github.com/ocornut/imgui + https://github.com/cimgui/cimgui +" +SRC_URI=" + https://github.com/ocornut/imgui/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz + https://github.com/cimgui/cimgui/archive/refs/tags/${PV}.tar.gz -> c${P}.gh.tar.gz +" + +LICENSE="MIT" +SLOT="0/${PV}" +KEYWORDS="~amd64" +IUSE="allegro bindings examples freetype glfw glut opengl sdl vulkan" +S="${WORKDIR}/c${P}" + +RDEPEND=" + dev-libs/stb:= + allegro? ( media-libs/allegro:5 ) + freetype? ( media-libs/freetype ) + glfw? ( media-libs/glfw:0 ) + glut? ( media-libs/freeglut ) + opengl? ( virtual/opengl ) + sdl? ( media-libs/libsdl2 ) + vulkan? ( media-libs/vulkan-loader ) +" +DEPEND=" + ${RDEPEND} + vulkan? ( dev-util/vulkan-headers ) +" +BDEPEND=" + bindings? ( dev-lang/luajit ) + virtual/pkgconfig +" + +REQUIRED_USE=" + || ( + allegro + glfw + glut + sdl + ) + || ( + allegro + opengl + vulkan + ) +" + +PATCHES=( "${FILESDIR}/${P}-fpermissive.patch" ) + +src_prepare() { + pushd ../ || die + rm -rf "${S}/imgui" || die + mv "${P}" "${S}/imgui" || die + pushd "${S}/imgui" || die + + # imgui + rm -r examples/libs || die + rm -r misc/*/*.ttf || die + rm -r misc/single_file || die + + cp "${FILESDIR}/${P}-CMakeLists.txt" CMakeLists.txt || die + cp "${FILESDIR}/imgui.pc.in" imgui.pc.in || die + sed -e "s|@version@|${PV}|g" -i imgui.pc.in || die + + pushd "${S}" || die + cp "${FILESDIR}/c${P}-CMakeLists.txt" CMakeLists.txt || die + # remove files to be generated + rm cimgui.cpp cimgui.h generator/output/* || die + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DIMGUI_ALLEGRO=$(usex allegro) + -DIMGUI_BINDINGS=$(usex bindings) + -DIMGUI_EXAMPLES=$(usex examples) + -DIMGUI_FREETYPE=$(usex freetype) + -DIMGUI_GLFW=$(usex glfw) + -DIMGUI_GLUT=$(usex glut) + -DIMGUI_OPENGL=$(usex opengl) + -DIMGUI_SDL=$(usex sdl) + -DIMGUI_VULKAN=$(usex vulkan) + ) + cmake_src_configure +} + +src_install() { + + cmake_src_install + + pushd imgui || die + # imgui + rm -rf misc/{fonts,freetype} || die + dodoc -r misc + + popd || die + + if use bindings; then + # cimgui + + insinto "/usr/share/doc/${PF}/cimgui" + doins README.md TODO.txt + fi +} -- cgit v1.2.3-65-gdbad