1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 Ethan R. Jones <doubleplusgood23@gmail.com>
3 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
5 ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2019, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
7 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
8 ;;; Copyright © 2019 Jan Wielkiewicz <tona_kosmicznego_smiecia@interia.pl>
9 ;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
10 ;;; Copyright © 2020 Roel Janssen <roel@gnu.org>
11 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
13 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
14 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
15 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
16 ;;; Copyright © 2020 Alexandros Theodotou <alex@zrythm.org>
17 ;;; Copyright © 2020 Greg Hogan <code@greghogan.com>
19 ;;; This file is part of GNU Guix.
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34 (define-module (gnu packages cpp)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix packages)
37 #:use-module (guix download)
38 #:use-module (guix git-download)
39 #:use-module (guix build-system cmake)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system python)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages autotools)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages code)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages llvm)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages tls)
51 #:use-module (gnu packages web))
59 ;; Warning: This source has proved unreliable 1 time at least.
60 ;; Consider an alternate source or report upstream if this
62 (uri (string-append "https://mediaarea.net/download/source/"
64 "libzen_" version ".tar.bz2"))
67 "1nkygc17sndznpcf71fdrhwpm8z9a3hc9csqlafwswh49axhfkjr"))))
69 `(("autoconf" ,autoconf)
70 ("automake" ,automake)
71 ("libtool" ,libtool)))
72 (build-system gnu-build-system)
75 ;; The build scripts are not at the root of the archive.
76 (modify-phases %standard-phases
77 (add-after 'unpack 'pre-configure
79 (chdir "Project/GNU/Library")
81 (home-page "https://github.com/MediaArea/ZenLib")
82 (synopsis "C++ utility library")
83 (description "ZenLib is a C++ utility library. It includes classes for handling
84 strings, configuration, bit streams, threading, translation, and cross-platform
85 operating system functions.")
86 (license license:zlib)))
96 (url "https://github.com/rttrorg/rttr/")
97 (commit (string-append "v" version))))
99 (base32 "1yxad8sj40wi75hny8w6imrsx8wjasjmsipnlq559n4b6kl84ijp"))
100 (file-name (git-file-name name version))))
101 (build-system cmake-build-system)
103 '(;; No check target. Setting test-target to "unit_test" runs it twice.
106 '("-DBUILD_DOCUMENTATION=OFF" "-DBUILD_EXAMPLES=OFF")
108 (modify-phases %standard-phases
109 ;; library_test fails in chroot.
110 (add-after 'unpack 'skip-library-test
112 (substitute* "src/unit_tests/unit_tests.cmake"
113 (("misc/library_test.cpp") ""))
115 (native-inputs `(("pkg-config" ,pkg-config)))
116 (home-page "https://github.com/rttrorg/rttr/")
117 (synopsis "C++ Reflection Library")
119 "RTTR stands for Run Time Type Reflection. It describes the ability of a
120 computer program to introspect and modify an object at runtime. It is also
121 the name of the library itself, which is written in C++.")
122 (license license:expat)))
125 (let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
129 (version (git-version "0.0.0" revision commit))
133 (url "https://github.com/Andersbakken/rct")
137 "1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
138 (patches (search-patches "rct-add-missing-headers.patch"))
139 (file-name (git-file-name name version))))
140 (build-system cmake-build-system)
143 '("-DWITH_TESTS=ON" ; To run the test suite
144 "-DRCT_RTTI_ENABLED=ON")))
146 `(("cppunit" ,cppunit)
147 ("pkg-config" ,pkg-config)))
149 `(("openssl" ,openssl)
151 (home-page "https://github.com/Andersbakken/rct")
152 (synopsis "C++ library providing Qt-like APIs on top of the STL")
153 (description "Rct is a set of C++ tools that provide nicer (more Qt-like)
154 APIs on top of Standard Template Library (@dfn{STL}) classes.")
155 (license (list license:expat ; cJSON
156 license:bsd-4))))) ; everything else (LICENSE.txt)
158 (define-public dashel
166 (url "https://github.com/aseba-community/dashel")
169 (base32 "0anks2l2i2qp0wlzqck1qgpq15a3l6dg8lw2h8s4nsj7f61lffwy"))
170 (file-name (git-file-name name version))))
171 (build-system cmake-build-system)
172 (arguments '(#:tests? #f)) ; no tests
173 (native-inputs `(("pkg-config" ,pkg-config)))
174 (home-page "https://github.com/aseba-community/dashel")
175 (synopsis "Data stream helper encapsulation library")
177 "Dashel is a data stream helper encapsulation C++ library. It provides a
178 unified access to TCP/UDP sockets, serial ports, console, and files streams.
179 It also allows a server application to wait for any activity on any
180 combination of these streams.")
181 (license license:bsd-3)))
191 (url "https://github.com/QuantStack/xsimd")
194 (base32 "1ny2qin1j4h35mljivh8z52kwdyjxf4yxlzb8j52ji91v2ccc88j"))
195 (file-name (git-file-name name version))))
196 (build-system cmake-build-system)
198 `(#:configure-flags (list "-DBUILD_TESTS=ON")
199 #:test-target "xtest"))
201 `(("googletest" ,googletest)))
202 (home-page "https://github.com/QuantStack/xsimd")
203 (synopsis "C++ wrappers for SIMD intrinsics and math implementations")
204 (description "xsimd provides a unified means for using SIMD features for
205 library authors. Namely, it enables manipulation of batches of numbers with
206 the same arithmetic operators as for single values. It also provides
207 accelerated implementation of common mathematical functions operating on
209 (license license:bsd-3)))
211 (define-public chaiscript
219 (url "https://github.com/ChaiScript/ChaiScript")
220 (commit (string-append "v" version))))
221 (file-name (git-file-name name version))
223 (base32 "0i1c88rn1wwz8nf3dpapcdkk4w623m3nksfy5yjai10k9irkzy3c"))))
224 (build-system cmake-build-system)
225 (home-page "https://chaiscript.com/")
226 (synopsis "Embedded scripting language designed for C++")
228 "ChaiScript is one of the only embedded scripting language designed from
229 the ground up to directly target C++ and take advantage of modern C++
230 development techniques. Being a native C++ application, it has some advantages
231 over existing embedded scripting languages:
234 @item Uses a header-only approach, which makes it easy to integrate with
236 @item Maintains type safety between your C++ application and the user scripts.
237 @item Supports a variety of C++ techniques including callbacks, overloaded
238 functions, class methods, and stl containers.
240 (license license:bsd-3)))
242 (define-public fifo-map
243 (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
245 (version (git-version "1.1.1" revision commit)))
249 (home-page "https://github.com/nlohmann/fifo_map")
257 "0pi77b75kp0l7z454ihcd14nzpi3nc5m4nyjbsgy5f9bw3676196"))
258 (patches (search-patches "fifo-map-remove-catch.hpp.patch"
259 "fifo-map-fix-flags-for-gcc.patch"))
260 (file-name (git-file-name name version))
261 (modules '((guix build utils)))
262 (snippet '(delete-file-recursively "./test/thirdparty"))))
264 `(("catch2" ,catch-framework2-1)))
265 (build-system cmake-build-system)
268 (modify-phases %standard-phases
273 (lambda* (#:key outputs #:allow-other-keys)
274 (let* ((out (assoc-ref outputs "out"))
275 (inc (string-append out "/include/fifo_map")))
276 (with-directory-excursion
277 (string-append "../" ,name "-" ,version "-checkout")
278 (install-file "src/fifo_map.hpp" inc)
280 (synopsis "FIFO-ordered associative container for C++")
281 (description "Fifo_map is a C++ header only library for associative
282 container which uses the order in which keys were inserted to the container
283 as ordering relation.")
284 (license license:expat))))
286 (define-public json-modern-cxx
288 (name "json-modern-cxx")
290 (home-page "https://github.com/nlohmann/json")
294 (uri (git-reference (url home-page)
295 (commit (string-append "v" version))))
297 (base32 "0ar4mzp53lskxw3vdzw07f47njcshl3lwid9jfq6l7yx6ds2nyjc"))
298 (file-name (git-file-name name version))
299 (modules '((guix build utils)))
302 ;; Delete bundled software. Preserve doctest_compatibility.h, which
303 ;; is a wrapper library added by this package.
304 (install-file "./test/thirdparty/doctest/doctest_compatibility.h" "/tmp")
305 (for-each delete-file-recursively
306 '("./third_party" "./test/thirdparty" "./benchmarks/thirdparty"))
307 (install-file "/tmp/doctest_compatibility.h" "./test/thirdparty/doctest")
309 ;; Adjust for the unbundled fifo_map and doctest.
310 (substitute* "./test/thirdparty/doctest/doctest_compatibility.h"
311 (("#include \"doctest\\.h\"")
312 "#include <doctest/doctest.h>"))
313 (with-directory-excursion "test/src"
314 (let ((files (find-files "." "\\.cpp$")))
316 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
318 "#include <fifo_map/" fifo-map-hpp ">")))))
320 (build-system cmake-build-system)
323 (list (string-append "-DJSON_TestDataDirectory="
324 (assoc-ref %build-inputs "json_test_data")))
325 #:phases (modify-phases %standard-phases
326 ;; XXX: When tests are enabled, the install phase will cause
327 ;; a needless rebuild without the given configure flags,
328 ;; ultimately creating both $out/lib and $out/lib64. Move
329 ;; the check phase after install to work around it.
331 (add-after 'install 'check
332 (lambda* (#:key tests? #:allow-other-keys)
334 ;; Some tests need git and a full checkout, skip those.
335 (invoke "ctest" "-LE" "git_required")
336 (format #t "test suite not run~%"))
339 `(("amalgamate" ,amalgamate)
342 ,(let ((version "3.0.0"))
346 (url "https://github.com/nlohmann/json_test_data")
347 (commit (string-append "v" version))))
348 (file-name (git-file-name "json_test_data" version))
351 "0nzsjzlvk14dazwh7k2jb1dinb0pv9jbx5jsyn264wvva0y7daiv")))))))
353 `(("fifo-map" ,fifo-map)))
354 (synopsis "JSON parser and printer library for C++")
355 (description "JSON for Modern C++ is a C++ JSON library that provides
356 intuitive syntax and trivial integration.")
357 (license license:expat)))
359 (define-public nlohmann-json-cpp
360 (deprecated-package "nlohmann-json-cpp" json-modern-cxx))
370 (url "https://github.com/QuantStack/xtl")
374 "0s9gnv1wq0cmpw878dmx0lnci86895hhdrwyc9x8lfbc1hr7ypnh"))
375 (file-name (git-file-name name version))))
377 `(("googletest" ,googletest)
378 ("json-modern-cxx" ,json-modern-cxx)))
381 '("-DBUILD_TESTS=ON")
383 (modify-phases %standard-phases
386 (with-directory-excursion "test"
387 (invoke "./test_xtl")
389 (home-page "https://github.com/QuantStack/xtl")
390 (build-system cmake-build-system)
391 (synopsis "C++ template library providing some basic tools")
392 (description "xtl is a C++ header-only template library providing basic
393 tools (containers, algorithms) used by other QuantStack packages.")
394 (license license:bsd-3)))
399 (version "0.20190823.6")
404 (url "https://github.com/MaskRay/ccls")
407 (base32 "11h5nwk4qqshf3i8yr4bxpnvmidrhkzd0zxhf1xqv8cv6r08k47f"))
408 (file-name (git-file-name name version))))
409 (build-system cmake-build-system)
411 '(#:tests? #f)) ; no check target
413 `(("rapidjson" ,rapidjson)))
417 (home-page "https://github.com/MaskRay/ccls")
418 (synopsis "C/C++/Objective-C language server")
420 "@code{ccls} is a server implementing the Language Server Protocol (LSP)
421 for C, C++ and Objective-C languages. It uses @code{clang} to perform static
422 code analysis and supports cross references, hierarchies, completion and
423 syntax highlighting. @code{ccls} is derived from @code{cquery} which is not
424 maintained anymore.")
425 (license license:asl2.0)))
427 (define-public gperftools
435 (url "https://github.com/gperftools/gperftools")
436 (commit (string-append "gperftools-" version))))
438 (base32 "1rnc53kaxlljgbpsff906vdsry9jl9gcvcnmxgkprwzxq1wipyd0"))
439 (file-name (git-file-name name version))))
440 (build-system gnu-build-system)
442 `(("autoconf" ,autoconf)
443 ("automake" ,automake)
447 (home-page "https://github.com/gperftools/gperftools")
448 (synopsis "Multi-threaded malloc() and performance analysis tools for C++")
450 "@code{gperftools} is a collection of a high-performance multi-threaded
451 malloc() implementation plus some thread-friendly performance analysis
460 (license license:bsd-3)))
462 (define-public cpplint
469 ;; Fetch from github instead of pypi, since the test cases are not in
472 (url "https://github.com/cpplint/cpplint")
475 (base32 "1yzcxqx0186sh80p0ydl9z0ld51fn2cdpz9hmhrp15j53g9ira7c"))
476 (file-name (git-file-name name version))))
479 (modify-phases %standard-phases
480 (add-before 'check 'use-later-pytest
482 (substitute* "test-requirements"
483 (("pytest.*") "pytest\n"))
485 (build-system python-build-system)
487 `(("python-pytest" ,python-pytest)
488 ("python-pytest-cov" ,python-pytest-cov)
489 ("python-pytest-runner" ,python-pytest-runner)))
490 (home-page "https://github.com/cpplint/cpplint")
491 (synopsis "Static code checker for C++")
492 (description "@code{cpplint} is a command-line tool to check C/C++ files
493 for style issues following Google’s C++ style guide. While Google maintains
494 it's own version of the tool, this is a fork that aims to be more responsive
495 and make @code{cpplint} usable in wider contexts.")
496 (license license:bsd-3)))
498 (define-public reproc
506 (url "https://github.com/DaanDeMeyer/reproc")
507 (commit (string-append "v" version))))
508 (file-name (git-file-name name version))
511 "1n71wb50qv2dmhjgw7azx5gigbrp19l2n3d41g9p05l5l0y1qg0q"))))
512 (build-system cmake-build-system)
516 ;; Enable building of shared library.
517 #:configure-flags `("-DBUILD_SHARED_LIBS=1")))
519 `(("pkg-config" ,pkg-config)))
520 (synopsis "Process IO library")
521 (description "reproc (Redirected Process) is a C/C++ library that
522 simplifies starting, stopping and communicating with external programs. The
523 main use case is executing command line applications directly from C or C++
524 code and retrieving their output.")
525 (home-page "https://github.com/DaanDeMeyer/reproc")
526 (license license:expat)))
528 (define-public sobjectizer
536 (url "https://github.com/Stiffstream/sobjectizer")
537 (commit (string-append "v." version))))
539 (base32 "0jfai7sqxnnjkms38krm7mssj5l79nb3pllkbyj4j581a7l5j6l5"))
540 (file-name (git-file-name name version))))
541 (build-system cmake-build-system)
545 (modify-phases %standard-phases
546 (add-after 'unpack 'change-directory
550 (home-page "https://stiffstream.com/en/products/sobjectizer.html")
551 (synopsis "Cross-platform actor framework for C++")
553 "SObjectizer is a cross-platform \"actor frameworks\" for C++.
554 SObjectizer supports not only the Actor Model but also the Publish-Subscribe
555 Model and CSP-like channels. The goal of SObjectizer is to simplify
556 development of concurrent and multithreaded applications in C++.")
557 (license license:bsd-3)))
559 (define-public tweeny
567 (url "https://github.com/mobius3/tweeny")
568 (commit (string-append "v" version))))
569 (file-name (git-file-name name version))
571 (base32 "1adm4c17pi7xf3kf6sjyxibz5rdg1ka236p72xsm6js4j9gzlbp4"))))
573 '(#:tests? #f)) ;no check target
574 (build-system cmake-build-system)
575 (home-page "https://mobius3.github.io/tweeny/")
576 (synopsis "Modern C++ tweening library")
577 (description "@code{Tweeny} is an inbetweening library designed for the
578 creation of complex animations for games and other beautiful interactive
579 software. It leverages features of modern @code{C++} to empower developers with
580 an intuitive API for declaring tweenings of any type of value, as long as they
581 support arithmetic operations. The goal of @code{Tweeny} is to provide means to
582 create fluid interpolations when animating position, scale, rotation, frames or
583 other values of screen objects, by setting their values as the tween starting
584 point and then, after each tween step, plugging back the result.")
585 (license license:expat)))
587 (define-public abseil-cpp
590 (version "20200225.2")
594 (url "https://github.com/abseil/abseil-cpp")
596 (file-name (git-file-name name version))
599 "0dwxg54pv6ihphbia0iw65r64whd7v8nm4wwhcz219642cgpv54y"))))
600 (build-system cmake-build-system)
602 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
603 "-DABSL_RUN_TESTS=ON"
604 ;; Needed, else we get errors like:
606 ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
607 ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
608 ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
609 ;; error adding symbols: DSO missing from command line
610 ;; collect2: error: ld returned 1 exit status
611 "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")
613 (modify-phases %standard-phases
614 (add-before 'configure 'remove-gtest-check
615 ;; The CMakeLists fails to find our googletest for some reason, but
616 ;; it works nonetheless.
618 (substitute* "CMakeLists.txt"
619 (("check_target\\(gtest\\)") "")
620 (("check_target\\(gtest_main\\)") "")
621 (("check_target\\(gmock\\)") "")))))))
623 `(("googletest" ,googletest)))
624 (home-page "https://abseil.io")
625 (synopsis "Augmented C++ standard library")
626 (description "Abseil is a collection of C++ library code designed to
627 augment the C++ standard library. The Abseil library code is collected from
628 Google's C++ code base.")
629 (license license:asl2.0)))
638 (url "https://github.com/taocpp/PEGTL")
640 (file-name (git-file-name name version))
643 "17crgjfdx55imi2dqnz6xpvsxq07390yfgkz5nd2g77ydkvq9db3"))))
644 (build-system cmake-build-system)
645 (home-page "https://github.com/taocpp/PEGTL")
646 (synopsis "Parsing Expression Grammar template library")
647 (description "The Parsing Expression Grammar Template Library (PEGTL) is
648 a zero-dependency C++ header-only parser combinator library for creating
649 parsers according to a Parsing Expression Grammar (PEG).")
650 (license license:expat)))
652 (define-public cxxopts
659 (url "https://github.com/jarro2783/cxxopts")
660 (commit (string-append "v" version))))
661 (file-name (git-file-name name version))
664 "0d3y747lsh1wkalc39nxd088rbypxigm991lk3j91zpn56whrpha"))))
665 (build-system cmake-build-system)
666 (synopsis "Lightweight C++ command line option parser")
668 "A lightweight header-only C++ option parser library, supporting the
669 standard GNU style syntax for options.")
670 (home-page "https://github.com/jarro2783/cxxopts/wiki")
671 (license license:expat)))