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>
18 ;;; This file is part of GNU Guix.
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33 (define-module (gnu packages cpp)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system python)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages autotools)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages code)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages llvm)
47 #:use-module (gnu packages perl)
48 #:use-module (gnu packages pkg-config)
49 #:use-module (gnu packages tls)
50 #:use-module (gnu packages web))
58 ;; Warning: This source has proved unreliable 1 time at least.
59 ;; Consider an alternate source or report upstream if this
61 (uri (string-append "https://mediaarea.net/download/source/"
63 "libzen_" version ".tar.bz2"))
66 "1nkygc17sndznpcf71fdrhwpm8z9a3hc9csqlafwswh49axhfkjr"))))
68 `(("autoconf" ,autoconf)
69 ("automake" ,automake)
70 ("libtool" ,libtool)))
71 (build-system gnu-build-system)
74 ;; The build scripts are not at the root of the archive.
75 (modify-phases %standard-phases
76 (add-after 'unpack 'pre-configure
78 (chdir "Project/GNU/Library")
80 (home-page "https://github.com/MediaArea/ZenLib")
81 (synopsis "C++ utility library")
82 (description "ZenLib is a C++ utility library. It includes classes for handling
83 strings, configuration, bit streams, threading, translation, and cross-platform
84 operating system functions.")
85 (license license:zlib)))
95 (url "https://github.com/rttrorg/rttr/")
96 (commit (string-append "v" version))))
98 (base32 "1yxad8sj40wi75hny8w6imrsx8wjasjmsipnlq559n4b6kl84ijp"))
99 (file-name (git-file-name name version))))
100 (build-system cmake-build-system)
102 '(;; No check target. Setting test-target to "unit_test" runs it twice.
105 '("-DBUILD_DOCUMENTATION=OFF" "-DBUILD_EXAMPLES=OFF")
107 (modify-phases %standard-phases
108 ;; library_test fails in chroot.
109 (add-after 'unpack 'skip-library-test
111 (substitute* "src/unit_tests/unit_tests.cmake"
112 (("misc/library_test.cpp") ""))
114 (native-inputs `(("pkg-config" ,pkg-config)))
115 (home-page "https://github.com/rttrorg/rttr/")
116 (synopsis "C++ Reflection Library")
118 "RTTR stands for Run Time Type Reflection. It describes the ability of a
119 computer program to introspect and modify an object at runtime. It is also
120 the name of the library itself, which is written in C++.")
121 (license license:expat)))
124 (let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
128 (version (git-version "0.0.0" revision commit))
132 (url "https://github.com/Andersbakken/rct")
136 "1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
137 (patches (search-patches "rct-add-missing-headers.patch"))
138 (file-name (git-file-name name version))))
139 (build-system cmake-build-system)
142 '("-DWITH_TESTS=ON" ; To run the test suite
143 "-DRCT_RTTI_ENABLED=ON")))
145 `(("cppunit" ,cppunit)
146 ("pkg-config" ,pkg-config)))
148 `(("openssl" ,openssl)
150 (home-page "https://github.com/Andersbakken/rct")
151 (synopsis "C++ library providing Qt-like APIs on top of the STL")
152 (description "Rct is a set of C++ tools that provide nicer (more Qt-like)
153 APIs on top of Standard Template Library (@dfn{STL}) classes.")
154 (license (list license:expat ; cJSON
155 license:bsd-4))))) ; everything else (LICENSE.txt)
157 (define-public dashel
165 (url "https://github.com/aseba-community/dashel")
168 (base32 "0anks2l2i2qp0wlzqck1qgpq15a3l6dg8lw2h8s4nsj7f61lffwy"))
169 (file-name (git-file-name name version))))
170 (build-system cmake-build-system)
171 (arguments '(#:tests? #f)) ; no tests
172 (native-inputs `(("pkg-config" ,pkg-config)))
173 (home-page "https://github.com/aseba-community/dashel")
174 (synopsis "Data stream helper encapsulation library")
176 "Dashel is a data stream helper encapsulation C++ library. It provides a
177 unified access to TCP/UDP sockets, serial ports, console, and files streams.
178 It also allows a server application to wait for any activity on any
179 combination of these streams.")
180 (license license:bsd-3)))
190 (url "https://github.com/QuantStack/xsimd")
193 (base32 "1ny2qin1j4h35mljivh8z52kwdyjxf4yxlzb8j52ji91v2ccc88j"))
194 (file-name (git-file-name name version))))
195 (build-system cmake-build-system)
197 `(#:configure-flags (list "-DBUILD_TESTS=ON")
198 #:test-target "xtest"))
200 `(("googletest" ,googletest)))
201 (home-page "https://github.com/QuantStack/xsimd")
202 (synopsis "C++ wrappers for SIMD intrinsics and math implementations")
203 (description "xsimd provides a unified means for using SIMD features for
204 library authors. Namely, it enables manipulation of batches of numbers with
205 the same arithmetic operators as for single values. It also provides
206 accelerated implementation of common mathematical functions operating on
208 (license license:bsd-3)))
210 (define-public chaiscript
218 (url "https://github.com/ChaiScript/ChaiScript")
219 (commit (string-append "v" version))))
220 (file-name (git-file-name name version))
222 (base32 "0i1c88rn1wwz8nf3dpapcdkk4w623m3nksfy5yjai10k9irkzy3c"))))
223 (build-system cmake-build-system)
224 (home-page "https://chaiscript.com/")
225 (synopsis "Embedded scripting language designed for C++")
227 "ChaiScript is one of the only embedded scripting language designed from
228 the ground up to directly target C++ and take advantage of modern C++
229 development techniques. Being a native C++ application, it has some advantages
230 over existing embedded scripting languages:
233 @item Uses a header-only approach, which makes it easy to integrate with
235 @item Maintains type safety between your C++ application and the user scripts.
236 @item Supports a variety of C++ techniques including callbacks, overloaded
237 functions, class methods, and stl containers.
239 (license license:bsd-3)))
241 (define-public fifo-map
242 (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
244 (version (git-version "1.1.1" revision commit)))
248 (home-page "https://github.com/nlohmann/fifo_map")
256 "0pi77b75kp0l7z454ihcd14nzpi3nc5m4nyjbsgy5f9bw3676196"))
257 (patches (search-patches "fifo-map-remove-catch.hpp.patch"
258 "fifo-map-fix-flags-for-gcc.patch"))
259 (file-name (git-file-name name version))
260 (modules '((guix build utils)))
261 (snippet '(delete-file-recursively "./test/thirdparty"))))
263 `(("catch2" ,catch-framework2-1)))
264 (build-system cmake-build-system)
267 (modify-phases %standard-phases
272 (lambda* (#:key outputs #:allow-other-keys)
273 (let* ((out (assoc-ref outputs "out"))
274 (inc (string-append out "/include/fifo_map")))
275 (with-directory-excursion
276 (string-append "../" ,name "-" ,version "-checkout")
277 (install-file "src/fifo_map.hpp" inc)
279 (synopsis "FIFO-ordered associative container for C++")
280 (description "Fifo_map is a C++ header only library for associative
281 container which uses the order in which keys were inserted to the container
282 as ordering relation.")
283 (license license:expat))))
285 (define-public json-modern-cxx
287 (name "json-modern-cxx")
289 (home-page "https://github.com/nlohmann/json")
293 (uri (git-reference (url home-page)
294 (commit (string-append "v" version))))
296 (base32 "0ar4mzp53lskxw3vdzw07f47njcshl3lwid9jfq6l7yx6ds2nyjc"))
297 (file-name (git-file-name name version))
298 (modules '((guix build utils)))
301 ;; Delete bundled software. Preserve doctest_compatibility.h, which
302 ;; is a wrapper library added by this package.
303 (install-file "./test/thirdparty/doctest/doctest_compatibility.h" "/tmp")
304 (for-each delete-file-recursively
305 '("./third_party" "./test/thirdparty" "./benchmarks/thirdparty"))
306 (install-file "/tmp/doctest_compatibility.h" "./test/thirdparty/doctest")
308 ;; Adjust for the unbundled fifo_map and doctest.
309 (substitute* "./test/thirdparty/doctest/doctest_compatibility.h"
310 (("#include \"doctest\\.h\"")
311 "#include <doctest/doctest.h>"))
312 (with-directory-excursion "test/src"
313 (let ((files (find-files "." "\\.cpp$")))
315 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
317 "#include <fifo_map/" fifo-map-hpp ">")))))
319 (build-system cmake-build-system)
322 (list (string-append "-DJSON_TestDataDirectory="
323 (assoc-ref %build-inputs "json_test_data")))
324 #:phases (modify-phases %standard-phases
325 ;; XXX: When tests are enabled, the install phase will cause
326 ;; a needless rebuild without the given configure flags,
327 ;; ultimately creating both $out/lib and $out/lib64. Move
328 ;; the check phase after install to work around it.
330 (add-after 'install 'check
331 (lambda* (#:key tests? #:allow-other-keys)
333 ;; Some tests need git and a full checkout, skip those.
334 (invoke "ctest" "-LE" "git_required")
335 (format #t "test suite not run~%"))
338 `(("amalgamate" ,amalgamate)
341 ,(let ((version "3.0.0"))
345 (url "https://github.com/nlohmann/json_test_data")
346 (commit (string-append "v" version))))
347 (file-name (git-file-name "json_test_data" version))
350 "0nzsjzlvk14dazwh7k2jb1dinb0pv9jbx5jsyn264wvva0y7daiv")))))))
352 `(("fifo-map" ,fifo-map)))
353 (synopsis "JSON parser and printer library for C++")
354 (description "JSON for Modern C++ is a C++ JSON library that provides
355 intuitive syntax and trivial integration.")
356 (license license:expat)))
358 (define-public nlohmann-json-cpp
359 (deprecated-package "nlohmann-json-cpp" json-modern-cxx))
369 (url "https://github.com/QuantStack/xtl")
373 "0s9gnv1wq0cmpw878dmx0lnci86895hhdrwyc9x8lfbc1hr7ypnh"))
374 (file-name (git-file-name name version))))
376 `(("googletest" ,googletest)
377 ("json-modern-cxx" ,json-modern-cxx)))
380 '("-DBUILD_TESTS=ON")
382 (modify-phases %standard-phases
385 (with-directory-excursion "test"
386 (invoke "./test_xtl")
388 (home-page "https://github.com/QuantStack/xtl")
389 (build-system cmake-build-system)
390 (synopsis "C++ template library providing some basic tools")
391 (description "xtl is a C++ header-only template library providing basic
392 tools (containers, algorithms) used by other QuantStack packages.")
393 (license license:bsd-3)))
398 (version "0.20190823.6")
403 (url "https://github.com/MaskRay/ccls")
406 (base32 "11h5nwk4qqshf3i8yr4bxpnvmidrhkzd0zxhf1xqv8cv6r08k47f"))
407 (file-name (git-file-name name version))))
408 (build-system cmake-build-system)
410 '(#:tests? #f)) ; no check target
412 `(("rapidjson" ,rapidjson)))
416 (home-page "https://github.com/MaskRay/ccls")
417 (synopsis "C/C++/Objective-C language server")
419 "@code{ccls} is a server implementing the Language Server Protocol (LSP)
420 for C, C++ and Objective-C languages. It uses @code{clang} to perform static
421 code analysis and supports cross references, hierarchies, completion and
422 syntax highlighting. @code{ccls} is derived from @code{cquery} which is not
423 maintained anymore.")
424 (license license:asl2.0)))
426 (define-public gperftools
434 (url "https://github.com/gperftools/gperftools")
435 (commit (string-append "gperftools-" version))))
437 (base32 "1rnc53kaxlljgbpsff906vdsry9jl9gcvcnmxgkprwzxq1wipyd0"))
438 (file-name (git-file-name name version))))
439 (build-system gnu-build-system)
441 `(("autoconf" ,autoconf)
442 ("automake" ,automake)
446 (home-page "https://github.com/gperftools/gperftools")
447 (synopsis "Multi-threaded malloc() and performance analysis tools for C++")
449 "@code{gperftools} is a collection of a high-performance multi-threaded
450 malloc() implementation plus some thread-friendly performance analysis
459 (license license:bsd-3)))
461 (define-public cpplint
468 ;; Fetch from github instead of pypi, since the test cases are not in
471 (url "https://github.com/cpplint/cpplint")
474 (base32 "1yzcxqx0186sh80p0ydl9z0ld51fn2cdpz9hmhrp15j53g9ira7c"))
475 (file-name (git-file-name name version))))
478 (modify-phases %standard-phases
479 (add-before 'check 'use-later-pytest
481 (substitute* "test-requirements"
482 (("pytest.*") "pytest\n"))
484 (build-system python-build-system)
486 `(("python-pytest" ,python-pytest)
487 ("python-pytest-cov" ,python-pytest-cov)
488 ("python-pytest-runner" ,python-pytest-runner)))
489 (home-page "https://github.com/cpplint/cpplint")
490 (synopsis "Static code checker for C++")
491 (description "@code{cpplint} is a command-line tool to check C/C++ files
492 for style issues following Google’s C++ style guide. While Google maintains
493 it's own version of the tool, this is a fork that aims to be more responsive
494 and make @code{cpplint} usable in wider contexts.")
495 (license license:bsd-3)))
497 (define-public reproc
505 (url "https://github.com/DaanDeMeyer/reproc")
506 (commit (string-append "v" version))))
507 (file-name (git-file-name name version))
510 "1n71wb50qv2dmhjgw7azx5gigbrp19l2n3d41g9p05l5l0y1qg0q"))))
511 (build-system cmake-build-system)
515 ;; Enable building of shared library.
516 #:configure-flags `("-DBUILD_SHARED_LIBS=1")))
518 `(("pkg-config" ,pkg-config)))
519 (synopsis "Process IO library")
520 (description "reproc (Redirected Process) is a C/C++ library that
521 simplifies starting, stopping and communicating with external programs. The
522 main use case is executing command line applications directly from C or C++
523 code and retrieving their output.")
524 (home-page "https://github.com/DaanDeMeyer/reproc")
525 (license license:expat)))
527 (define-public sobjectizer
535 (url "https://github.com/Stiffstream/sobjectizer")
536 (commit (string-append "v." version))))
538 (base32 "0jfai7sqxnnjkms38krm7mssj5l79nb3pllkbyj4j581a7l5j6l5"))
539 (file-name (git-file-name name version))))
540 (build-system cmake-build-system)
544 (modify-phases %standard-phases
545 (add-after 'unpack 'change-directory
549 (home-page "https://stiffstream.com/en/products/sobjectizer.html")
550 (synopsis "Cross-platform actor framework for C++")
552 "SObjectizer is a cross-platform \"actor frameworks\" for C++.
553 SObjectizer supports not only the Actor Model but also the Publish-Subscribe
554 Model and CSP-like channels. The goal of SObjectizer is to simplify
555 development of concurrent and multithreaded applications in C++.")
556 (license license:bsd-3)))
558 (define-public tweeny
566 (url "https://github.com/mobius3/tweeny")
567 (commit (string-append "v" version))))
568 (file-name (git-file-name name version))
570 (base32 "1adm4c17pi7xf3kf6sjyxibz5rdg1ka236p72xsm6js4j9gzlbp4"))))
572 '(#:tests? #f)) ;no check target
573 (build-system cmake-build-system)
574 (home-page "https://mobius3.github.io/tweeny/")
575 (synopsis "Modern C++ tweening library")
576 (description "@code{Tweeny} is an inbetweening library designed for the
577 creation of complex animations for games and other beautiful interactive
578 software. It leverages features of modern @code{C++} to empower developers with
579 an intuitive API for declaring tweenings of any type of value, as long as they
580 support arithmetic operations. The goal of @code{Tweeny} is to provide means to
581 create fluid interpolations when animating position, scale, rotation, frames or
582 other values of screen objects, by setting their values as the tween starting
583 point and then, after each tween step, plugging back the result.")
584 (license license:expat)))
586 (define-public abseil-cpp
589 (version "20200225.2")
593 (url "https://github.com/abseil/abseil-cpp")
595 (file-name (git-file-name name version))
598 "0dwxg54pv6ihphbia0iw65r64whd7v8nm4wwhcz219642cgpv54y"))))
599 (build-system cmake-build-system)
601 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
602 "-DABSL_RUN_TESTS=ON"
603 ;; Needed, else we get errors like:
605 ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
606 ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
607 ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
608 ;; error adding symbols: DSO missing from command line
609 ;; collect2: error: ld returned 1 exit status
610 "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")
612 (modify-phases %standard-phases
613 (add-before 'configure 'remove-gtest-check
614 ;; The CMakeLists fails to find our googletest for some reason, but
615 ;; it works nonetheless.
617 (substitute* "CMakeLists.txt"
618 (("check_target\\(gtest\\)") "")
619 (("check_target\\(gtest_main\\)") "")
620 (("check_target\\(gmock\\)") "")))))))
622 `(("googletest" ,googletest)))
623 (home-page "https://abseil.io")
624 (synopsis "Augmented C++ standard library")
625 (description "Abseil is a collection of C++ library code designed to
626 augment the C++ standard library. The Abseil library code is collected from
627 Google's C++ code base.")
628 (license license:asl2.0)))
637 (url "https://github.com/taocpp/PEGTL")
639 (file-name (git-file-name name version))
642 "17crgjfdx55imi2dqnz6xpvsxq07390yfgkz5nd2g77ydkvq9db3"))))
643 (build-system cmake-build-system)
644 (home-page "https://github.com/taocpp/PEGTL")
645 (synopsis "Parsing Expression Grammar template library")
646 (description "The Parsing Expression Grammar Template Library (PEGTL) is
647 a zero-dependency C++ header-only parser combinator library for creating
648 parsers according to a Parsing Expression Grammar (PEG).")
649 (license license:expat)))