diff options
author | Steven Voges <svoges.sbo@gmail.com> | 2022-09-02 01:39:12 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2022-09-03 17:58:44 +0700 |
commit | b1853f642faf1504f142d8b99943fca7ad906ff9 (patch) | |
tree | 591e65144caba8bf312c7eefba710db6a3385a13 | |
parent | ec3b9ff9b90b1c6df3e46c2c679f2683dcfea3d6 (diff) |
libraries/imgui: Added (C++ GUI)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | libraries/imgui/CMakeLists.txt | 230 | ||||
-rw-r--r-- | libraries/imgui/README | 27 | ||||
-rw-r--r-- | libraries/imgui/imgui-config.cmake.in | 27 | ||||
-rw-r--r-- | libraries/imgui/imgui.SlackBuild | 110 | ||||
-rw-r--r-- | libraries/imgui/imgui.info | 10 | ||||
-rw-r--r-- | libraries/imgui/slack-desc | 19 |
6 files changed, 423 insertions, 0 deletions
diff --git a/libraries/imgui/CMakeLists.txt b/libraries/imgui/CMakeLists.txt new file mode 100644 index 0000000000000..85544830c0309 --- /dev/null +++ b/libraries/imgui/CMakeLists.txt @@ -0,0 +1,230 @@ +cmake_minimum_required(VERSION 3.16) +project(imgui CXX) + +set(CMAKE_DEBUG_POSTFIX d) + +if(APPLE) + set(CMAKE_CXX_STANDARD 11) + enable_language(OBJCXX) +endif() + +add_library(${PROJECT_NAME} "") +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) +target_include_directories( + ${PROJECT_NAME} + PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> + $<INSTALL_INTERFACE:include> +) + +target_sources( + ${PROJECT_NAME} + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/imgui.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/imgui_demo.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/imgui_draw.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/imgui_tables.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/imgui_widgets.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp +) + +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) + +if(IMGUI_BUILD_ALLEGRO5_BINDING) + find_path(ALLEGRO5_INCLUDE_DIRS allegro5/allegro.h) + target_include_directories(${PROJECT_NAME} PRIVATE ${ALLEGRO5_INCLUDE_DIRS}) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_allegro5.cpp) +endif() + +if(IMGUI_BUILD_DX9_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx9.cpp) +endif() + +if(IMGUI_BUILD_DX10_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx10.cpp) +endif() + +if(IMGUI_BUILD_DX11_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx11.cpp) +endif() + +if(IMGUI_BUILD_DX12_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx12.cpp) +endif() + +if(IMGUI_BUILD_GLFW_BINDING) + find_package(glfw3 CONFIG REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC glfw) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glfw.cpp) +endif() + +if(IMGUI_BUILD_GLUT_BINDING) + find_package(GLUT REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC GLUT::GLUT) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glut.cpp) +endif() + +if(IMGUI_BUILD_METAL_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_metal.mm) + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_metal.mm PROPERTIES COMPILE_FLAGS -fobjc-weak) +endif() + +if(IMGUI_BUILD_OPENGL2_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl2.cpp) +endif() + +if(IMGUI_BUILD_OPENGL3_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp) +endif() + +if(IMGUI_BUILD_OSX_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_osx.mm) +endif() + +if(IMGUI_BUILD_SDL2_BINDING) + find_package(SDL2 CONFIG REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdl.cpp) +endif() + +if(IMGUI_BUILD_SDL2_RENDERER_BINDING) + find_package(SDL2 CONFIG REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdlrenderer.cpp) +endif() + +if(IMGUI_BUILD_VULKAN_BINDING) + find_package(Vulkan REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC Vulkan::Vulkan) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp) +endif() + +if(IMGUI_BUILD_WIN32_BINDING) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_win32.cpp) +endif() + +if(IMGUI_FREETYPE) + find_package(freetype CONFIG REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC freetype) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.cpp) + target_compile_definitions(${PROJECT_NAME} PUBLIC IMGUI_ENABLE_FREETYPE) +endif() + +if(IMGUI_USE_WCHAR32) + target_compile_definitions(${PROJECT_NAME} PUBLIC IMGUI_USE_WCHAR32) +endif() + +list(REMOVE_DUPLICATES BINDINGS_SOURCES) + +install( + TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}_target + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + +foreach(BINDING_TARGET ${BINDING_TARGETS}) + install( + TARGETS ${BINDING_TARGET} + EXPORT ${PROJECT_NAME}_target + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) +endforeach() + +if(NOT IMGUI_SKIP_HEADERS) + install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/imgui.h + ${CMAKE_CURRENT_SOURCE_DIR}/imconfig.h + ${CMAKE_CURRENT_SOURCE_DIR}/imgui_internal.h + ${CMAKE_CURRENT_SOURCE_DIR}/imstb_textedit.h + ${CMAKE_CURRENT_SOURCE_DIR}/imstb_rectpack.h + ${CMAKE_CURRENT_SOURCE_DIR}/imstb_truetype.h + ${CMAKE_CURRENT_SOURCE_DIR}/misc/cpp/imgui_stdlib.h + DESTINATION include + ) + + if(IMGUI_BUILD_ALLEGRO5_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_allegro5.h DESTINATION include) + endif() + + if(IMGUI_BUILD_DX9_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx9.h DESTINATION include) + endif() + + if(IMGUI_BUILD_DX10_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx10.h DESTINATION include) + endif() + + if(IMGUI_BUILD_DX11_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx11.h DESTINATION include) + endif() + + if(IMGUI_BUILD_DX12_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx12.h DESTINATION include) + endif() + + if(IMGUI_BUILD_GLFW_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glfw.h DESTINATION include) + endif() + + if(IMGUI_BUILD_GLUT_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glut.h DESTINATION include) + endif() + + if(IMGUI_BUILD_METAL_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_metal.h DESTINATION include) + endif() + + if(IMGUI_BUILD_OPENGL2_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl2.h DESTINATION include) + endif() + + if(IMGUI_BUILD_OPENGL3_BINDING) + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl3.h + ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl3_loader.h + DESTINATION + include + ) + endif() + + if(IMGUI_BUILD_OSX_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_osx.h DESTINATION include) + endif() + + if(IMGUI_BUILD_SDL2_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdl.h DESTINATION include) + endif() + + if(IMGUI_BUILD_SDL2_RENDERER_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdlrenderer.h DESTINATION include) + endif() + + if(IMGUI_BUILD_VULKAN_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_vulkan.h DESTINATION include) + endif() + + if(IMGUI_BUILD_WIN32_BINDING) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_win32.h DESTINATION include) + endif() + + if(IMGUI_FREETYPE) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.h DESTINATION include) + endif() +endif() + +include(CMakePackageConfigHelpers) +configure_package_config_file(imgui-config.cmake.in imgui-config.cmake INSTALL_DESTINATION share/imgui) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/imgui-config.cmake DESTINATION share/imgui) + +install( + EXPORT ${PROJECT_NAME}_target + NAMESPACE ${PROJECT_NAME}:: + FILE ${PROJECT_NAME}-targets.cmake + DESTINATION share/${PROJECT_NAME} +) diff --git a/libraries/imgui/README b/libraries/imgui/README new file mode 100644 index 0000000000000..dbffc9e81c49c --- /dev/null +++ b/libraries/imgui/README @@ -0,0 +1,27 @@ +Dear ImGui is a bloat-free graphical user interface library for C++. +It outputs optimized vertex buffers that you can render anytime in +your 3D-pipeline enabled application. It is fast, portable, renderer +agnostic and self-contained (no external dependencies). + +Dear ImGui is designed to enable fast iterations and to empower +programmers to create content creation tools and visualization / debug +tools (as opposed to UI for the average end-user). It favors +simplicity and productivity toward this goal, and lacks certain +features normally found in more high-level libraries. + +Dear ImGui is particularly suited to integration in games engine (for +tooling), real-time 3D applications, fullscreen applications, embedded +applications, or any applications on consoles platforms where +operating system features are non-standard. + + * Minimize state synchronization. + * Minimize state storage on user side. + * Minimize setup and maintenance. + * Easy to use to create code-driven and data-driven tools. + * Easy to use to create ad hoc short-lived tools and long-lived, + more elaborate tools. + * Easy to hack and improve. + * Portable, minimize dependencies, run on target (consoles, phones, + etc.). + * Efficient runtime and memory consumption. + * Battle-tested, used by many major actors in the game industry. diff --git a/libraries/imgui/imgui-config.cmake.in b/libraries/imgui/imgui-config.cmake.in new file mode 100644 index 0000000000000..1ea694a10beb4 --- /dev/null +++ b/libraries/imgui/imgui-config.cmake.in @@ -0,0 +1,27 @@ +cmake_policy(SET CMP0012 NEW)
+
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+
+if (@IMGUI_BUILD_GLFW_BINDING@)
+ find_dependency(glfw3 CONFIG)
+endif()
+
+if (@IMGUI_BUILD_GLUT_BINDING@)
+ find_dependency(GLUT)
+endif()
+
+if (@IMGUI_BUILD_SDL2_BINDING@ OR @IMGUI_BUILD_SDL2_RENDERER_BINDING@)
+ find_dependency(SDL2 CONFIG)
+endif()
+
+if (@IMGUI_BUILD_VULKAN_BINDING@)
+ find_dependency(Vulkan)
+endif()
+
+if (@IMGUI_FREETYPE@)
+ find_dependency(freetype CONFIG)
+endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/imgui-targets.cmake")
diff --git a/libraries/imgui/imgui.SlackBuild b/libraries/imgui/imgui.SlackBuild new file mode 100644 index 0000000000000..3a823974cf467 --- /dev/null +++ b/libraries/imgui/imgui.SlackBuild @@ -0,0 +1,110 @@ +#!/bin/bash + +# Slackware build script for imgui + +# Copyright 2022 Steven Voges <Oregon, USA> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=imgui +VERSION=${VERSION:-1.88} +BUILD=${BUILD:-2} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +cp $CWD/CMakeLists.txt . +cp $CWD/imgui-config.cmake.in . +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +mkdir -p build +cd build + cmake \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release .. + make + make install/strip DESTDIR=$PKG +cd .. + +if [ "$LIBDIRSUFFIX" != "" ]; then + mv $PKG/usr/lib $PKG/usr/lib${LIBDIRSUFFIX} + sed -i "s/\/lib\//\/lib${LIBDIRSUFFIX}\//g" $PKG/usr/share/$PRGNAM/$PRGNAM-targets-release.cmake +fi + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + LICENSE.txt docs/* \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/libraries/imgui/imgui.info b/libraries/imgui/imgui.info new file mode 100644 index 0000000000000..12efac0a57803 --- /dev/null +++ b/libraries/imgui/imgui.info @@ -0,0 +1,10 @@ +PRGNAM="imgui" +VERSION="1.88" +HOMEPAGE="https://github.com/ocornut/imgui" +DOWNLOAD="https://github.com/ocornut/imgui/archive/v1.88/imgui-1.88.tar.gz" +MD5SUM="c1ccd7123bc6879bfd4760e731d1e0d0" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Steven Voges" +EMAIL="svoges.sbo@gmail.com" diff --git a/libraries/imgui/slack-desc b/libraries/imgui/slack-desc new file mode 100644 index 0000000000000..06c0f256fe128 --- /dev/null +++ b/libraries/imgui/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +imgui: imgui (C++ GUI) +imgui: +imgui: "Dear ImGui" is a Bloat-free Graphical User interface for C++ with +imgui: minimal dependencies +imgui: +imgui: Homepage: https://github.com/ocornut/imgui +imgui: +imgui: +imgui: +imgui: +imgui: |