me
/
guix
Archived
1
0
Fork 0

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.
master
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
1 changed files with 36 additions and 32 deletions

View File

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