1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 doctest,
7 enableAssertions ? false,
8 enableBoundChecks ? false, # Broadcasts don't pass bound checks
9 nlohmann_json,
10 xtl,
11 xsimd,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "xtensor";
16 version = "0.26.0";
17
18 src = fetchFromGitHub {
19 owner = "xtensor-stack";
20 repo = "xtensor";
21 tag = finalAttrs.version;
22 hash = "sha256-gAGLb5NPT4jiIpXONqY+kalxKCFKFXlNqbM79x1lTKE=";
23 };
24
25 nativeBuildInputs = [
26 cmake
27 ];
28 propagatedBuildInputs = [
29 nlohmann_json
30 xtl
31 xsimd
32 ];
33
34 cmakeFlags = [
35 # Always build the tests, even if not running them, because testing whether
36 # they can be built is a test in itself.
37 (lib.cmakeBool "BUILD_TESTS" true)
38 (lib.cmakeBool "XTENSOR_ENABLE_ASSERT" enableAssertions)
39 (lib.cmakeBool "XTENSOR_CHECK_DIMENSION" enableBoundChecks)
40 ];
41
42 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
43 nativeCheckInputs = [
44 doctest
45 ];
46 checkTarget = "xtest";
47
48 meta = {
49 description = "Multi-dimensional arrays with broadcasting and lazy computing";
50 homepage = "https://github.com/xtensor-stack/xtensor";
51 license = lib.licenses.bsd3;
52 maintainers = with lib.maintainers; [ cpcloud ];
53 platforms = lib.platforms.all;
54 };
55})