summaryrefslogtreecommitdiff
path: root/gnu/packages/cpp.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/cpp.scm')
-rw-r--r--gnu/packages/cpp.scm210
1 files changed, 210 insertions, 0 deletions
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 805413cc61..c8df516834 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -29,6 +29,7 @@
;;; Copyright © 2022 muradm <mail@muradm.net>
;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -56,6 +57,7 @@
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system python)
+ #:use-module (guix build-system scons)
#:use-module (guix modules)
#:use-module (guix gexp)
#:use-module (gnu packages)
@@ -1954,3 +1956,211 @@ std::wstring, etc).")
"This package provides architecture-specific implementations of the
CRC32C algorithm, which is specified in RFC 3720, section 12.1.")
(license license:bsd-3)))
+
+(define fast-float-test-files
+ (let ((commit "97a0b2e638feb479387554cf253e346500541e7e"))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url (string-append "https://github.com/fastfloat"
+ "/supplemental_test_files.git"))
+ (commit "97a0b2e638feb479387554cf253e346500541e7e")))
+ (file-name (string-append "fast-float-test-files-"
+ (string-take commit 8)))
+ (sha256
+ (base32
+ "0dxbiyzyh7i847i89ablfzypfc3ckhm7f74w98jsh73v1mppmxlf")))))
+
+(define-public fast-float
+ (package
+ (name "fast-float")
+ (version "3.5.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/fastfloat/fast_float")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:configure-flags #~(list "-DFASTFLOAT_TEST=ON"
+ "-DSYSTEM_DOCTEST=ON")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-cmake-tests
+ (lambda* (#:key inputs native-inputs #:allow-other-keys)
+ (substitute* "tests/CMakeLists.txt"
+ (("FetchContent_GetProperties\\(supplemental_test_files.*")
+ "")
+ (("if\\(NOT supplemental_test_files_POPULATED.*")
+ (string-append
+ "set(supplemental_test_files_BINARY_DIR "
+ (search-input-directory (or native-inputs inputs)
+ "data")
+ ")\nif(0)\n"))))))))
+ (native-inputs (list doctest fast-float-test-files))
+ (home-page "https://github.com/fastfloat/fast_float")
+ (synopsis "Floating point number parser for C++")
+ (description "@code{fast_float} is a header-only C++ library for parsing
+floating point numbers from strings. It implements the C++ from_chars
+functions for the float and double types.")
+ (license (list license:asl2.0 license:expat)))) ; dual licensed
+
+(define-public pocketfft-cpp
+ (let ((commit "daa8bb18327bc5c7d22c69428c25cf5dc64167d3")
+ (revision "0"))
+ (package
+ (name "pocketfft-cpp")
+ (version (git-version "0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/mreineck/pocketfft")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1dbkkqkmkxgmz1qjpsqzic5ig3qw1pqndbb3dvjc7xq5f2rdzyq1"))
+ (patches (search-patches
+ "pocketfft-cpp-prefer-preprocessor-if.patch"))))
+ (build-system copy-build-system)
+ (arguments
+ (list
+ #:install-plan #~'(("pocketfft_hdronly.h" "include/"))))
+ (home-page "https://github.com/mreineck/pocketfft")
+ (synopsis "C++11 header-only Fast Fourier Transform library")
+ (description "This package provides a single-header C++11 library for
+computing Fast Fourier transformations. It supports multidimensional arrays,
+different floating point sizes and complex transformations.")
+ (license license:bsd-3))))
+
+(define-public sajson
+ (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd")
+ (revision "0"))
+ (package
+ (name "sajson")
+ (version (git-version "1.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/chadaustin/sajson")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (patches
+ (search-patches "sajson-build-with-gcc10.patch"))
+ (sha256
+ (base32
+ "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
+ (modules '((guix build utils)))
+ (snippet '(delete-file-recursively "third-party"))))
+ (build-system scons-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'disable-other-builds
+ (lambda _
+ (substitute* "SConstruct"
+ (("for name, tools in builds:")
+ "for name, tools in [('opt', [gcc, opt])]:"))))
+ (add-after 'unpack 'use-external-unittest-cpp
+ (lambda _
+ (substitute* "SConscript"
+ (("unittestpp_env\\.Library") "_dummy = ")
+ (("test_env = env.Clone\\(tools=\\[unittestpp, sajson\\]\\)")
+ (string-append
+ "test_env = env.Clone(tools=[sajson])\n"
+ "test_env.Append(CPPPATH='"
+ (search-input-directory %build-inputs "/include/UnitTest++")
+ "', LIBPATH='"
+ (string-append #$(this-package-native-input "unittest-cpp")
+ "/lib")
+ "', LIBS=['UnitTest++'])")))))
+ (replace 'build
+ (lambda* (#:key tests? #:allow-other-keys #:rest args)
+ (when tests?
+ (apply (assoc-ref %standard-phases 'build)
+ args))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "build/opt/test")
+ (invoke "build/opt/test_unsorted"))))
+ (replace 'install
+ (lambda _
+ (let ((out (string-append #$output "/include")))
+ (install-file "include/sajson.h" out)
+ (install-file "include/sajson_ostream.h" out)))))))
+ (native-inputs (list unittest-cpp))
+ (home-page "https://github.com/chadaustin/sajson")
+ (synopsis "C++11 header-only, in-place JSON parser")
+ (description "@code{sajson} is an in-place JSON parser with support for
+parsing with only a single memory allocation.")
+ (license license:expat))))
+
+(define-public sajson-for-gemmi
+ (package/inherit sajson
+ (name "sajson-for-gemmi")
+ (source (origin
+ (inherit (package-source sajson))
+ (patches (cons
+ (search-patch
+ "sajson-for-gemmi-numbers-as-strings.patch")
+ (origin-patches (package-source sajson))))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments sajson)
+ ;; This is a modified version used in gemmi, in which numbers are kept
+ ;; as strings. Building the tests fails with the modification.
+ ((#:tests? _ #f) #f)))
+ (properties '((hidden? . #t)))))
+
+(define-public optionparser
+ (package
+ (name "optionparser")
+ (version "1.7")
+ (source (origin
+ (method url-fetch)
+ (uri
+ (string-append "mirror://sourceforge/optionparser/"
+ "optionparser-" version ".tar.gz"))
+ (sha256
+ (base32
+ "04gfxrdzwacaynb8scsz6rr7nh64n6yk6w9dh2qdhrxw4caqr0dk"))))
+ (outputs '("out" "doc"))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'chdir
+ (lambda _ (chdir "src")))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (begin
+ (invoke "./example_arg")
+ (invoke "./testparse")
+ (invoke "./testprintusage")
+ (invoke "./testodr")
+ (invoke "./example")))))
+ (replace 'install
+ (lambda _
+ (install-file "optionparser.h"
+ (string-append #$output "/include"))))
+ (add-after 'install 'install-doc
+ (lambda _
+ (copy-recursively
+ "../html"
+ (string-append #$output:doc "/share/doc/optionparser/html")))))))
+ (native-inputs (list doxygen))
+ (home-page "https://optionparser.sourceforge.net/")
+ (synopsis "Header-only C++ library to parse command line options")
+ (description "This package provides a header-only C++ library to parse
+command line options. It supports the short and long option formats of
+getopt(), getopt_long() and getopt_long_only().")
+ (license license:expat)))