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>
18 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
20 ;;; This file is part of GNU Guix.
22 ;;; GNU Guix is free software; you can redistribute it and/or modify it
23 ;;; under the terms of the GNU General Public License as published by
24 ;;; the Free Software Foundation; either version 3 of the License, or (at
25 ;;; your option) any later version.
27 ;;; GNU Guix is distributed in the hope that it will be useful, but
28 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 ;;; GNU General Public License for more details.
32 ;;; You should have received a copy of the GNU General Public License
33 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35 (define-module (gnu packages cpp)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix packages)
38 #:use-module (guix download)
39 #:use-module (guix git-download)
40 #:use-module (guix build-system cmake)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system python)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages boost)
46 #:use-module (gnu packages check)
47 #:use-module (gnu packages code)
48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages crypto)
50 #:use-module (gnu packages gcc)
51 #:use-module (gnu packages libevent)
52 #:use-module (gnu packages libunwind)
53 #:use-module (gnu packages linux)
54 #:use-module (gnu packages llvm)
55 #:use-module (gnu packages logging)
56 #:use-module (gnu packages maths)
57 #:use-module (gnu packages perl)
58 #:use-module (gnu packages pkg-config)
59 #:use-module (gnu packages popt)
60 #:use-module (gnu packages pretty-print)
61 #:use-module (gnu packages tls)
62 #:use-module (gnu packages web))
70 ;; Warning: This source has proved unreliable 1 time at least.
71 ;; Consider an alternate source or report upstream if this
73 (uri (string-append "https://mediaarea.net/download/source/"
75 "libzen_" version ".tar.bz2"))
78 "1nkygc17sndznpcf71fdrhwpm8z9a3hc9csqlafwswh49axhfkjr"))))
80 `(("autoconf" ,autoconf)
81 ("automake" ,automake)
82 ("libtool" ,libtool)))
83 (build-system gnu-build-system)
86 ;; The build scripts are not at the root of the archive.
87 (modify-phases %standard-phases
88 (add-after 'unpack 'pre-configure
90 (chdir "Project/GNU/Library")
92 (home-page "https://github.com/MediaArea/ZenLib")
93 (synopsis "C++ utility library")
94 (description "ZenLib is a C++ utility library. It includes classes for handling
95 strings, configuration, bit streams, threading, translation, and cross-platform
96 operating system functions.")
97 (license license:zlib)))
107 (url "https://github.com/rttrorg/rttr/")
108 (commit (string-append "v" version))))
110 (base32 "1yxad8sj40wi75hny8w6imrsx8wjasjmsipnlq559n4b6kl84ijp"))
111 (file-name (git-file-name name version))))
112 (build-system cmake-build-system)
114 '(;; No check target. Setting test-target to "unit_test" runs it twice.
117 '("-DBUILD_DOCUMENTATION=OFF" "-DBUILD_EXAMPLES=OFF")
119 (modify-phases %standard-phases
120 ;; library_test fails in chroot.
121 (add-after 'unpack 'skip-library-test
123 (substitute* "src/unit_tests/unit_tests.cmake"
124 (("misc/library_test.cpp") ""))
126 (native-inputs `(("pkg-config" ,pkg-config)))
127 (home-page "https://github.com/rttrorg/rttr/")
128 (synopsis "C++ Reflection Library")
130 "RTTR stands for Run Time Type Reflection. It describes the ability of a
131 computer program to introspect and modify an object at runtime. It is also
132 the name of the library itself, which is written in C++.")
133 (license license:expat)))
136 (let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
140 (version (git-version "0.0.0" revision commit))
144 (url "https://github.com/Andersbakken/rct")
148 "1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
149 (patches (search-patches "rct-add-missing-headers.patch"))
150 (file-name (git-file-name name version))))
151 (build-system cmake-build-system)
154 '("-DWITH_TESTS=ON" ; To run the test suite
155 "-DRCT_RTTI_ENABLED=ON")))
157 `(("cppunit" ,cppunit)
158 ("pkg-config" ,pkg-config)))
160 `(("openssl" ,openssl)
162 (home-page "https://github.com/Andersbakken/rct")
163 (synopsis "C++ library providing Qt-like APIs on top of the STL")
164 (description "Rct is a set of C++ tools that provide nicer (more Qt-like)
165 APIs on top of Standard Template Library (@dfn{STL}) classes.")
166 (license (list license:expat ; cJSON
167 license:bsd-4))))) ; everything else (LICENSE.txt)
169 (define-public dashel
177 (url "https://github.com/aseba-community/dashel")
180 (base32 "0anks2l2i2qp0wlzqck1qgpq15a3l6dg8lw2h8s4nsj7f61lffwy"))
181 (file-name (git-file-name name version))))
182 (build-system cmake-build-system)
183 (arguments '(#:tests? #f)) ; no tests
184 (native-inputs `(("pkg-config" ,pkg-config)))
185 (home-page "https://github.com/aseba-community/dashel")
186 (synopsis "Data stream helper encapsulation library")
188 "Dashel is a data stream helper encapsulation C++ library. It provides a
189 unified access to TCP/UDP sockets, serial ports, console, and files streams.
190 It also allows a server application to wait for any activity on any
191 combination of these streams.")
192 (license license:bsd-3)))
202 (url "https://github.com/QuantStack/xsimd")
205 (base32 "11by8gbshm4vv6flqp0ihff8c6nmbaqq7ms93b38rrq68bigcply"))
206 (file-name (git-file-name name version))))
207 (build-system cmake-build-system)
209 `(#:configure-flags (list "-DBUILD_TESTS=ON")
210 #:test-target "xtest"))
212 `(("googletest" ,googletest)))
213 (home-page "https://github.com/QuantStack/xsimd")
214 (synopsis "C++ wrappers for SIMD intrinsics and math implementations")
216 "xsimd provides a unified means for using @acronym{SIMD, single instruction
217 multiple data} features for library authors. Namely, it enables manipulation of
218 batches of numbers with the same arithmetic operators as for single values.
219 It also provides accelerated implementation of common mathematical functions
220 operating on batches.")
221 (license license:bsd-3)))
223 (define-public chaiscript
231 (url "https://github.com/ChaiScript/ChaiScript")
232 (commit (string-append "v" version))))
233 (file-name (git-file-name name version))
235 (base32 "0i1c88rn1wwz8nf3dpapcdkk4w623m3nksfy5yjai10k9irkzy3c"))))
236 (build-system cmake-build-system)
237 (home-page "https://chaiscript.com/")
238 (synopsis "Embedded scripting language designed for C++")
240 "ChaiScript is one of the only embedded scripting language designed from
241 the ground up to directly target C++ and take advantage of modern C++
242 development techniques. Being a native C++ application, it has some advantages
243 over existing embedded scripting languages:
246 @item Uses a header-only approach, which makes it easy to integrate with
248 @item Maintains type safety between your C++ application and the user scripts.
249 @item Supports a variety of C++ techniques including callbacks, overloaded
250 functions, class methods, and stl containers.
252 (license license:bsd-3)))
254 (define-public fifo-map
255 (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
257 (version (git-version "1.1.1" revision commit)))
261 (home-page "https://github.com/nlohmann/fifo_map")
269 "0pi77b75kp0l7z454ihcd14nzpi3nc5m4nyjbsgy5f9bw3676196"))
270 (patches (search-patches "fifo-map-remove-catch.hpp.patch"
271 "fifo-map-fix-flags-for-gcc.patch"))
272 (file-name (git-file-name name version))
273 (modules '((guix build utils)))
274 (snippet '(delete-file-recursively "./test/thirdparty"))))
276 `(("catch2" ,catch-framework2-1)))
277 (build-system cmake-build-system)
280 (modify-phases %standard-phases
285 (lambda* (#:key outputs #:allow-other-keys)
286 (let* ((out (assoc-ref outputs "out"))
287 (inc (string-append out "/include/fifo_map")))
288 (with-directory-excursion
289 (string-append "../" ,name "-" ,version "-checkout")
290 (install-file "src/fifo_map.hpp" inc)
292 (synopsis "FIFO-ordered associative container for C++")
293 (description "Fifo_map is a C++ header only library for associative
294 container which uses the order in which keys were inserted to the container
295 as ordering relation.")
296 (license license:expat))))
298 (define-public json-modern-cxx
300 (name "json-modern-cxx")
302 (home-page "https://github.com/nlohmann/json")
306 (uri (git-reference (url home-page)
307 (commit (string-append "v" version))))
309 (base32 "0ar4mzp53lskxw3vdzw07f47njcshl3lwid9jfq6l7yx6ds2nyjc"))
310 (file-name (git-file-name name version))
311 (modules '((guix build utils)))
314 ;; Delete bundled software. Preserve doctest_compatibility.h, which
315 ;; is a wrapper library added by this package.
316 (install-file "./test/thirdparty/doctest/doctest_compatibility.h" "/tmp")
317 (for-each delete-file-recursively
318 '("./third_party" "./test/thirdparty" "./benchmarks/thirdparty"))
319 (install-file "/tmp/doctest_compatibility.h" "./test/thirdparty/doctest")
321 ;; Adjust for the unbundled fifo_map and doctest.
322 (substitute* "./test/thirdparty/doctest/doctest_compatibility.h"
323 (("#include \"doctest\\.h\"")
324 "#include <doctest/doctest.h>"))
325 (with-directory-excursion "test/src"
326 (let ((files (find-files "." "\\.cpp$")))
328 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
330 "#include <fifo_map/" fifo-map-hpp ">")))))
332 (build-system cmake-build-system)
335 (list (string-append "-DJSON_TestDataDirectory="
336 (assoc-ref %build-inputs "json_test_data")))
337 #:phases (modify-phases %standard-phases
338 ;; XXX: When tests are enabled, the install phase will cause
339 ;; a needless rebuild without the given configure flags,
340 ;; ultimately creating both $out/lib and $out/lib64. Move
341 ;; the check phase after install to work around it.
343 (add-after 'install 'check
344 (lambda* (#:key tests? #:allow-other-keys)
346 ;; Some tests need git and a full checkout, skip those.
347 (invoke "ctest" "-LE" "git_required")
348 (format #t "test suite not run~%"))
351 `(("amalgamate" ,amalgamate)
354 ,(let ((version "3.0.0"))
358 (url "https://github.com/nlohmann/json_test_data")
359 (commit (string-append "v" version))))
360 (file-name (git-file-name "json_test_data" version))
363 "0nzsjzlvk14dazwh7k2jb1dinb0pv9jbx5jsyn264wvva0y7daiv")))))))
365 `(("fifo-map" ,fifo-map)))
366 (synopsis "JSON parser and printer library for C++")
367 (description "JSON for Modern C++ is a C++ JSON library that provides
368 intuitive syntax and trivial integration.")
369 (license license:expat)))
371 (define-public nlohmann-json-cpp
372 (deprecated-package "nlohmann-json-cpp" json-modern-cxx))
382 (url "https://github.com/QuantStack/xtl")
386 "08xhyy9fm2ddkdrgb1qyd2bs371a2xr7xzar482pwphz27vr035w"))
387 (file-name (git-file-name name version))))
389 `(("googletest" ,googletest)
390 ("json-modern-cxx" ,json-modern-cxx)))
393 '("-DBUILD_TESTS=ON")
395 (modify-phases %standard-phases
398 (with-directory-excursion "test"
399 (invoke "./test_xtl")
401 (home-page "https://github.com/QuantStack/xtl")
402 (build-system cmake-build-system)
403 (synopsis "C++ template library providing some basic tools")
404 (description "xtl is a C++ header-only template library providing basic
405 tools (containers, algorithms) used by other QuantStack packages.")
406 (license license:bsd-3)))
411 (version "0.20201025")
416 (url "https://github.com/MaskRay/ccls")
420 "13v00q1bz8g0ckw1sv0zyicbc44irc00vhwxdv3vvwlvylm7s21p"))
421 (file-name (git-file-name name version))))
422 (build-system cmake-build-system)
424 '(#:tests? #f)) ; no check target
426 `(("rapidjson" ,rapidjson)))
430 (home-page "https://github.com/MaskRay/ccls")
431 (synopsis "C/C++/Objective-C language server")
433 "@code{ccls} is a server implementing the Language Server Protocol (LSP)
434 for C, C++ and Objective-C languages. It uses @code{clang} to perform static
435 code analysis and supports cross references, hierarchies, completion and
436 syntax highlighting. @code{ccls} is derived from @code{cquery} which is not
437 maintained anymore.")
438 (license license:asl2.0)))
440 (define-public gperftools
448 (url "https://github.com/gperftools/gperftools")
449 (commit (string-append "gperftools-" version))))
451 (base32 "1rnc53kaxlljgbpsff906vdsry9jl9gcvcnmxgkprwzxq1wipyd0"))
452 (file-name (git-file-name name version))))
453 (build-system gnu-build-system)
455 `(("autoconf" ,autoconf)
456 ("automake" ,automake)
460 (home-page "https://github.com/gperftools/gperftools")
461 (synopsis "Multi-threaded malloc() and performance analysis tools for C++")
463 "@code{gperftools} is a collection of a high-performance multi-threaded
464 malloc() implementation plus some thread-friendly performance analysis
473 (license license:bsd-3)))
475 (define-public cpplint
482 ;; Fetch from github instead of pypi, since the test cases are not in
485 (url "https://github.com/cpplint/cpplint")
488 (base32 "1yzcxqx0186sh80p0ydl9z0ld51fn2cdpz9hmhrp15j53g9ira7c"))
489 (file-name (git-file-name name version))))
492 (modify-phases %standard-phases
493 (add-before 'check 'use-later-pytest
495 (substitute* "test-requirements"
496 (("pytest.*") "pytest\n"))
498 (build-system python-build-system)
500 `(("python-pytest" ,python-pytest)
501 ("python-pytest-cov" ,python-pytest-cov)
502 ("python-pytest-runner" ,python-pytest-runner)))
503 (home-page "https://github.com/cpplint/cpplint")
504 (synopsis "Static code checker for C++")
505 (description "@code{cpplint} is a command-line tool to check C/C++ files
506 for style issues following Google’s C++ style guide. While Google maintains
507 it's own version of the tool, this is a fork that aims to be more responsive
508 and make @code{cpplint} usable in wider contexts.")
509 (license license:bsd-3)))
511 (define-public reproc
519 (url "https://github.com/DaanDeMeyer/reproc")
520 (commit (string-append "v" version))))
521 (file-name (git-file-name name version))
524 "1n71wb50qv2dmhjgw7azx5gigbrp19l2n3d41g9p05l5l0y1qg0q"))))
525 (build-system cmake-build-system)
529 ;; Enable building of shared library.
530 #:configure-flags `("-DBUILD_SHARED_LIBS=1")))
532 `(("pkg-config" ,pkg-config)))
533 (synopsis "Process IO library")
534 (description "reproc (Redirected Process) is a C/C++ library that
535 simplifies starting, stopping and communicating with external programs. The
536 main use case is executing command line applications directly from C or C++
537 code and retrieving their output.")
538 (home-page "https://github.com/DaanDeMeyer/reproc")
539 (license license:expat)))
541 (define-public sobjectizer
549 (url "https://github.com/Stiffstream/sobjectizer")
550 (commit (string-append "v." version))))
552 (base32 "0jfai7sqxnnjkms38krm7mssj5l79nb3pllkbyj4j581a7l5j6l5"))
553 (file-name (git-file-name name version))))
554 (build-system cmake-build-system)
558 (modify-phases %standard-phases
559 (add-after 'unpack 'change-directory
563 (home-page "https://stiffstream.com/en/products/sobjectizer.html")
564 (synopsis "Cross-platform actor framework for C++")
566 "SObjectizer is a cross-platform \"actor frameworks\" for C++.
567 SObjectizer supports not only the Actor Model but also the Publish-Subscribe
568 Model and CSP-like channels. The goal of SObjectizer is to simplify
569 development of concurrent and multithreaded applications in C++.")
570 (license license:bsd-3)))
572 (define-public tweeny
580 (url "https://github.com/mobius3/tweeny")
581 (commit (string-append "v" version))))
582 (file-name (git-file-name name version))
584 (base32 "1adm4c17pi7xf3kf6sjyxibz5rdg1ka236p72xsm6js4j9gzlbp4"))))
586 '(#:tests? #f)) ;no check target
587 (build-system cmake-build-system)
588 (home-page "https://mobius3.github.io/tweeny/")
589 (synopsis "Modern C++ tweening library")
590 (description "@code{Tweeny} is an inbetweening library designed for the
591 creation of complex animations for games and other beautiful interactive
592 software. It leverages features of modern @code{C++} to empower developers with
593 an intuitive API for declaring tweenings of any type of value, as long as they
594 support arithmetic operations. The goal of @code{Tweeny} is to provide means to
595 create fluid interpolations when animating position, scale, rotation, frames or
596 other values of screen objects, by setting their values as the tween starting
597 point and then, after each tween step, plugging back the result.")
598 (license license:expat)))
600 (define-public abseil-cpp
603 (version "20200225.2")
607 (url "https://github.com/abseil/abseil-cpp")
609 (file-name (git-file-name name version))
612 "0dwxg54pv6ihphbia0iw65r64whd7v8nm4wwhcz219642cgpv54y"))))
613 (build-system cmake-build-system)
615 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
616 "-DABSL_RUN_TESTS=ON"
617 ;; Needed, else we get errors like:
619 ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
620 ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
621 ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
622 ;; error adding symbols: DSO missing from command line
623 ;; collect2: error: ld returned 1 exit status
624 "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")
626 (modify-phases %standard-phases
627 (add-before 'configure 'remove-gtest-check
628 ;; The CMakeLists fails to find our googletest for some reason, but
629 ;; it works nonetheless.
631 (substitute* "CMakeLists.txt"
632 (("check_target\\(gtest\\)") "")
633 (("check_target\\(gtest_main\\)") "")
634 (("check_target\\(gmock\\)") "")))))))
636 `(("googletest" ,googletest)))
637 (home-page "https://abseil.io")
638 (synopsis "Augmented C++ standard library")
639 (description "Abseil is a collection of C++ library code designed to
640 augment the C++ standard library. The Abseil library code is collected from
641 Google's C++ code base.")
642 (license license:asl2.0)))
651 (url "https://github.com/taocpp/PEGTL")
653 (file-name (git-file-name name version))
656 "17crgjfdx55imi2dqnz6xpvsxq07390yfgkz5nd2g77ydkvq9db3"))))
657 (build-system cmake-build-system)
658 (home-page "https://github.com/taocpp/PEGTL")
659 (synopsis "Parsing Expression Grammar template library")
660 (description "The Parsing Expression Grammar Template Library (PEGTL) is
661 a zero-dependency C++ header-only parser combinator library for creating
662 parsers according to a Parsing Expression Grammar (PEG).")
663 (license license:expat)))
665 (define-public cxxopts
672 (url "https://github.com/jarro2783/cxxopts")
673 (commit (string-append "v" version))))
674 (file-name (git-file-name name version))
677 "0d3y747lsh1wkalc39nxd088rbypxigm991lk3j91zpn56whrpha"))))
678 (build-system cmake-build-system)
679 (synopsis "Lightweight C++ command line option parser")
681 "A lightweight header-only C++ option parser library, supporting the
682 standard GNU style syntax for options.")
683 (home-page "https://github.com/jarro2783/cxxopts/wiki")
684 (license license:expat)))
689 (version "2020.10.05.00")
693 (url "https://github.com/facebook/folly")
694 (commit (string-append "v" version))))
695 (file-name (git-file-name name version))
698 "0q4w4cvjxffc462hvs8h4zryq4965j7015zvkwagcm6cj6wmz3cn"))))
699 (build-system cmake-build-system)
701 '(;; Tests must be explicitly enabled
702 ;;#:configure-flags '("-DBUILD_TESTS=ON")))
703 ;; Leave tests disabled; see https://github.com/facebook/folly/issues/1456
709 ("liburing" ,liburing)))
712 ("double-conversion" ,double-conversion)
715 ("libevent" ,libevent)
716 ("libiberty" ,libiberty)
717 ("libsodium" ,libsodium)
718 ("libunwind" ,libunwind)
723 ("zstd" ,zstd "lib")))
725 `(("googletest" ,googletest)))
726 (synopsis "Collection of C++ components complementing the standard library")
728 "Folly (acronymed loosely after Facebook Open Source Library) is a library
729 of C++14 components that complements @code{std} and Boost.")
730 (home-page "https://github.com/facebook/folly/wiki")
731 ;; 32-bit is not supported: https://github.com/facebook/folly/issues/103
732 (supported-systems '("aarch64-linux" "x86_64-linux"))
733 (license license:asl2.0)))