2020-01-04 23:10:16 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2019-09-01 01:59:55 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
2021-06-20 13:04:46 +01:00
|
|
|
, eigen
|
|
|
|
, python
|
2019-11-26 22:47:23 +00:00
|
|
|
, catch
|
|
|
|
, numpy
|
2021-06-20 13:04:46 +01:00
|
|
|
, pytest
|
2019-11-26 22:47:23 +00:00
|
|
|
, scipy
|
2019-09-01 01:59:55 +01:00
|
|
|
}:
|
2019-01-29 16:44:23 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pybind11";
|
2021-03-24 17:41:52 +00:00
|
|
|
version = "2.6.2";
|
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}";
|
2021-03-24 17:41:52 +00:00
|
|
|
sha256 = "1lsacpawl2gb5qlh0cawj9swsyfbwhzhwiv6553a7lsigdbadqpy";
|
2019-01-29 16:44:23 +00:00
|
|
|
};
|
|
|
|
|
2021-05-14 11:55:23 +01:00
|
|
|
patches = [
|
|
|
|
# fix pybind11Config.cmake
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/pybind/pybind11/commit/d9c4e1047a95f023633a7260af5a633307438941.patch";
|
|
|
|
sha256 = "0kran295kj31xfs6mfha5ip132zd0pnj2dl36qzgyc1rpnha5gz4";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2019-10-17 10:44:43 +01:00
|
|
|
nativeBuildInputs = [ cmake ];
|
2019-01-29 16:44:23 +00:00
|
|
|
|
2021-06-20 13:04:46 +01:00
|
|
|
dontUseCmakeBuildDir = true;
|
2019-11-26 22:47:23 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3"
|
2021-06-20 13:04:46 +01:00
|
|
|
"-DBUILD_TESTING=on"
|
2020-01-04 23:10:16 +00:00
|
|
|
] ++ lib.optionals (python.isPy3k && !stdenv.cc.isClang) [
|
2021-06-20 13:04:46 +01:00
|
|
|
"-DPYBIND11_CXX_STANDARD=-std=c++17"
|
2019-11-26 22:47:23 +00:00
|
|
|
];
|
|
|
|
|
2021-06-20 13:04:46 +01:00
|
|
|
postBuild = ''
|
|
|
|
# build tests
|
|
|
|
make
|
|
|
|
'';
|
2019-11-26 22:47:23 +00:00
|
|
|
|
2021-06-20 13:04:46 +01:00
|
|
|
postInstall = ''
|
2021-06-21 16:51:09 +01:00
|
|
|
make install
|
2019-11-26 22:47:23 +00:00
|
|
|
# Symlink the CMake-installed headers to the location expected by setuptools
|
|
|
|
mkdir -p $out/include/${python.libPrefix}
|
|
|
|
ln -sf $out/include/pybind11 $out/include/${python.libPrefix}/pybind11
|
2019-10-17 10:44:43 +01:00
|
|
|
'';
|
|
|
|
|
2019-11-26 22:47:23 +00:00
|
|
|
checkInputs = [
|
2021-06-20 13:04:46 +01:00
|
|
|
catch
|
2019-11-26 22:47:23 +00:00
|
|
|
numpy
|
2021-06-20 13:04:46 +01:00
|
|
|
pytest
|
2019-11-26 22:47:23 +00:00
|
|
|
];
|
|
|
|
|
2021-06-20 13:04:46 +01:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
make check
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2020-07-07 18:42:07 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/pybind/pybind11";
|
2019-01-29 16:44:23 +00:00
|
|
|
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.
|
|
|
|
'';
|
2020-07-07 18:42:07 +01:00
|
|
|
license = licenses.bsd3;
|
2021-06-20 13:04:46 +01:00
|
|
|
maintainers = with maintainers; [ yuriaisaka dotlambda ];
|
2019-01-29 16:44:23 +00:00
|
|
|
};
|
|
|
|
}
|