From 1a4cc954d2fcea172a450ae03419b7fdda28b81e Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Tue, 27 Nov 2018 22:06:49 -0500 Subject: [PATCH] gnu: Add imgui. * gnu/packages/toolkits.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Register it. --- gnu/local.mk | 1 + gnu/packages/toolkits.scm | 104 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 gnu/packages/toolkits.scm diff --git a/gnu/local.mk b/gnu/local.mk index f14daf2edd..360d3fc47f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -582,6 +582,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/time.scm \ %D%/packages/tls.scm \ %D%/packages/tmux.scm \ + %D%/packages/toolkits.scm \ %D%/packages/tor.scm \ %D%/packages/tv.scm \ %D%/packages/uglifyjs.scm \ diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm new file mode 100644 index 0000000000..e980438ca9 --- /dev/null +++ b/gnu/packages/toolkits.scm @@ -0,0 +1,104 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Maxim Cournoyer +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages toolkits) + #:use-module (gnu packages gl) + #:use-module (gnu packages sdl) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix build-system gnu) + #:use-module (guix git-download)) + +(define-public imgui + (package + (name "imgui") + (version "1.86") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ocornut/imgui") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Contains fonts and other unneeded files. + (delete-file-recursively "misc"))))) + (outputs '("out" "doc")) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ;no test suite + #:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 ftw) + (srfi srfi-26)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'adjust-includes + (lambda _ + (substitute* (find-files "." "(\\.cpp|\\.mm)$") + (("#include )) + (imgui-headers (scandir "." header?)) + (backend-headers (find-files + "backends" + "(glfw|opengl|sdl|vulkan).*\\.h$"))) + (install-file "libimgui.so" (string-append out "/lib")) + ;; Install headers. + (for-each (lambda (f) + (install-file f (string-append out "/include/imgui"))) + imgui-headers) + (for-each (lambda (f) + (install-file f (string-append + out "/include/imgui/backends"))) + backend-headers) + ;; Install examples. + (copy-recursively + "examples" (string-append + doc "/share/imgui/examples")))))))) + (inputs (list glfw mesa sdl2)) + (home-page "https://github.com/ocornut/imgui") + (synopsis "Graphical user interface library for C++") + (description "@code{dear imgui} (also know as ImGui) is a graphical user +interface library for C++. It outputs vertex buffers that can be rendered in +a 3D application. It is fast, renderer agnostic and self-contained.") + (license license:expat)))