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