gnu: nlohmann-json: Improve package style.

* gnu/package/cpp.scm (nlohmann-json)[source]<snippet>: Fit to 80 chars width.
Use G-Expressions.
[arguments]: Use G-Expressions.
This commit is contained in:
Liliana Marie Prikler 2023-04-28 21:55:13 +02:00
parent 4a3f946408
commit f8d06e2c32
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87

View file

@ -611,41 +611,45 @@ (define-public nlohmann-json
(file-name (git-file-name name version))
(modules '((guix build utils)))
(snippet
'(begin
;; Delete bundled software. Preserve doctest_compatibility.h, which
;; is a wrapper library added by this package.
(install-file "./tests/thirdparty/doctest/doctest_compatibility.h" "/tmp")
(delete-file-recursively "./tests/thirdparty")
(install-file "/tmp/doctest_compatibility.h" "./tests/thirdparty/doctest")
#~(begin
;; Delete bundled software. Preserve doctest_compatibility.h, which
;; is a wrapper library added by this package.
(install-file "./tests/thirdparty/doctest/doctest_compatibility.h"
"/tmp")
(delete-file-recursively "./tests/thirdparty")
(install-file "/tmp/doctest_compatibility.h"
"./tests/thirdparty/doctest")
;; Adjust for the unbundled fifo_map and doctest.
(substitute* (find-files "./tests/" "\\.h(pp)?")
(("#include \"doctest\\.h\"") "#include <doctest/doctest.h>")
(("#include <doctest\\.h>") "#include <doctest/doctest.h>"))
(with-directory-excursion "tests/src"
(let ((files (find-files "." "\\.cpp$")))
(substitute* files
(("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
(string-append
"#include <fifo_map/" fifo-map-hpp ">")))))))))
;; Adjust for the unbundled fifo_map and doctest.
(substitute* (find-files "./tests/" "\\.h(pp)?")
(("#include \"doctest\\.h\"") "#include <doctest/doctest.h>")
(("#include <doctest\\.h>") "#include <doctest/doctest.h>"))
(with-directory-excursion "tests/src"
(let ((files (find-files "." "\\.cpp$")))
(substitute* files
(("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
(string-append
"#include <fifo_map/" fifo-map-hpp ">")))))))))
(build-system cmake-build-system)
(arguments
'(#:configure-flags
(list "-DJSON_MultipleHeaders=ON" ; For json_fwd.hpp.
(string-append "-DJSON_TestDataDirectory="
(dirname
(search-input-directory %build-inputs
"json_nlohmann_tests"))))
#:phases (modify-phases %standard-phases
(replace 'check
(lambda* (#:key tests? parallel-tests? #:allow-other-keys)
(if tests?
;; Some tests need git and a full checkout, skip those.
(invoke "ctest" "-LE" "git_required"
"-j" (if parallel-tests?
(number->string (parallel-job-count))
"1"))
(format #t "test suite not run~%")))))))
(list
#:configure-flags
#~(list "-DJSON_MultipleHeaders=ON" ; For json_fwd.hpp.
(string-append "-DJSON_TestDataDirectory="
(dirname
(search-input-directory %build-inputs
"json_nlohmann_tests"))))
#:phases
#~(modify-phases %standard-phases
(replace 'check
(lambda* (#:key tests? parallel-tests? #:allow-other-keys)
(if tests?
;; Some tests need git and a full checkout, skip those.
(invoke "ctest" "-LE" "git_required"
"-j" (if parallel-tests?
(number->string (parallel-job-count))
"1"))
(format #t "test suite not run~%")))))))
(native-inputs
(list amalgamate
(let ((version "3.1.0"))