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>
17 ;;; This file is part of GNU Guix.
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32 (define-module (gnu packages cpp)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix build-system cmake)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system python)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages autotools)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages code)
44 #:use-module (gnu packages compression)
45 #:use-module (gnu packages llvm)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages tls)
49 #:use-module (gnu packages web))
57 ;; Warning: This source has proved unreliable 1 time at least.
58 ;; Consider an alternate source or report upstream if this
60 (uri (string-append "https://mediaarea.net/download/source/"
62 "libzen_" version ".tar.bz2"))
65 "1nkygc17sndznpcf71fdrhwpm8z9a3hc9csqlafwswh49axhfkjr"))))
67 `(("autoconf" ,autoconf)
68 ("automake" ,automake)
69 ("libtool" ,libtool)))
70 (build-system gnu-build-system)
73 ;; The build scripts are not at the root of the archive.
74 (modify-phases %standard-phases
75 (add-after 'unpack 'pre-configure
77 (chdir "Project/GNU/Library")
79 (home-page "https://github.com/MediaArea/ZenLib")
80 (synopsis "C++ utility library")
81 (description "ZenLib is a C++ utility library. It includes classes for handling
82 strings, configuration, bit streams, threading, translation, and cross-platform
83 operating system functions.")
84 (license license:zlib)))
94 (url "https://github.com/rttrorg/rttr/")
95 (commit (string-append "v" version))))
97 (base32 "1yxad8sj40wi75hny8w6imrsx8wjasjmsipnlq559n4b6kl84ijp"))
98 (file-name (git-file-name name version))))
99 (build-system cmake-build-system)
101 '(;; No check target. Setting test-target to "unit_test" runs it twice.
104 '("-DBUILD_DOCUMENTATION=OFF" "-DBUILD_EXAMPLES=OFF")
106 (modify-phases %standard-phases
107 ;; library_test fails in chroot.
108 (add-after 'unpack 'skip-library-test
110 (substitute* "src/unit_tests/unit_tests.cmake"
111 (("misc/library_test.cpp") ""))
113 (native-inputs `(("pkg-config" ,pkg-config)))
114 (home-page "https://github.com/rttrorg/rttr/")
115 (synopsis "C++ Reflection Library")
117 "RTTR stands for Run Time Type Reflection. It describes the ability of a
118 computer program to introspect and modify an object at runtime. It is also
119 the name of the library itself, which is written in C++.")
120 (license license:expat)))
123 (let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
127 (version (git-version "0.0.0" revision commit))
131 (url "https://github.com/Andersbakken/rct")
135 "1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
136 (patches (search-patches "rct-add-missing-headers.patch"))
137 (file-name (git-file-name name version))))
138 (build-system cmake-build-system)
141 '("-DWITH_TESTS=ON" ; To run the test suite
142 "-DRCT_RTTI_ENABLED=ON")))
144 `(("cppunit" ,cppunit)
145 ("pkg-config" ,pkg-config)))
147 `(("openssl" ,openssl)
149 (home-page "https://github.com/Andersbakken/rct")
150 (synopsis "C++ library providing Qt-like APIs on top of the STL")
151 (description "Rct is a set of C++ tools that provide nicer (more Qt-like)
152 APIs on top of Standard Template Library (@dfn{STL}) classes.")
153 (license (list license:expat ; cJSON
154 license:bsd-4))))) ; everything else (LICENSE.txt)
156 (define-public dashel
164 (url "https://github.com/aseba-community/dashel")
167 (base32 "0anks2l2i2qp0wlzqck1qgpq15a3l6dg8lw2h8s4nsj7f61lffwy"))
168 (file-name (git-file-name name version))))
169 (build-system cmake-build-system)
170 (arguments '(#:tests? #f)) ; no tests
171 (native-inputs `(("pkg-config" ,pkg-config)))
172 (home-page "https://github.com/aseba-community/dashel")
173 (synopsis "Data stream helper encapsulation library")
175 "Dashel is a data stream helper encapsulation C++ library. It provides a
176 unified access to TCP/UDP sockets, serial ports, console, and files streams.
177 It also allows a server application to wait for any activity on any
178 combination of these streams.")
179 (license license:bsd-3)))
189 (url "https://github.com/QuantStack/xsimd")
192 (base32 "1ny2qin1j4h35mljivh8z52kwdyjxf4yxlzb8j52ji91v2ccc88j"))
193 (file-name (git-file-name name version))))
194 (build-system cmake-build-system)
196 `(#:configure-flags (list "-DBUILD_TESTS=ON")
197 #:test-target "xtest"))
199 `(("googletest" ,googletest)))
200 (home-page "https://github.com/QuantStack/xsimd")
201 (synopsis "C++ wrappers for SIMD intrinsics and math implementations")
202 (description "xsimd provides a unified means for using SIMD features for
203 library authors. Namely, it enables manipulation of batches of numbers with
204 the same arithmetic operators as for single values. It also provides
205 accelerated implementation of common mathematical functions operating on
207 (license license:bsd-3)))
209 (define-public chaiscript
217 (url "https://github.com/ChaiScript/ChaiScript")
218 (commit (string-append "v" version))))
219 (file-name (git-file-name name version))
221 (base32 "0i1c88rn1wwz8nf3dpapcdkk4w623m3nksfy5yjai10k9irkzy3c"))))
222 (build-system cmake-build-system)
223 (home-page "https://chaiscript.com/")
224 (synopsis "Embedded scripting language designed for C++")
226 "ChaiScript is one of the only embedded scripting language designed from
227 the ground up to directly target C++ and take advantage of modern C++
228 development techniques. Being a native C++ application, it has some advantages
229 over existing embedded scripting languages:
232 @item Uses a header-only approach, which makes it easy to integrate with
234 @item Maintains type safety between your C++ application and the user scripts.
235 @item Supports a variety of C++ techniques including callbacks, overloaded
236 functions, class methods, and stl containers.
238 (license license:bsd-3)))
240 (define-public fifo-map
241 (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
243 (version (git-version "1.1.1" revision commit)))
247 (home-page "https://github.com/nlohmann/fifo_map")
255 "0pi77b75kp0l7z454ihcd14nzpi3nc5m4nyjbsgy5f9bw3676196"))
256 (patches (search-patches "fifo-map-remove-catch.hpp.patch"
257 "fifo-map-fix-flags-for-gcc.patch"))
258 (file-name (git-file-name name version))
259 (modules '((guix build utils)))
260 (snippet '(delete-file-recursively "./test/thirdparty"))))
262 `(("catch2" ,catch-framework2-1)))
263 (build-system cmake-build-system)
266 (modify-phases %standard-phases
271 (lambda* (#:key outputs #:allow-other-keys)
272 (let* ((out (assoc-ref outputs "out"))
273 (inc (string-append out "/include/fifo_map")))
274 (with-directory-excursion
275 (string-append "../" ,name "-" ,version "-checkout")
276 (install-file "src/fifo_map.hpp" inc)
278 (synopsis "FIFO-ordered associative container for C++")
279 (description "Fifo_map is a C++ header only library for associative
280 container which uses the order in which keys were inserted to the container
281 as ordering relation.")
282 (license license:expat))))
284 (define-public json-modern-cxx
286 (name "json-modern-cxx")
288 (home-page "https://github.com/nlohmann/json")
292 (uri (git-reference (url home-page)
293 (commit (string-append "v" version))))
295 (base32 "0ar4mzp53lskxw3vdzw07f47njcshl3lwid9jfq6l7yx6ds2nyjc"))
296 (file-name (git-file-name name version))
297 (modules '((guix build utils)))
300 ;; Delete bundled software. Preserve doctest_compatibility.h, which
301 ;; is a wrapper library added by this package.
302 (install-file "./test/thirdparty/doctest/doctest_compatibility.h" "/tmp")
303 (for-each delete-file-recursively
304 '("./third_party" "./test/thirdparty" "./benchmarks/thirdparty"))
305 (install-file "/tmp/doctest_compatibility.h" "./test/thirdparty/doctest")
307 ;; Adjust for the unbundled fifo_map and doctest.
308 (substitute* "./test/thirdparty/doctest/doctest_compatibility.h"
309 (("#include \"doctest\\.h\"")
310 "#include <doctest/doctest.h>"))
311 (with-directory-excursion "test/src"
312 (let ((files (find-files "." "\\.cpp$")))
314 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
316 "#include <fifo_map/" fifo-map-hpp ">")))))
318 (build-system cmake-build-system)
321 (list (string-append "-DJSON_TestDataDirectory="
322 (assoc-ref %build-inputs "json_test_data")))
323 #:phases (modify-phases %standard-phases
324 ;; XXX: When tests are enabled, the install phase will cause
325 ;; a needless rebuild without the given configure flags,
326 ;; ultimately creating both $out/lib and $out/lib64. Move
327 ;; the check phase after install to work around it.
329 (add-after 'install 'check
330 (lambda* (#:key tests? #:allow-other-keys)
332 ;; Some tests need git and a full checkout, skip those.
333 (invoke "ctest" "-LE" "git_required")
334 (format #t "test suite not run~%"))
337 `(("amalgamate" ,amalgamate)
340 ,(let ((version "3.0.0"))
344 (url "https://github.com/nlohmann/json_test_data")
345 (commit (string-append "v" version))))
346 (file-name (git-file-name "json_test_data" version))
349 "0nzsjzlvk14dazwh7k2jb1dinb0pv9jbx5jsyn264wvva0y7daiv")))))))
351 `(("fifo-map" ,fifo-map)))
352 (synopsis "JSON parser and printer library for C++")
353 (description "JSON for Modern C++ is a C++ JSON library that provides
354 intuitive syntax and trivial integration.")
355 (license license:expat)))
357 (define-public nlohmann-json-cpp
358 (deprecated-package "nlohmann-json-cpp" json-modern-cxx))
368 (url "https://github.com/QuantStack/xtl")
372 "0s9gnv1wq0cmpw878dmx0lnci86895hhdrwyc9x8lfbc1hr7ypnh"))
373 (file-name (git-file-name name version))))
375 `(("googletest" ,googletest)
376 ("json-modern-cxx" ,json-modern-cxx)))
379 '("-DBUILD_TESTS=ON")
381 (modify-phases %standard-phases
384 (with-directory-excursion "test"
385 (invoke "./test_xtl")
387 (home-page "https://github.com/QuantStack/xtl")
388 (build-system cmake-build-system)
389 (synopsis "C++ template library providing some basic tools")
390 (description "xtl is a C++ header-only template library providing basic
391 tools (containers, algorithms) used by other QuantStack packages.")
392 (license license:bsd-3)))
397 (version "0.20190823.6")
402 (url "https://github.com/MaskRay/ccls")
405 (base32 "11h5nwk4qqshf3i8yr4bxpnvmidrhkzd0zxhf1xqv8cv6r08k47f"))
406 (file-name (git-file-name name version))))
407 (build-system cmake-build-system)
409 '(#:tests? #f)) ; no check target
411 `(("rapidjson" ,rapidjson)))
415 (home-page "https://github.com/MaskRay/ccls")
416 (synopsis "C/C++/Objective-C language server")
418 "@code{ccls} is a server implementing the Language Server Protocol (LSP)
419 for C, C++ and Objective-C languages. It uses @code{clang} to perform static
420 code analysis and supports cross references, hierarchies, completion and
421 syntax highlighting. @code{ccls} is derived from @code{cquery} which is not
422 maintained anymore.")
423 (license license:asl2.0)))
425 (define-public gperftools
433 (url "https://github.com/gperftools/gperftools")
434 (commit (string-append "gperftools-" version))))
436 (base32 "1rnc53kaxlljgbpsff906vdsry9jl9gcvcnmxgkprwzxq1wipyd0"))
437 (file-name (git-file-name name version))))
438 (build-system gnu-build-system)
440 `(("autoconf" ,autoconf)
441 ("automake" ,automake)
445 (home-page "https://github.com/gperftools/gperftools")
446 (synopsis "Multi-threaded malloc() and performance analysis tools for C++")
448 "@code{gperftools} is a collection of a high-performance multi-threaded
449 malloc() implementation plus some thread-friendly performance analysis
458 (license license:bsd-3)))
460 (define-public cpplint
467 ;; Fetch from github instead of pypi, since the test cases are not in
470 (url "https://github.com/cpplint/cpplint")
473 (base32 "1yzcxqx0186sh80p0ydl9z0ld51fn2cdpz9hmhrp15j53g9ira7c"))
474 (file-name (git-file-name name version))))
477 (modify-phases %standard-phases
478 (add-before 'check 'use-later-pytest
480 (substitute* "test-requirements"
481 (("pytest.*") "pytest\n"))
483 (build-system python-build-system)
485 `(("python-pytest" ,python-pytest)
486 ("python-pytest-cov" ,python-pytest-cov)
487 ("python-pytest-runner" ,python-pytest-runner)))
488 (home-page "https://github.com/cpplint/cpplint")
489 (synopsis "Static code checker for C++")
490 (description "@code{cpplint} is a command-line tool to check C/C++ files
491 for style issues following Google’s C++ style guide. While Google maintains
492 it's own version of the tool, this is a fork that aims to be more responsive
493 and make @code{cpplint} usable in wider contexts.")
494 (license license:bsd-3)))
496 (define-public sobjectizer
504 (url "https://github.com/Stiffstream/sobjectizer")
505 (commit (string-append "v." version))))
507 (base32 "0jfai7sqxnnjkms38krm7mssj5l79nb3pllkbyj4j581a7l5j6l5"))
508 (file-name (git-file-name name version))))
509 (build-system cmake-build-system)
513 (modify-phases %standard-phases
514 (add-after 'unpack 'change-directory
518 (home-page "https://stiffstream.com/en/products/sobjectizer.html")
519 (synopsis "Cross-platform actor framework for C++")
521 "SObjectizer is a cross-platform \"actor frameworks\" for C++.
522 SObjectizer supports not only the Actor Model but also the Publish-Subscribe
523 Model and CSP-like channels. The goal of SObjectizer is to simplify
524 development of concurrent and multithreaded applications in C++.")
525 (license license:bsd-3)))
527 (define-public tweeny
535 (url "https://github.com/mobius3/tweeny")
536 (commit (string-append "v" version))))
537 (file-name (git-file-name name version))
539 (base32 "1adm4c17pi7xf3kf6sjyxibz5rdg1ka236p72xsm6js4j9gzlbp4"))))
541 '(#:tests? #f)) ;no check target
542 (build-system cmake-build-system)
543 (home-page "https://mobius3.github.io/tweeny/")
544 (synopsis "Modern C++ tweening library")
545 (description "@code{Tweeny} is an inbetweening library designed for the
546 creation of complex animations for games and other beautiful interactive
547 software. It leverages features of modern @code{C++} to empower developers with
548 an intuitive API for declaring tweenings of any type of value, as long as they
549 support arithmetic operations. The goal of @code{Tweeny} is to provide means to
550 create fluid interpolations when animating position, scale, rotation, frames or
551 other values of screen objects, by setting their values as the tween starting
552 point and then, after each tween step, plugging back the result.")
553 (license license:expat)))
555 (define-public abseil-cpp
558 (version "20200225.2")
562 (url "https://github.com/abseil/abseil-cpp")
564 (file-name (git-file-name name version))
567 "0dwxg54pv6ihphbia0iw65r64whd7v8nm4wwhcz219642cgpv54y"))))
568 (build-system cmake-build-system)
570 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
571 "-DABSL_RUN_TESTS=ON"
572 ;; Needed, else we get errors like:
574 ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
575 ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
576 ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
577 ;; error adding symbols: DSO missing from command line
578 ;; collect2: error: ld returned 1 exit status
579 "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")
581 (modify-phases %standard-phases
582 (add-before 'configure 'remove-gtest-check
583 ;; The CMakeLists fails to find our googletest for some reason, but
584 ;; it works nonetheless.
586 (substitute* "CMakeLists.txt"
587 (("check_target\\(gtest\\)") "")
588 (("check_target\\(gtest_main\\)") "")
589 (("check_target\\(gmock\\)") "")))))))
591 `(("googletest" ,googletest)))
592 (home-page "https://abseil.io")
593 (synopsis "Augmented C++ standard library")
594 (description "Abseil is a collection of C++ library code designed to
595 augment the C++ standard library. The Abseil library code is collected from
596 Google's C++ code base.")
597 (license license:asl2.0)))
606 (url "https://github.com/taocpp/PEGTL")
608 (file-name (git-file-name name version))
611 "17crgjfdx55imi2dqnz6xpvsxq07390yfgkz5nd2g77ydkvq9db3"))))
612 (build-system cmake-build-system)
613 (home-page "https://github.com/taocpp/PEGTL")
614 (synopsis "Parsing Expression Grammar template library")
615 (description "The Parsing Expression Grammar Template Library (PEGTL) is
616 a zero-dependency C++ header-only parser combinator library for creating
617 parsers according to a Parsing Expression Grammar (PEG).")
618 (license license:expat)))