2018-11-28 03:06:49 +00:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2023-04-01 21:35:23 +00:00
|
|
|
;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2022-07-24 00:00:01 +00:00
|
|
|
;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
|
2023-06-28 00:43:44 +00:00
|
|
|
;;; Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
|
2018-11-28 03:06:49 +00:00
|
|
|
;;;
|
|
|
|
;;; 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(define-module (gnu packages toolkits)
|
2022-03-21 19:10:54 +00:00
|
|
|
#:use-module (gnu packages fontutils)
|
2018-11-28 03:06:49 +00:00
|
|
|
#:use-module (gnu packages gl)
|
|
|
|
#:use-module (gnu packages sdl)
|
2022-03-21 19:10:54 +00:00
|
|
|
#:use-module (guix gexp)
|
2018-11-28 03:06:49 +00:00
|
|
|
#: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")
|
2023-09-26 15:30:16 +00:00
|
|
|
(version "1.89.9")
|
2018-11-28 03:06:49 +00:00
|
|
|
(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
|
2023-09-26 15:30:16 +00:00
|
|
|
"0db11pin6kdzyd07dnwch8sf0z3386h42ibki1lnzb2ln8m66kyj"))
|
2018-11-28 03:06:49 +00:00
|
|
|
(modules '((guix build utils)))
|
|
|
|
(snippet
|
2022-03-21 19:10:54 +00:00
|
|
|
;; Remove bundled fonts.
|
|
|
|
'(delete-file-recursively "misc/fonts"))))
|
2018-11-28 03:06:49 +00:00
|
|
|
(outputs '("out" "doc"))
|
|
|
|
(build-system gnu-build-system)
|
|
|
|
(arguments
|
2022-03-21 19:10:54 +00:00
|
|
|
(list
|
|
|
|
#:tests? #f ;no test suite
|
|
|
|
#:modules '((guix build gnu-build-system)
|
2018-11-28 03:06:49 +00:00
|
|
|
(guix build utils)
|
|
|
|
(ice-9 ftw)
|
|
|
|
(srfi srfi-26))
|
2023-06-28 00:43:44 +00:00
|
|
|
;; The build phase does not use make but we will use make-flags in a
|
|
|
|
;; similar fashion to make inheritance for older imgui versions easier.
|
|
|
|
#:make-flags
|
|
|
|
;; This first option is necessary at least for OpenBoardView, otherwise
|
|
|
|
;; it would fail with the "Too many vertices in ImDrawList using 16-bit
|
|
|
|
;; indices".
|
|
|
|
#~(list "-DImDrawIdx=unsigned int"
|
2023-09-26 01:15:42 +00:00
|
|
|
"-DIMGUI_ENABLE_FREETYPE"
|
2023-06-28 00:43:44 +00:00
|
|
|
"-I" (string-append (getcwd) "/source")
|
|
|
|
"-I" (search-input-directory %build-inputs "include/freetype2")
|
|
|
|
"-g" "-O2" "-fPIC" "-shared"
|
|
|
|
"-lGL" "-lSDL2" "-lglfw"
|
|
|
|
"-o" "libimgui.so")
|
2022-03-21 19:10:54 +00:00
|
|
|
#:phases
|
|
|
|
#~(modify-phases %standard-phases
|
|
|
|
(add-after 'unpack 'adjust-includes
|
|
|
|
(lambda _
|
|
|
|
(substitute* (find-files "." "(\\.cpp|\\.mm)$")
|
|
|
|
(("#include <SDL")
|
|
|
|
"#include <SDL2/SDL"))))
|
|
|
|
(delete 'configure)
|
|
|
|
(replace 'build
|
2023-06-28 00:43:44 +00:00
|
|
|
(lambda* (#:key make-flags #:allow-other-keys)
|
2022-03-21 19:10:54 +00:00
|
|
|
;; Build main library.
|
2023-04-01 14:47:12 +00:00
|
|
|
(apply invoke #$(cc-for-target)
|
2023-06-28 00:43:44 +00:00
|
|
|
(append make-flags
|
|
|
|
`("imgui.cpp"
|
|
|
|
"imgui_draw.cpp"
|
|
|
|
"imgui_tables.cpp"
|
|
|
|
"imgui_widgets.cpp"
|
|
|
|
;; Include the supported backends.
|
|
|
|
"backends/imgui_impl_glfw.cpp"
|
|
|
|
,(if (file-exists? "backends/imgui_impl_sdl2.cpp")
|
|
|
|
"backends/imgui_impl_sdl2.cpp"
|
|
|
|
"backends/imgui_impl_sdl.cpp")
|
|
|
|
"backends/imgui_impl_opengl2.cpp"
|
|
|
|
"backends/imgui_impl_opengl3.cpp"
|
|
|
|
;; Include wrappers for C++ standard library (STL) and
|
|
|
|
;; fontconfig.
|
|
|
|
,@(find-files "misc" "\\.cpp$"))))))
|
2022-03-21 19:10:54 +00:00
|
|
|
(replace 'install
|
2023-04-01 21:28:09 +00:00
|
|
|
(lambda _
|
|
|
|
(let* ((header? (cut string-suffix? ".h" <>))
|
2022-03-21 19:10:54 +00:00
|
|
|
(imgui-headers (scandir "." header?))
|
|
|
|
(backend-headers (find-files
|
|
|
|
"backends"
|
|
|
|
"(glfw|opengl|sdl|vulkan).*\\.h$"))
|
|
|
|
(misc-headers (find-files "misc" "\\.h$")))
|
2023-04-01 21:28:09 +00:00
|
|
|
(install-file "libimgui.so" (string-append #$output "/lib"))
|
2022-03-21 19:10:54 +00:00
|
|
|
;; Install headers.
|
|
|
|
(for-each (lambda (f)
|
2023-04-01 21:28:09 +00:00
|
|
|
(install-file f (string-append #$output
|
|
|
|
"/include/imgui")))
|
2022-03-21 19:10:54 +00:00
|
|
|
imgui-headers)
|
|
|
|
(for-each (lambda (f)
|
|
|
|
(install-file f (string-append
|
2023-04-01 21:28:09 +00:00
|
|
|
#$output
|
|
|
|
"/include/imgui/backends")))
|
2022-03-21 19:10:54 +00:00
|
|
|
backend-headers)
|
|
|
|
(for-each (lambda (f)
|
2023-04-01 21:28:09 +00:00
|
|
|
(install-file f (string-append #$output
|
|
|
|
"/include/imgui/"
|
|
|
|
(dirname f))))
|
2022-03-21 19:10:54 +00:00
|
|
|
misc-headers)
|
|
|
|
;; Install examples.
|
2023-04-01 21:28:09 +00:00
|
|
|
(copy-recursively "examples"
|
|
|
|
(string-append #$output:doc
|
|
|
|
"/share/imgui/examples"))))))))
|
2023-09-26 01:15:42 +00:00
|
|
|
(inputs (list fontconfig freetype glfw mesa sdl2))
|
2018-11-28 03:06:49 +00:00
|
|
|
(home-page "https://github.com/ocornut/imgui")
|
2022-02-21 06:02:05 +00:00
|
|
|
(synopsis "Immediate-mode C++ GUI library with minimal dependencies")
|
2018-11-28 03:06:49 +00:00
|
|
|
(description "@code{dear imgui} (also know as ImGui) is a graphical user
|
2022-02-21 06:02:05 +00:00
|
|
|
interface library for C++. It creates optimized vertex buffers that you can
|
|
|
|
render anytime in your 3D-pipeline-enabled application. It's fast, portable,
|
|
|
|
renderer-agnostic, and self-contained, without external dependencies.
|
|
|
|
|
|
|
|
ImGui is aimed at content creation, visualization, and debugging tools as
|
|
|
|
opposed to average end-user interfaces. Hence it favors simplicity and
|
|
|
|
productivity but lacks certain features often found in higher-level libraries.
|
|
|
|
It is particularly suited to integration in game engine tooling, real-time 3D
|
|
|
|
applications, full-screen applications, and embedded platforms without
|
|
|
|
standard operating system features.")
|
2018-11-28 03:06:49 +00:00
|
|
|
(license license:expat)))
|
2022-02-21 06:11:37 +00:00
|
|
|
|
2023-04-01 21:35:23 +00:00
|
|
|
(define-public imgui-1.87
|
|
|
|
(package
|
|
|
|
(inherit imgui)
|
|
|
|
(name "imgui")
|
|
|
|
(version "1.87")
|
|
|
|
(source (origin
|
|
|
|
(inherit (package-source imgui))
|
|
|
|
(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
|
|
|
|
"10qil22s5qak3as41787iz273sibpq1bq66bakgn7yvhj5fym6hz"))))))
|
|
|
|
|
2022-02-21 06:11:37 +00:00
|
|
|
(define-public imgui-1.86
|
|
|
|
(package
|
|
|
|
(inherit imgui)
|
|
|
|
(name "imgui")
|
|
|
|
(version "1.86")
|
|
|
|
(source (origin
|
|
|
|
(inherit (package-source imgui))
|
|
|
|
(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
|
2023-06-28 00:49:34 +00:00
|
|
|
"02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n"))))
|
|
|
|
(arguments
|
|
|
|
(substitute-keyword-arguments (package-arguments imgui)
|
|
|
|
((#:make-flags flags ''())
|
2023-10-06 21:17:11 +00:00
|
|
|
;; Remove "-DImDrawIdx=unsigned int" and "-DIMGUI_ENABLE_FREETYPE"
|
|
|
|
;; from make-flags as this breaks MangoHud, the only user of this
|
|
|
|
;; version.
|
|
|
|
#~(filter (negate (lambda (x) (string-prefix? "-D" x)))
|
|
|
|
#$flags))))
|
|
|
|
(inputs
|
|
|
|
(modify-inputs (package-inputs imgui)
|
|
|
|
(delete "freetype")))))
|