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>
14 ;;; This file is part of GNU Guix.
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29 (define-module (gnu packages cpp)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix build-system cmake)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system python)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages autotools)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages code)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages llvm)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages tls)
46 #:use-module (gnu packages web))
54 ;; Warning: This source has proved unreliable 1 time at least.
55 ;; Consider an alternate source or report upstream if this
57 (uri (string-append "https://mediaarea.net/download/source/"
59 "libzen_" version ".tar.bz2"))
62 "1nkygc17sndznpcf71fdrhwpm8z9a3hc9csqlafwswh49axhfkjr"))))
64 `(("autoconf" ,autoconf)
65 ("automake" ,automake)
66 ("libtool" ,libtool)))
67 (build-system gnu-build-system)
70 ;; The build scripts are not at the root of the archive.
71 (modify-phases %standard-phases
72 (add-after 'unpack 'pre-configure
74 (chdir "Project/GNU/Library")
76 (home-page "https://github.com/MediaArea/ZenLib")
77 (synopsis "C++ utility library")
78 (description "ZenLib is a C++ utility library. It includes classes for handling
79 strings, configuration, bit streams, threading, translation, and cross-platform
80 operating system functions.")
81 (license license:zlib)))
84 (let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
88 (version (git-version "0.0.0" revision commit))
92 (url "https://github.com/Andersbakken/rct")
96 "1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
97 (patches (search-patches "rct-add-missing-headers.patch"))
98 (file-name (git-file-name name version))))
99 (build-system cmake-build-system)
102 '("-DWITH_TESTS=ON" ; To run the test suite
103 "-DRCT_RTTI_ENABLED=ON")))
105 `(("cppunit" ,cppunit)
106 ("pkg-config" ,pkg-config)))
108 `(("openssl" ,openssl)
110 (home-page "https://github.com/Andersbakken/rct")
111 (synopsis "C++ library providing Qt-like APIs on top of the STL")
112 (description "Rct is a set of C++ tools that provide nicer (more Qt-like)
113 APIs on top of Standard Template Library (@dfn{STL}) classes.")
114 (license (list license:expat ; cJSON
115 license:bsd-4))))) ; everything else (LICENSE.txt)
117 (define-public dashel
125 (url "https://github.com/aseba-community/dashel.git")
128 (base32 "0anks2l2i2qp0wlzqck1qgpq15a3l6dg8lw2h8s4nsj7f61lffwy"))
129 (file-name (git-file-name name version))))
130 (build-system cmake-build-system)
131 (arguments '(#:tests? #f)) ; no tests
132 (native-inputs `(("pkg-config" ,pkg-config)))
133 (home-page "https://github.com/aseba-community/dashel")
134 (synopsis "Data stream helper encapsulation library")
136 "Dashel is a data stream helper encapsulation C++ library. It provides a
137 unified access to TCP/UDP sockets, serial ports, console, and files streams.
138 It also allows a server application to wait for any activity on any
139 combination of these streams.")
140 (license license:bsd-3)))
150 (url "https://github.com/QuantStack/xsimd.git")
153 (base32 "1ny2qin1j4h35mljivh8z52kwdyjxf4yxlzb8j52ji91v2ccc88j"))
154 (file-name (git-file-name name version))))
155 (build-system cmake-build-system)
157 `(#:configure-flags (list "-DBUILD_TESTS=ON")
158 #:test-target "xtest"))
160 `(("googletest" ,googletest)))
161 (home-page "https://github.com/QuantStack/xsimd")
162 (synopsis "C++ wrappers for SIMD intrinsics and math implementations")
163 (description "xsimd provides a unified means for using SIMD features for
164 library authors. Namely, it enables manipulation of batches of numbers with
165 the same arithmetic operators as for single values. It also provides
166 accelerated implementation of common mathematical functions operating on
168 (license license:bsd-3)))
170 (define-public fifo-map
171 (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
173 (version (git-version "1.1.1" revision commit)))
177 (home-page "https://github.com/nlohmann/fifo_map")
185 "0pi77b75kp0l7z454ihcd14nzpi3nc5m4nyjbsgy5f9bw3676196"))
186 (patches (search-patches "fifo-map-remove-catch.hpp.patch"
187 "fifo-map-fix-flags-for-gcc.patch"))
188 (file-name (git-file-name name version))
189 (modules '((guix build utils)))
190 (snippet '(delete-file-recursively "./test/thirdparty"))))
192 `(("catch2" ,catch-framework2-1)))
193 (build-system cmake-build-system)
196 (modify-phases %standard-phases
201 (lambda* (#:key outputs #:allow-other-keys)
202 (let* ((out (assoc-ref outputs "out"))
203 (inc (string-append out "/include/fifo_map")))
204 (with-directory-excursion
205 (string-append "../" ,name "-" ,version "-checkout")
206 (install-file "src/fifo_map.hpp" inc)
208 (synopsis "FIFO-ordered associative container for C++")
209 (description "Fifo_map is a C++ header only library for associative
210 container which uses the order in which keys were inserted to the container
211 as ordering relation.")
212 (license license:expat))))
214 (define-public json-modern-cxx
216 (name "json-modern-cxx")
218 (home-page "https://github.com/nlohmann/json")
222 (uri (git-reference (url home-page)
223 (commit (string-append "v" version))))
226 "04rry1xzis71z5gj1ylcj8b4li5q18zxhcwaviwvi3hx0frzxl9w"))
227 (file-name (git-file-name name version))
228 (modules '((guix build utils)))
231 ;; Delete bundled software. Preserve doctest_compatibility.h, which
232 ;; is a wrapper library added by this package.
233 (install-file "./test/thirdparty/doctest/doctest_compatibility.h" "/tmp")
234 (for-each delete-file-recursively
235 '("./third_party" "./test/thirdparty" "./benchmarks/thirdparty"))
236 (install-file "/tmp/doctest_compatibility.h" "./test/thirdparty/doctest")
238 ;; Adjust for the unbundled fifo_map and doctest.
239 (substitute* "./test/thirdparty/doctest/doctest_compatibility.h"
240 (("#include \"doctest\\.h\"")
241 "#include <doctest/doctest.h>"))
242 (with-directory-excursion "test/src"
243 (let ((files (find-files "." "\\.cpp$")))
245 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
247 "#include <fifo_map/" fifo-map-hpp ">")))))
250 `(("amalgamate" ,amalgamate)
251 ("doctest" ,doctest)))
253 `(("fifo-map" ,fifo-map)))
254 (build-system cmake-build-system)
255 (synopsis "JSON parser and printer library for C++")
256 (description "JSON for Modern C++ is a C++ JSON library that provides
257 intuitive syntax and trivial integration.")
258 (license license:expat)))
260 (define-public nlohmann-json-cpp
261 (deprecated-package "nlohmann-json-cpp" json-modern-cxx))
271 (url "https://github.com/QuantStack/xtl.git")
275 "0py70lm2i3sxzpgca2cic8zfn6dn18q837h76a5fchl2c0kpxm91"))
276 (file-name (git-file-name name version))))
278 `(("googletest" ,googletest)
279 ("json-modern-cxx" ,json-modern-cxx)))
282 '("-DBUILD_TESTS=ON")
284 (modify-phases %standard-phases
287 (with-directory-excursion "test"
288 (invoke "./test_xtl")
290 (home-page "https://github.com/QuantStack/xtl")
291 (build-system cmake-build-system)
292 (synopsis "C++ template library providing some basic tools")
293 (description "xtl is a C++ header-only template library providing basic
294 tools (containers, algorithms) used by other QuantStack packages.")
295 (license license:bsd-3)))
300 (version "0.20190823.6")
305 (url "https://github.com/MaskRay/ccls")
308 (base32 "11h5nwk4qqshf3i8yr4bxpnvmidrhkzd0zxhf1xqv8cv6r08k47f"))
309 (file-name (git-file-name name version))))
310 (build-system cmake-build-system)
312 '(#:tests? #f)) ; no check target
314 `(("rapidjson" ,rapidjson)))
318 (home-page "https://github.com/MaskRay/ccls")
319 (synopsis "C/C++/Objective-C language server")
321 "@code{ccls} is a server implementing the Language Server Protocol (LSP)
322 for C, C++ and Objective-C languages. It uses @code{clang} to perform static
323 code analysis and supports cross references, hierarchies, completion and
324 syntax highlighting. @code{ccls} is derived from @code{cquery} which is not
325 maintained anymore.")
326 (license license:asl2.0)))
328 (define-public gperftools
336 (url "https://github.com/gperftools/gperftools")
337 (commit (string-append "gperftools-" version))))
339 (base32 "0amvwrzn5qc0b0jpxpy5g6zkmj97zjh4hhjrd130hsg2lwwcwhy1"))
340 (file-name (git-file-name name version))))
341 (build-system gnu-build-system)
343 `(("autoconf" ,autoconf)
344 ("automake" ,automake)
348 (home-page "https://github.com/gperftools/gperftools")
349 (synopsis "Multi-threaded malloc() and performance analysis tools for C++")
351 "@code{gperftools} is a collection of a high-performance multi-threaded
352 malloc() implementation plus some thread-friendly performance analysis
361 (license license:bsd-3)))
363 (define-public cpplint
370 ;; Fetch from github instead of pypi, since the test cases are not in
373 (url "https://github.com/cpplint/cpplint")
376 (base32 "1yzcxqx0186sh80p0ydl9z0ld51fn2cdpz9hmhrp15j53g9ira7c"))
377 (file-name (git-file-name name version))))
380 (modify-phases %standard-phases
381 (add-before 'check 'use-later-pytest
383 (substitute* "test-requirements"
384 (("pytest.*") "pytest\n"))
386 (build-system python-build-system)
388 `(("python-pytest" ,python-pytest)
389 ("python-pytest-cov" ,python-pytest-cov)
390 ("python-pytest-runner" ,python-pytest-runner)))
391 (home-page "https://github.com/cpplint/cpplint")
392 (synopsis "Static code checker for C++")
393 (description "@code{cpplint} is a command-line tool to check C/C++ files
394 for style issues following Google’s C++ style guide. While Google maintains
395 it's own version of the tool, this is a fork that aims to be more responsive
396 and make @code{cpplint} usable in wider contexts.")
397 (license license:bsd-3)))
399 (define-public sobjectizer
407 (url "https://github.com/Stiffstream/sobjectizer.git")
408 (commit (string-append "v." version))))
410 (base32 "0jfai7sqxnnjkms38krm7mssj5l79nb3pllkbyj4j581a7l5j6l5"))
411 (file-name (git-file-name name version))))
412 (build-system cmake-build-system)
416 (modify-phases %standard-phases
417 (add-after 'unpack 'change-directory
421 (home-page "https://stiffstream.com/en/products/sobjectizer.html")
422 (synopsis "Cross-platform actor framework for C++")
424 "SObjectizer is a cross-platform \"actor frameworks\" for C++.
425 SObjectizer supports not only the Actor Model but also the Publish-Subscribe
426 Model and CSP-like channels. The goal of SObjectizer is to simplify
427 development of concurrent and multithreaded applications in C++.")
428 (license license:bsd-3)))
430 (define-public tweeny
438 (url "https://github.com/mobius3/tweeny.git")
439 (commit (string-append "v" version))))
440 (file-name (git-file-name name version))
442 (base32 "1adm4c17pi7xf3kf6sjyxibz5rdg1ka236p72xsm6js4j9gzlbp4"))))
444 '(#:tests? #f)) ;no check target
445 (build-system cmake-build-system)
446 (home-page "https://mobius3.github.io/tweeny/")
447 (synopsis "Modern C++ tweening library")
448 (description "@code{Tweeny} is an inbetweening library designed for the
449 creation of complex animations for games and other beautiful interactive
450 software. It leverages features of modern @code{C++} to empower developers with
451 an intuitive API for declaring tweenings of any type of value, as long as they
452 support arithmetic operations. The goal of @code{Tweeny} is to provide means to
453 create fluid interpolations when animating position, scale, rotation, frames or
454 other values of screen objects, by setting their values as the tween starting
455 point and then, after each tween step, plugging back the result.")
456 (license license:expat)))
458 (define-public abseil-cpp
461 (version "20200225.1")
465 (url "https://github.com/abseil/abseil-cpp.git")
467 (file-name (git-file-name name version))
470 "035bffayslawc19q2gmlkr6n6r7k7mvriaq7352rv6gyzaplr98w"))))
471 (build-system cmake-build-system)
473 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
474 "-DABSL_RUN_TESTS=ON"
475 ;; Needed, else we get errors like:
477 ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
478 ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
479 ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
480 ;; error adding symbols: DSO missing from command line
481 ;; collect2: error: ld returned 1 exit status
482 "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")
484 (modify-phases %standard-phases
485 (add-before 'configure 'remove-gtest-check
486 ;; The CMakeLists fails to find our googletest for some reason, but
487 ;; it works nonetheless.
489 (substitute* "CMakeLists.txt"
490 (("check_target\\(gtest\\)") "")
491 (("check_target\\(gtest_main\\)") "")
492 (("check_target\\(gmock\\)") "")))))))
494 `(("googletest" ,googletest)))
495 (home-page "https://abseil.io")
496 (synopsis "Augmented C++ standard library")
497 (description "Abseil is a collection of C++ library code designed to
498 augment the C++ standard library. The Abseil library code is collected from
499 Google's C++ code base.")
500 (license license:asl2.0)))
509 (url "https://github.com/taocpp/PEGTL.git")
511 (file-name (git-file-name name version))
514 "17crgjfdx55imi2dqnz6xpvsxq07390yfgkz5nd2g77ydkvq9db3"))))
515 (build-system cmake-build-system)
516 (home-page "https://github.com/taocpp/PEGTL")
517 (synopsis "Parsing Expression Grammar template library")
518 (description "The Parsing Expression Grammar Template Library (PEGTL) is
519 a zero-dependency C++ header-only parser combinator library for creating
520 parsers according to a Parsing Expression Grammar (PEG).")
521 (license license:expat)))