2020-01-04 23:10:16 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2019-09-01 01:59:55 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, 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-09-01 01:59:55 +01:00
|
|
|
}:
|
2019-01-29 16:44:23 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pybind11";
|
2021-07-21 20:04:58 +01:00
|
|
|
version = "2.7.0";
|
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-07-21 20:04:58 +01:00
|
|
|
sha256 = "sha256-iEXoNTsfsDq79bKV7A4aOCHr11rT/cqnyLghEtGsaks=";
|
2019-01-29 16:44:23 +00:00
|
|
|
};
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|