2019-09-01 01:59:55 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, python
|
|
|
|
, pytest
|
|
|
|
, cmake
|
|
|
|
, numpy ? null
|
|
|
|
, eigen ? null
|
|
|
|
, scipy ? null
|
|
|
|
}:
|
2019-01-29 16:44:23 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pybind11";
|
2019-10-17 08:28:04 +01:00
|
|
|
version = "2.4.3";
|
2019-01-29 16:44:23 +00:00
|
|
|
|
2019-09-01 01:59:55 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pybind";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2019-10-17 08:28:04 +01:00
|
|
|
sha256 = "0k89w4bsfbpzw963ykg1cyszi3h3nk393qd31m6y46pcfxkqh4rd";
|
2019-01-29 16:44:23 +00:00
|
|
|
};
|
|
|
|
|
2019-09-08 16:43:16 +01:00
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2019-10-17 10:44:43 +01:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
checkInputs = [ pytest ]
|
2019-09-01 01:59:55 +01:00
|
|
|
++ (lib.optional (numpy != null) numpy)
|
|
|
|
++ (lib.optional (eigen != null) eigen)
|
|
|
|
++ (lib.optional (scipy != null) scipy);
|
|
|
|
checkPhase = ''
|
|
|
|
cmake ${if eigen != null then "-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3" else ""}
|
|
|
|
make -j $NIX_BUILD_CORES pytest
|
|
|
|
'';
|
2019-01-29 16:44:23 +00:00
|
|
|
|
2019-10-17 10:44:43 +01:00
|
|
|
# re-expose the headers to other packages
|
|
|
|
postInstall = ''
|
|
|
|
ln -s $out/include/python${python.pythonVersion}m/pybind11/ $out/include/pybind11
|
|
|
|
'';
|
|
|
|
|
2019-01-29 16:44:23 +00:00
|
|
|
meta = {
|
|
|
|
homepage = https://github.com/pybind/pybind11;
|
|
|
|
description = "Seamless operability between C++11 and Python";
|
|
|
|
longDescription = ''
|
|
|
|
Pybind11 is a lightweight header-only library that exposes
|
|
|
|
C++ types in Python and vice versa, mainly to create Python
|
|
|
|
bindings of existing C++ code.
|
|
|
|
'';
|
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = [ lib.maintainers.yuriaisaka ];
|
|
|
|
};
|
|
|
|
}
|