diff options
Diffstat (limited to 'media-libs/imgui')
-rw-r--r-- | media-libs/imgui/files/cimgui-1.87-CMakeLists.txt | 80 | ||||
-rw-r--r-- | media-libs/imgui/files/cimgui-1.87-fix-cmake.patch | 69 | ||||
-rw-r--r-- | media-libs/imgui/files/imgui-1.87-CMakeLists.txt | 160 | ||||
-rw-r--r-- | media-libs/imgui/files/imgui.pc.in | 11 | ||||
-rw-r--r-- | media-libs/imgui/imgui-1.87-r2.ebuild | 251 | ||||
-rw-r--r-- | media-libs/imgui/imgui-1.87-r4.ebuild | 119 |
6 files changed, 370 insertions, 320 deletions
diff --git a/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt b/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt new file mode 100644 index 000000000..713125ec6 --- /dev/null +++ b/media-libs/imgui/files/cimgui-1.87-CMakeLists.txt @@ -0,0 +1,80 @@ +cmake_minimum_required(VERSION 3.1) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +project(cimgui) + +#general settings + +set(IMGUI_LIBRARIES ) +set(IMGUI_COMMON_FLAGS ) +set(GENERATOR_IMPL "internal") + +if(IMGUI_FREETYPE) + set(GENERATOR_IMPL "${GENERATOR_IMPL} freetype") + add_definitions("-DCIMGUI_FREETYPE=1") +endif(IMGUI_FREETYPE) + +add_subdirectory(imgui) + +if(IMGUI_BINDINGS) +add_library(cimgui SHARED "") +target_link_libraries(cimgui PUBLIC imgui ${IMGUI_LIBRARIES}) +target_compile_definitions(cimgui PUBLIC IMGUI_IMPL_API=extern\t\"C\"\t) +target_include_directories(cimgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/generator/output) +target_include_directories(cimgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/imgui) +set_target_properties(cimgui PROPERTIES LINKER_LANGUAGE CXX) + +set(GENERATOR_ARGS ) +if(IMGUI_ALLEGRO) + list(APPEND GENERATOR_ARGS allegro5) +endif() +if(IMGUI_GLFW) + list(APPEND GENERATOR_ARGS glfw) +endif() +if(IMGUI_GLUT) + list(APPEND GENERATOR_ARGS glut) +endif() +if(IMGUI_OPENGL) + list(APPEND GENERATOR_ARGS opengl2 opengl3) +endif() +if(IMGUI_SDL) + list(APPEND GENERATOR_ARGS sdl sdlrenderer) +endif() +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 + ${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 +) +ADD_CUSTOM_COMMAND(VERBATIM + OUTPUT ${GENERATOR_OUTPUT_FILES} + COMMAND luajit ./generator.lua gcc "${GENERATOR_IMPL}" ${GENERATOR_ARGS} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/generator" +) +set(CIMGUI_SOURCES "${CMAKE_SOURCE_DIR}/cimgui.cpp") +set(CIMGUI_INCLUDE_FILES "${CMAKE_SOURCE_DIR}/cimgui.h") + +target_sources(cimgui + PUBLIC + ${CIMGUI_SOURCES} + ${CIMGUI_INCLUDE_FILES} +) + +include(GNUInstallDirs) + +#install +install(TARGETS cimgui LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES ${CIMGUI_INCLUDE_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/imgui") + +#test +set(CIMGUI_TEST "no" CACHE STRING "Enable compilation of a test unit based on imgui null") + +if (CIMGUI_TEST) + add_subdirectory(test) +endif () +endif() diff --git a/media-libs/imgui/files/cimgui-1.87-fix-cmake.patch b/media-libs/imgui/files/cimgui-1.87-fix-cmake.patch deleted file mode 100644 index b3bae1cfe..000000000 --- a/media-libs/imgui/files/cimgui-1.87-fix-cmake.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,21 +1,13 @@ - cmake_minimum_required(VERSION 3.1) - --project(cimgui) -+project(libcimgui) - --if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/imgui/imgui_tables.cpp) -- set(TABLES_SOURCE "imgui/imgui_tables.cpp") --else() - set(TABLES_SOURCE "") --endif() - - - #general settings - file(GLOB IMGUI_SOURCES - cimgui.cpp -- imgui/imgui.cpp -- imgui/imgui_draw.cpp -- imgui/imgui_demo.cpp -- imgui/imgui_widgets.cpp - ${TABLES_SOURCE} - ) - -@@ -24,34 +16,30 @@ - set(IMGUI_LIBRARIES ) - - if(IMGUI_FREETYPE) -- FIND_PACKAGE(freetype REQUIRED PATHS ${FREETYPE_PATH}) -- list(APPEND IMGUI_LIBRARIES freetype) -- list(APPEND IMGUI_SOURCES imgui/misc/freetype/imgui_freetype.cpp) -+ list(APPEND IMGUI_LIBRARIES -lfreetype) - add_definitions("-DCIMGUI_FREETYPE=1") - endif(IMGUI_FREETYPE) - - #add library and link - if (IMGUI_STATIC) -- add_library(cimgui STATIC ${IMGUI_SOURCES}) -+ add_library(libcimgui STATIC ${IMGUI_SOURCES}) - else (IMGUI_STATIC) -- add_library(cimgui SHARED ${IMGUI_SOURCES}) -+ add_library(libcimgui SHARED ${IMGUI_SOURCES}) - endif (IMGUI_STATIC) - --target_compile_definitions(cimgui PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1) - if (WIN32) -- target_compile_definitions(cimgui PUBLIC IMGUI_IMPL_API=extern\t\"C\"\t__declspec\(dllexport\)) -+ target_compile_definitions(libcimgui PUBLIC IMGUI_IMPL_API=extern\t\"C\"\t__declspec\(dllexport\)) - list(APPEND IMGUI_LIBRARIES imm32) - else (WIN32) -- target_compile_definitions(cimgui PUBLIC IMGUI_IMPL_API=extern\t\"C\"\t) -+ target_compile_definitions(libcimgui PUBLIC IMGUI_IMPL_API=extern\t\"C\"\t) - endif (WIN32) - --target_include_directories(cimgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) --target_include_directories(cimgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/imgui) --set_target_properties(cimgui PROPERTIES PREFIX "") --target_link_libraries(cimgui ${IMGUI_LIBRARIES}) -+target_include_directories(libcimgui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/imgui) -+set_target_properties(libcimgui PROPERTIES PREFIX "") -+target_link_libraries(libcimgui PUBLIC -limgui) - - #install --install(TARGETS cimgui -+install(TARGETS libcimgui - RUNTIME DESTINATION . - LIBRARY DESTINATION . - ARCHIVE DESTINATION . diff --git a/media-libs/imgui/files/imgui-1.87-CMakeLists.txt b/media-libs/imgui/files/imgui-1.87-CMakeLists.txt new file mode 100644 index 000000000..0823d1dc3 --- /dev/null +++ b/media-libs/imgui/files/imgui-1.87-CMakeLists.txt @@ -0,0 +1,160 @@ +cmake_minimum_required(VERSION 3.8.2) +project(imgui VERSION 1.73.0 LANGUAGES CXX C) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +include(GNUInstallDirs) + +option(IMGUI_ALLEGRO OFF) +option(IMGUI_EXAMPLES "Build ImGui examples" OFF) +option(IMGUI_FREETYPE OFF) +option(IMGUI_GLFW OFF) +option(IMGUI_GLUT OFF) +option(IMGUI_OPENGL OFF) +option(IMGUI_SDL OFF) +option(IMGUI_VULKAN OFF) + +add_library (imgui_objects + OBJECT + imgui.cpp + imgui_demo.cpp + imgui_draw.cpp + imgui_tables.cpp + imgui_widgets.cpp +) +add_library (imgui SHARED "") +target_include_directories(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") +#set(IMGUI_COMMON_FLAGS "-DIMGUI_USE_WCHAR32 -DIMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION -DIMGUI_STB_RECT_PACK_FILENAME=\"<stb/stb_rect_pack.h>\"") +set(IMGUI_COMMON_FLAGS "-DIMGUI_USE_WCHAR32") + +if(IMGUI_ALLEGRO) + find_package(PkgConfig REQUIRED) + pkg_check_modules(ALLEGRO5 REQUIRED allegro-5 allegro_main-5 allegro_primitives-5) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_allegro5.cpp") + target_include_directories(imgui_objects PUBLIC ${ALLEGRO5_INCLUDE_DIRS}) + list(APPEND IMGUI_LIBRARIES ${ALLEGRO5_LIBRARIES}) +endif() +if(IMGUI_FREETYPE) + find_package(Freetype REQUIRED) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.cpp") + target_include_directories(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype" ${FREETYPE_INCLUDE_DIRS}) + list(APPEND IMGUI_LIBRARIES ${FREETYPE_LIBRARIES}) +# set(IMGUI_COMMON_FLAGS "${IMGUI_COMMON_FLAGS} -DIMGUI_ENABLE_FREETYPE -DIMGUI_ENABLE_STB_TRUETYPE -DIMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION -DIMGUI_STB_TRUETYPE_FILENAME=\"<stb/stb_truetype.h>\"") + set(IMGUI_COMMON_FLAGS "${IMGUI_COMMON_FLAGS} -DIMGUI_ENABLE_FREETYPE -DIMGUI_ENABLE_STB_TRUETYPE") + add_executable(binary_to_compressed_c "${CMAKE_CURRENT_SOURCE_DIR}/misc/fonts/binary_to_compressed_c.cpp") + target_include_directories(binary_to_compressed_c PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") + target_link_libraries(binary_to_compressed_c PUBLIC imgui) + install(TARGETS binary_to_compressed_c DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui") +endif() +if(IMGUI_GLFW) + find_package(glfw3 REQUIRED) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glfw.cpp") + list(APPEND IMGUI_LIBRARIES glfw) +endif() +if(IMGUI_GLUT) + find_package(FreeGLUT REQUIRED) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glut.cpp") + target_include_directories(imgui_objects PUBLIC ${FreeGLUT_INCLUDE_DIRS}) + list(APPEND IMGUI_LIBRARIES FreeGLUT::freeglut) +endif() +if(IMGUI_OPENGL) + find_package(OpenGL REQUIRED) + target_sources(imgui_objects + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl2.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp" + ) + target_include_directories(imgui_objects PUBLIC ${OPENGL_INCLUDE_DIR}) + list(APPEND IMGUI_LIBRARIES ${OPENGL_gl_LIBRARY}) +endif() +if(IMGUI_SDL) + find_package(SDL2 REQUIRED) + target_sources(imgui_objects + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdl.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdlrenderer.cpp" + ) + target_include_directories(imgui_objects PUBLIC "${SDL2_INCLUDE_DIRS}") + list(APPEND IMGUI_LIBRARIES "${SDL2_LIBRARIES}") +endif() +if(IMGUI_VULKAN) + find_package(Vulkan REQUIRED) + target_sources(imgui_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp") + set(IMGUI_COMMON_FLAGS "${IMGUI_COMMON_FLAGS} -DImTextureID=ImU64") + target_include_directories(imgui_objects PUBLIC ${Vulkan_INCLUDE_DIRS}) + list(APPEND IMGUI_LIBRARIES Vulkan::Vulkan) +endif() + +if(IMGUI_EXAMPLES) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples" DESTINATION "${CMAKE_INSTALL_DOCDIR}") + add_executable(example_null "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_null/main.cpp") + target_include_directories(example_null PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") + target_link_libraries(example_null PUBLIC imgui) + install(TARGETS example_null DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + if(IMGUI_ALLEGRO) + add_executable(example_allegro5 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_allegro5/main.cpp") + target_include_directories(example_allegro5 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_allegro5 PUBLIC imgui) + install(TARGETS example_allegro5 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_GLFW AND IMGUI_OPENGL) + add_executable(example_glfw_opengl2 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_glfw_opengl2/main.cpp") + target_include_directories(example_glfw_opengl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_glfw_opengl2 PUBLIC imgui) + install(TARGETS example_allegro5 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + add_executable(example_glfw_opengl3 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_glfw_opengl3/main.cpp") + target_include_directories(example_glfw_opengl3 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_glfw_opengl3 PUBLIC imgui) + install(TARGETS example_glfw_opengl3 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_GLFW AND IMGUI_VULKAN) + add_executable(example_glfw_vulkan "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_glfw_vulkan/main.cpp") + target_include_directories(example_glfw_vulkan PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_glfw_vulkan PUBLIC imgui) + install(TARGETS example_glfw_vulkan DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_GLUT AND IMGUI_OPENGL) + add_executable(example_glut_opengl2 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_glut_opengl2/main.cpp") + target_include_directories(example_glut_opengl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends") + target_link_libraries(example_glut_opengl2 PUBLIC imgui) + install(TARGETS example_glut_opengl2 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_SDL) + add_executable(example_sdl_sdlrenderer "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_sdl_sdlrenderer/main.cpp") + target_include_directories(example_sdl_sdlrenderer PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends" "${SDL2_INCLUDE_DIRS}") + target_link_libraries(example_sdl_sdlrenderer PUBLIC imgui) + install(TARGETS example_sdl_sdlrenderer DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + if(IMGUI_OPENGL) + add_executable(example_sdl_opengl2 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_sdl_opengl2/main.cpp") + target_include_directories(example_sdl_opengl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends" "${SDL2_INCLUDE_DIRS}") + target_link_libraries(example_sdl_opengl2 PUBLIC imgui) + install(TARGETS example_sdl_opengl2 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + add_executable(example_sdl_opengl3 "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_sdl_opengl3/main.cpp") + target_include_directories(example_sdl_opengl3 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends" "${SDL2_INCLUDE_DIRS}") + target_link_libraries(example_sdl_opengl3 PUBLIC imgui) + install(TARGETS example_sdl_opengl2 DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + if(IMGUI_VULKAN) + add_executable(example_sdl_vulkan "${CMAKE_CURRENT_SOURCE_DIR}/examples/example_sdl_vulkan/main.cpp") + target_include_directories(example_sdl_vulkan PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/backends" "${SDL2_INCLUDE_DIRS}") + target_link_libraries(example_sdl_vulkan PUBLIC imgui) + install(TARGETS example_sdl_vulkan DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/imgui/examples" ) + endif() + endif() +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IMGUI_COMMON_FLAGS} -fpermissive") +target_sources (imgui PUBLIC $<TARGET_OBJECTS:imgui_objects>) + +add_library(imgui::imgui ALIAS imgui) +target_link_libraries(imgui PUBLIC ${IMGUI_LIBRARIES}) + +file(GLOB IMGUI_INCLUDE_FILES "*.h" "backends/*.h" "misc/freetype/*.h") +install(FILES ${IMGUI_INCLUDE_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/imgui") +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/backends/vulkan" DESTINATION "${CMAKE_INSTALL_DATADIR}/imgui/backends") +file(GLOB IMGUI_DOC_FILES "docs/*") +install(FILES ${IMGUI_DOC_FILES} DESTINATION "${CMAKE_INSTALL_DOCDIR}") +install(TARGETS imgui) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/imgui.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/imgui.pc" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/imgui.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +set(IMGUI_COMMON_FLAGS "${IMGUI_COMMON_FLAGS}" PARENT_SCOPE) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE) diff --git a/media-libs/imgui/files/imgui.pc.in b/media-libs/imgui/files/imgui.pc.in new file mode 100644 index 000000000..4d033939f --- /dev/null +++ b/media-libs/imgui/files/imgui.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/imgui + +Name: imgui +Description: Bloat-free Immediate Mode Graphical User interface for C +Version: @version@ +URL: https://github.com/ocornut/imgui +Libs: -L${libdir} -limgui @IMGUI_LIBRARIES@ +Libs.private: -lm +Cflags: -I${includedir} diff --git a/media-libs/imgui/imgui-1.87-r2.ebuild b/media-libs/imgui/imgui-1.87-r2.ebuild deleted file mode 100644 index 0df42793d..000000000 --- a/media-libs/imgui/imgui-1.87-r2.ebuild +++ /dev/null @@ -1,251 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit cmake flag-o-matic toolchain-funcs - -CMAKE_IN_SOURCE_BUILD=1 - -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}.tar.gz - https://github.com/cimgui/cimgui/archive/refs/tags/${PV}.tar.gz -> c${P}.tar.gz -" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="~amd64" -IUSE="allegro bindings examples freetype glfw glut opengl sdl vulkan" -S="${WORKDIR}/c${P}" - -RDEPEND=" - 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 -" - -PATCHES=( "${FILESDIR}/c${P}-fix-cmake.patch" ) -REQUIRED_USE=" - || ( - allegro - glfw - glut - sdl - ) - || ( - allegro - opengl - vulkan - ) - examples? ( - allegro - glfw - glut - opengl - sdl - vulkan - ) -" - -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 - - # cimgui - if use bindings; then - pushd "${S}" || die - cmake_src_prepare - else - eapply_user - fi -} - -src_configure() { - pushd imgui || die - - # imgui - tc-export CXX - append-cppflags "-DIMGUI_USE_WCHAR32" - COMMONFLAGS="-I${S}/imgui -I${S}/imgui/backends -I${S}/imgui/misc/freetype -fPIC -fpermissive" - local PKGCONF="$(tc-getPKG_CONFIG)" || die - - use allegro && append-libs "-lallegro -lallegro_main -lallegro_primitives" - if use freetype; then - append-cppflags "-DIMGUI_ENABLE_FREETYPE -DIMGUI_ENABLE_STB_TRUETYPE" - COMMONFLAGS="${COMMONFLAGS} $(${PKGCONF} --cflags freetype2)" || die - append-libs "$(${PKGCONF} --libs freetype2)" || die - fi - if use glfw; then - append-libs "$(${PKGCONF} --libs glfw3)" || die - COMMONFLAGS="${COMMONFLAGS} $(${PKGCONF} --cflags glfw3)" || die - fi - if use glut; then - append-libs "$(${PKGCONF} --libs freeglut)" || die - COMMONFLAGS="${COMMONFLAGS} $(${PKGCONF} --cflags freeglut)" || die - fi - use opengl && append-libs "-lGL" - if use sdl; then - append-libs "-ldl $(sdl2-config --libs)" || die - COMMONFLAGS="${COMMONFLAGS} $(sdl2-config --cflags)" || die - fi - if use vulkan; then - append-libs "$(${PKGCONF} --libs vulkan)" || die - COMMONFLAGS="${COMMONFLAGS} $(${PKGCONF} --cflags vulkan)" || die - append-cppflags "-DImTextureID=ImU64" || die - fi - append-cxxflags "${COMMONFLAGS}" - popd || die - - # cimgui - if use bindings; then - local mycmakeargs=( - -DIMGUI_FREETYPE=$(usex freetype) - -DIMGUI_STATIC=OFF - ) - cmake_src_configure - fi -} - -src_compile() { - pushd imgui || die - - # imgui - set -x || die - - local objects=() - - for i in imgui{,_draw,_demo,_tables,_widgets}; do - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c ${i}.cpp -o ${i}.o || die - objects+=( ${i}.o ) - done - - if use freetype; then - pushd misc/freetype || die - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_freetype.cpp -o imgui_freetype.o || die - objects+=( misc/freetype/imgui_freetype.o ) - popd || die - pushd misc/fonts || die - ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} -fPIE binary_to_compressed_c.cpp -o binary_to_compressed_c || die - popd || die - fi - - pushd backends || die - if use allegro; then - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_impl_allegro5.cpp -o imgui_impl_allegro5.o || die - objects+=( backends/imgui_impl_allegro5.o ) - fi - if use glfw; then - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_impl_glfw.cpp -o imgui_impl_glfw.o || die - objects+=( backends/imgui_impl_glfw.o ) - fi - if use glut; then - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_impl_glut.cpp -o imgui_impl_glut.o || die - objects+=( backends/imgui_impl_glut.o ) - fi - if use opengl; then - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_impl_opengl2.cpp -o imgui_impl_opengl2.o || die - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_impl_opengl3.cpp -o imgui_impl_opengl3.o || die - objects+=( backends/imgui_impl_opengl2.o backends/imgui_impl_opengl3.o ) - fi - if use sdl; then - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_impl_sdl.cpp -o imgui_impl_sdl.o || die - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_impl_sdlrenderer.cpp -o imgui_impl_sdlrenderer.o || die - objects+=( backends/imgui_impl_sdl.o backends/imgui_impl_sdlrenderer.o ) - fi - if use vulkan; then - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -fPIC -c imgui_impl_vulkan.cpp -o imgui_impl_vulkan.o || die - objects+=( backends/imgui_impl_vulkan.o ) - fi - popd || die - ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} -shared -Wl,-soname,libimgui.so ${objects[@]} -o libimgui.so ${LIBS} || die - - if use examples; then - mkdir ex || die - for f in allegro5 glfw_opengl{2,3} glfw_vulkan null sdl_opengl{2,3} sdl_{sdlrenderer,vulkan} glut_opengl2 ; do - ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} -fPIE examples/example_${f}/main.cpp "-L${S}/imgui" -limgui ${LIBS} -o "${S}/imgui/ex/example_${f}" || die - done - fi - - set +x || die - popd || die - - # cimgui - if use bindings; then - pushd generator || die - local myargs=() - use allegro && myargs+=( allegro5 ) - use glfw && myargs+=( glfw ) - use glut && myargs+=( glut ) - use opengl && myargs+=( opengl3 opengl2 ) - use sdl && myargs+=( sdl sdlrenderer ) - use vulkan && myargs+=( vulkan ) - myargs+=( ${CFLAGS} ${COMMONFLAGS} ${CPPFLAGS} ) - - if use freetype ; then - luajit ./generator.lua gcc "internal freetype" ${myargs[@]} || die - else - luajit ./generator.lua gcc "internal" ${myargs[@]} || die - fi - popd || die - cmake_src_compile - fi -} - -src_install() { - pushd imgui || die - - # imgui - dolib.so libimgui.so - dodoc docs/* - insinto "/usr/include/imgui" - doins *.h - doins -r misc/*/*.h - doins backends/*.h - insinto "/usr/share/${PN}/backends" - doins -r backends/vulkan - exeinto "/usr/libexec/${PN}" - use freetype && doexe misc/fonts/binary_to_compressed_c - rm -rf misc/{fonts,freetype} || die - dodoc -r misc - - if use examples; then - exeinto "/usr/libexec/${PN}/examples" - doexe ex/* - dodoc -r examples - docompress -x "/usr/share/doc/${PF}/examples" - fi - - popd || die - - # cimgui - if use bindings; then - dolib.so libcimgui.so - insinto "/usr/share/doc/${PF}/cimgui" - doins README.md TODO.txt - doheader cimgui.h - fi -} diff --git a/media-libs/imgui/imgui-1.87-r4.ebuild b/media-libs/imgui/imgui-1.87-r4.ebuild new file mode 100644 index 000000000..7bb3f6e42 --- /dev/null +++ b/media-libs/imgui/imgui-1.87-r4.ebuild @@ -0,0 +1,119 @@ +# Copyright 1999-2022 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}.tar.gz + https://github.com/cimgui/cimgui/archive/refs/tags/${PV}.tar.gz -> c${P}.tar.gz +" + +LICENSE="MIT" +SLOT="0" +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 + ) + examples? ( + allegro + glfw + glut + opengl + sdl + vulkan + ) +" + +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 || 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 +} |