gnu: qtserialbus: Add libsocketcan support.
[jackhill/guix/guix.git] / gnu / packages / cpp.scm
... / ...
CommitLineData
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;;;
16;;; This file is part of GNU Guix.
17;;;
18;;; GNU Guix is free software; you can redistribute it and/or modify it
19;;; under the terms of the GNU General Public License as published by
20;;; the Free Software Foundation; either version 3 of the License, or (at
21;;; your option) any later version.
22;;;
23;;; GNU Guix is distributed in the hope that it will be useful, but
24;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26;;; GNU General Public License for more details.
27;;;
28;;; You should have received a copy of the GNU General Public License
29;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31(define-module (gnu packages cpp)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix git-download)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system python)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages code)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages llvm)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages tls)
48 #:use-module (gnu packages web))
49
50(define-public libzen
51 (package
52 (name "libzen")
53 (version "0.4.38")
54 (source (origin
55 (method url-fetch)
56 ;; Warning: This source has proved unreliable 1 time at least.
57 ;; Consider an alternate source or report upstream if this
58 ;; happens again.
59 (uri (string-append "https://mediaarea.net/download/source/"
60 "libzen/" version "/"
61 "libzen_" version ".tar.bz2"))
62 (sha256
63 (base32
64 "1nkygc17sndznpcf71fdrhwpm8z9a3hc9csqlafwswh49axhfkjr"))))
65 (native-inputs
66 `(("autoconf" ,autoconf)
67 ("automake" ,automake)
68 ("libtool" ,libtool)))
69 (build-system gnu-build-system)
70 (arguments
71 '(#:phases
72 ;; The build scripts are not at the root of the archive.
73 (modify-phases %standard-phases
74 (add-after 'unpack 'pre-configure
75 (lambda _
76 (chdir "Project/GNU/Library")
77 #t)))))
78 (home-page "https://github.com/MediaArea/ZenLib")
79 (synopsis "C++ utility library")
80 (description "ZenLib is a C++ utility library. It includes classes for handling
81strings, configuration, bit streams, threading, translation, and cross-platform
82operating system functions.")
83 (license license:zlib)))
84
85(define-public rct
86 (let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
87 (revision "2"))
88 (package
89 (name "rct")
90 (version (git-version "0.0.0" revision commit))
91 (source (origin
92 (method git-fetch)
93 (uri (git-reference
94 (url "https://github.com/Andersbakken/rct")
95 (commit commit)))
96 (sha256
97 (base32
98 "1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
99 (patches (search-patches "rct-add-missing-headers.patch"))
100 (file-name (git-file-name name version))))
101 (build-system cmake-build-system)
102 (arguments
103 '(#:configure-flags
104 '("-DWITH_TESTS=ON" ; To run the test suite
105 "-DRCT_RTTI_ENABLED=ON")))
106 (native-inputs
107 `(("cppunit" ,cppunit)
108 ("pkg-config" ,pkg-config)))
109 (inputs
110 `(("openssl" ,openssl)
111 ("zlib" ,zlib)))
112 (home-page "https://github.com/Andersbakken/rct")
113 (synopsis "C++ library providing Qt-like APIs on top of the STL")
114 (description "Rct is a set of C++ tools that provide nicer (more Qt-like)
115 APIs on top of Standard Template Library (@dfn{STL}) classes.")
116 (license (list license:expat ; cJSON
117 license:bsd-4))))) ; everything else (LICENSE.txt)
118
119(define-public dashel
120 (package
121 (name "dashel")
122 (version "1.3.3")
123 (source
124 (origin
125 (method git-fetch)
126 (uri (git-reference
127 (url "https://github.com/aseba-community/dashel")
128 (commit version)))
129 (sha256
130 (base32 "0anks2l2i2qp0wlzqck1qgpq15a3l6dg8lw2h8s4nsj7f61lffwy"))
131 (file-name (git-file-name name version))))
132 (build-system cmake-build-system)
133 (arguments '(#:tests? #f)) ; no tests
134 (native-inputs `(("pkg-config" ,pkg-config)))
135 (home-page "https://github.com/aseba-community/dashel")
136 (synopsis "Data stream helper encapsulation library")
137 (description
138 "Dashel is a data stream helper encapsulation C++ library. It provides a
139unified access to TCP/UDP sockets, serial ports, console, and files streams.
140It also allows a server application to wait for any activity on any
141combination of these streams.")
142 (license license:bsd-3)))
143
144(define-public xsimd
145 (package
146 (name "xsimd")
147 (version "7.2.3")
148 (source
149 (origin
150 (method git-fetch)
151 (uri (git-reference
152 (url "https://github.com/QuantStack/xsimd")
153 (commit version)))
154 (sha256
155 (base32 "1ny2qin1j4h35mljivh8z52kwdyjxf4yxlzb8j52ji91v2ccc88j"))
156 (file-name (git-file-name name version))))
157 (build-system cmake-build-system)
158 (arguments
159 `(#:configure-flags (list "-DBUILD_TESTS=ON")
160 #:test-target "xtest"))
161 (native-inputs
162 `(("googletest" ,googletest)))
163 (home-page "https://github.com/QuantStack/xsimd")
164 (synopsis "C++ wrappers for SIMD intrinsics and math implementations")
165 (description "xsimd provides a unified means for using SIMD features for
166library authors. Namely, it enables manipulation of batches of numbers with
167the same arithmetic operators as for single values. It also provides
168accelerated implementation of common mathematical functions operating on
169batches.")
170 (license license:bsd-3)))
171
172(define-public chaiscript
173 (package
174 (name "chaiscript")
175 (version "6.1.0")
176 (source
177 (origin
178 (method git-fetch)
179 (uri (git-reference
180 (url "https://github.com/ChaiScript/ChaiScript")
181 (commit (string-append "v" version))))
182 (file-name (git-file-name name version))
183 (sha256
184 (base32 "0i1c88rn1wwz8nf3dpapcdkk4w623m3nksfy5yjai10k9irkzy3c"))))
185 (build-system cmake-build-system)
186 (home-page "https://chaiscript.com/")
187 (synopsis "Embedded scripting language designed for C++")
188 (description
189 "ChaiScript is one of the only embedded scripting language designed from
190the ground up to directly target C++ and take advantage of modern C++
191development techniques. Being a native C++ application, it has some advantages
192over existing embedded scripting languages:
193
194@enumerate
195@item Uses a header-only approach, which makes it easy to integrate with
196existing projects.
197@item Maintains type safety between your C++ application and the user scripts.
198@item Supports a variety of C++ techniques including callbacks, overloaded
199functions, class methods, and stl containers.
200@end enumerate\n")
201 (license license:bsd-3)))
202
203(define-public fifo-map
204 (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
205 (revision "0")
206 (version (git-version "1.1.1" revision commit)))
207 (package
208 (name "fifo-map")
209 (version version)
210 (home-page "https://github.com/nlohmann/fifo_map")
211 (source (origin
212 (method git-fetch)
213 (uri (git-reference
214 (url home-page)
215 (commit commit)))
216 (sha256
217 (base32
218 "0pi77b75kp0l7z454ihcd14nzpi3nc5m4nyjbsgy5f9bw3676196"))
219 (patches (search-patches "fifo-map-remove-catch.hpp.patch"
220 "fifo-map-fix-flags-for-gcc.patch"))
221 (file-name (git-file-name name version))
222 (modules '((guix build utils)))
223 (snippet '(delete-file-recursively "./test/thirdparty"))))
224 (native-inputs
225 `(("catch2" ,catch-framework2-1)))
226 (build-system cmake-build-system)
227 (arguments
228 `(#:phases
229 (modify-phases %standard-phases
230 (replace 'check
231 (lambda _
232 (invoke "./unit")))
233 (replace 'install
234 (lambda* (#:key outputs #:allow-other-keys)
235 (let* ((out (assoc-ref outputs "out"))
236 (inc (string-append out "/include/fifo_map")))
237 (with-directory-excursion
238 (string-append "../" ,name "-" ,version "-checkout")
239 (install-file "src/fifo_map.hpp" inc)
240 #t)))))))
241 (synopsis "FIFO-ordered associative container for C++")
242 (description "Fifo_map is a C++ header only library for associative
243container which uses the order in which keys were inserted to the container
244as ordering relation.")
245 (license license:expat))))
246
247(define-public json-modern-cxx
248 (package
249 (name "json-modern-cxx")
250 (version "3.9.1")
251 (home-page "https://github.com/nlohmann/json")
252 (source
253 (origin
254 (method git-fetch)
255 (uri (git-reference (url home-page)
256 (commit (string-append "v" version))))
257 (sha256
258 (base32 "0ar4mzp53lskxw3vdzw07f47njcshl3lwid9jfq6l7yx6ds2nyjc"))
259 (file-name (git-file-name name version))
260 (modules '((guix build utils)))
261 (snippet
262 '(begin
263 ;; Delete bundled software. Preserve doctest_compatibility.h, which
264 ;; is a wrapper library added by this package.
265 (install-file "./test/thirdparty/doctest/doctest_compatibility.h" "/tmp")
266 (for-each delete-file-recursively
267 '("./third_party" "./test/thirdparty" "./benchmarks/thirdparty"))
268 (install-file "/tmp/doctest_compatibility.h" "./test/thirdparty/doctest")
269
270 ;; Adjust for the unbundled fifo_map and doctest.
271 (substitute* "./test/thirdparty/doctest/doctest_compatibility.h"
272 (("#include \"doctest\\.h\"")
273 "#include <doctest/doctest.h>"))
274 (with-directory-excursion "test/src"
275 (let ((files (find-files "." "\\.cpp$")))
276 (substitute* files
277 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
278 (string-append
279 "#include <fifo_map/" fifo-map-hpp ">")))))
280 #t))))
281 (build-system cmake-build-system)
282 (arguments
283 '(#:configure-flags
284 (list (string-append "-DJSON_TestDataDirectory="
285 (assoc-ref %build-inputs "json_test_data")))
286 #:phases (modify-phases %standard-phases
287 ;; XXX: When tests are enabled, the install phase will cause
288 ;; a needless rebuild without the given configure flags,
289 ;; ultimately creating both $out/lib and $out/lib64. Move
290 ;; the check phase after install to work around it.
291 (delete 'check)
292 (add-after 'install 'check
293 (lambda* (#:key tests? #:allow-other-keys)
294 (if tests?
295 ;; Some tests need git and a full checkout, skip those.
296 (invoke "ctest" "-LE" "git_required")
297 (format #t "test suite not run~%"))
298 #t)))))
299 (native-inputs
300 `(("amalgamate" ,amalgamate)
301 ("doctest" ,doctest)
302 ("json_test_data"
303 ,(let ((version "3.0.0"))
304 (origin
305 (method git-fetch)
306 (uri (git-reference
307 (url "https://github.com/nlohmann/json_test_data")
308 (commit (string-append "v" version))))
309 (file-name (git-file-name "json_test_data" version))
310 (sha256
311 (base32
312 "0nzsjzlvk14dazwh7k2jb1dinb0pv9jbx5jsyn264wvva0y7daiv")))))))
313 (inputs
314 `(("fifo-map" ,fifo-map)))
315 (synopsis "JSON parser and printer library for C++")
316 (description "JSON for Modern C++ is a C++ JSON library that provides
317intuitive syntax and trivial integration.")
318 (license license:expat)))
319
320(define-public nlohmann-json-cpp
321 (deprecated-package "nlohmann-json-cpp" json-modern-cxx))
322
323(define-public xtl
324 (package
325 (name "xtl")
326 (version "0.6.15")
327 (source (origin
328 (method git-fetch)
329 (uri
330 (git-reference
331 (url "https://github.com/QuantStack/xtl")
332 (commit version)))
333 (sha256
334 (base32
335 "0kq88cbcsvgq4hinrzxirqfpfnm3c5a0x0n2309l9zawh8vm33j4"))
336 (file-name (git-file-name name version))))
337 (native-inputs
338 `(("googletest" ,googletest)
339 ("json-modern-cxx" ,json-modern-cxx)))
340 (arguments
341 `(#:configure-flags
342 '("-DBUILD_TESTS=ON")
343 #:phases
344 (modify-phases %standard-phases
345 (replace 'check
346 (lambda* _
347 (with-directory-excursion "test"
348 (invoke "./test_xtl")
349 #t))))))
350 (home-page "https://github.com/QuantStack/xtl")
351 (build-system cmake-build-system)
352 (synopsis "C++ template library providing some basic tools")
353 (description "xtl is a C++ header-only template library providing basic
354tools (containers, algorithms) used by other QuantStack packages.")
355 (license license:bsd-3)))
356
357(define-public ccls
358 (package
359 (name "ccls")
360 (version "0.20190823.6")
361 (source
362 (origin
363 (method git-fetch)
364 (uri (git-reference
365 (url "https://github.com/MaskRay/ccls")
366 (commit version)))
367 (sha256
368 (base32 "11h5nwk4qqshf3i8yr4bxpnvmidrhkzd0zxhf1xqv8cv6r08k47f"))
369 (file-name (git-file-name name version))))
370 (build-system cmake-build-system)
371 (arguments
372 '(#:tests? #f)) ; no check target
373 (inputs
374 `(("rapidjson" ,rapidjson)))
375 (native-inputs
376 `(("clang" ,clang)
377 ("llvm" ,llvm)))
378 (home-page "https://github.com/MaskRay/ccls")
379 (synopsis "C/C++/Objective-C language server")
380 (description
381 "@code{ccls} is a server implementing the Language Server Protocol (LSP)
382for C, C++ and Objective-C languages. It uses @code{clang} to perform static
383code analysis and supports cross references, hierarchies, completion and
384syntax highlighting. @code{ccls} is derived from @code{cquery} which is not
385maintained anymore.")
386 (license license:asl2.0)))
387
388(define-public gperftools
389 (package
390 (name "gperftools")
391 (version "2.8")
392 (source
393 (origin
394 (method git-fetch)
395 (uri (git-reference
396 (url "https://github.com/gperftools/gperftools")
397 (commit (string-append "gperftools-" version))))
398 (sha256
399 (base32 "1rnc53kaxlljgbpsff906vdsry9jl9gcvcnmxgkprwzxq1wipyd0"))
400 (file-name (git-file-name name version))))
401 (build-system gnu-build-system)
402 (native-inputs
403 `(("autoconf" ,autoconf)
404 ("automake" ,automake)
405 ("libtool" ,libtool)
406 ;; For tests.
407 ("perl" ,perl)))
408 (home-page "https://github.com/gperftools/gperftools")
409 (synopsis "Multi-threaded malloc() and performance analysis tools for C++")
410 (description
411 "@code{gperftools} is a collection of a high-performance multi-threaded
412malloc() implementation plus some thread-friendly performance analysis
413tools:
414
415@itemize
416@item tcmalloc,
417@item heap profiler,
418@item heap checker,
419@item CPU checker.
420@end itemize\n")
421 (license license:bsd-3)))
422
423(define-public cpplint
424 (package
425 (name "cpplint")
426 (version "1.4.5")
427 (source
428 (origin
429 (method git-fetch)
430 ;; Fetch from github instead of pypi, since the test cases are not in
431 ;; the pypi archive.
432 (uri (git-reference
433 (url "https://github.com/cpplint/cpplint")
434 (commit version)))
435 (sha256
436 (base32 "1yzcxqx0186sh80p0ydl9z0ld51fn2cdpz9hmhrp15j53g9ira7c"))
437 (file-name (git-file-name name version))))
438 (arguments
439 `(#:phases
440 (modify-phases %standard-phases
441 (add-before 'check 'use-later-pytest
442 (lambda _
443 (substitute* "test-requirements"
444 (("pytest.*") "pytest\n"))
445 #t)))))
446 (build-system python-build-system)
447 (native-inputs
448 `(("python-pytest" ,python-pytest)
449 ("python-pytest-cov" ,python-pytest-cov)
450 ("python-pytest-runner" ,python-pytest-runner)))
451 (home-page "https://github.com/cpplint/cpplint")
452 (synopsis "Static code checker for C++")
453 (description "@code{cpplint} is a command-line tool to check C/C++ files
454for style issues following Google’s C++ style guide. While Google maintains
455it's own version of the tool, this is a fork that aims to be more responsive
456and make @code{cpplint} usable in wider contexts.")
457 (license license:bsd-3)))
458
459(define-public sobjectizer
460 (package
461 (name "sobjectizer")
462 (version "5.6.1")
463 (source
464 (origin
465 (method git-fetch)
466 (uri (git-reference
467 (url "https://github.com/Stiffstream/sobjectizer")
468 (commit (string-append "v." version))))
469 (sha256
470 (base32 "0jfai7sqxnnjkms38krm7mssj5l79nb3pllkbyj4j581a7l5j6l5"))
471 (file-name (git-file-name name version))))
472 (build-system cmake-build-system)
473 (arguments
474 `(#:tests? #f
475 #:phases
476 (modify-phases %standard-phases
477 (add-after 'unpack 'change-directory
478 (lambda _
479 (chdir "dev")
480 #t)))))
481 (home-page "https://stiffstream.com/en/products/sobjectizer.html")
482 (synopsis "Cross-platform actor framework for C++")
483 (description
484 "SObjectizer is a cross-platform \"actor frameworks\" for C++.
485SObjectizer supports not only the Actor Model but also the Publish-Subscribe
486Model and CSP-like channels. The goal of SObjectizer is to simplify
487development of concurrent and multithreaded applications in C++.")
488 (license license:bsd-3)))
489
490(define-public tweeny
491 (package
492 (name "tweeny")
493 (version "3")
494 (source
495 (origin
496 (method git-fetch)
497 (uri (git-reference
498 (url "https://github.com/mobius3/tweeny")
499 (commit (string-append "v" version))))
500 (file-name (git-file-name name version))
501 (sha256
502 (base32 "1adm4c17pi7xf3kf6sjyxibz5rdg1ka236p72xsm6js4j9gzlbp4"))))
503 (arguments
504 '(#:tests? #f)) ;no check target
505 (build-system cmake-build-system)
506 (home-page "https://mobius3.github.io/tweeny/")
507 (synopsis "Modern C++ tweening library")
508 (description "@code{Tweeny} is an inbetweening library designed for the
509creation of complex animations for games and other beautiful interactive
510software. It leverages features of modern @code{C++} to empower developers with
511an intuitive API for declaring tweenings of any type of value, as long as they
512support arithmetic operations. The goal of @code{Tweeny} is to provide means to
513create fluid interpolations when animating position, scale, rotation, frames or
514other values of screen objects, by setting their values as the tween starting
515point and then, after each tween step, plugging back the result.")
516 (license license:expat)))
517
518(define-public abseil-cpp
519 (package
520 (name "abseil-cpp")
521 (version "20200225.2")
522 (source (origin
523 (method git-fetch)
524 (uri (git-reference
525 (url "https://github.com/abseil/abseil-cpp")
526 (commit version)))
527 (file-name (git-file-name name version))
528 (sha256
529 (base32
530 "0dwxg54pv6ihphbia0iw65r64whd7v8nm4wwhcz219642cgpv54y"))))
531 (build-system cmake-build-system)
532 (arguments
533 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
534 "-DABSL_RUN_TESTS=ON"
535 ;; Needed, else we get errors like:
536 ;;
537 ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
538 ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
539 ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
540 ;; error adding symbols: DSO missing from command line
541 ;; collect2: error: ld returned 1 exit status
542 "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")
543 #:phases
544 (modify-phases %standard-phases
545 (add-before 'configure 'remove-gtest-check
546 ;; The CMakeLists fails to find our googletest for some reason, but
547 ;; it works nonetheless.
548 (lambda _
549 (substitute* "CMakeLists.txt"
550 (("check_target\\(gtest\\)") "")
551 (("check_target\\(gtest_main\\)") "")
552 (("check_target\\(gmock\\)") "")))))))
553 (native-inputs
554 `(("googletest" ,googletest)))
555 (home-page "https://abseil.io")
556 (synopsis "Augmented C++ standard library")
557 (description "Abseil is a collection of C++ library code designed to
558augment the C++ standard library. The Abseil library code is collected from
559Google's C++ code base.")
560 (license license:asl2.0)))
561
562(define-public pegtl
563 (package
564 (name "pegtl")
565 (version "2.8.3")
566 (source (origin
567 (method git-fetch)
568 (uri (git-reference
569 (url "https://github.com/taocpp/PEGTL")
570 (commit version)))
571 (file-name (git-file-name name version))
572 (sha256
573 (base32
574 "17crgjfdx55imi2dqnz6xpvsxq07390yfgkz5nd2g77ydkvq9db3"))))
575 (build-system cmake-build-system)
576 (home-page "https://github.com/taocpp/PEGTL")
577 (synopsis "Parsing Expression Grammar template library")
578 (description "The Parsing Expression Grammar Template Library (PEGTL) is
579a zero-dependency C++ header-only parser combinator library for creating
580parsers according to a Parsing Expression Grammar (PEG).")
581 (license license:expat)))