3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/pybind11/default.nix

73 lines
1.5 KiB
Nix
Raw Normal View History

{ stdenv
, lib
2019-09-01 01:59:55 +01:00
, buildPythonPackage
, fetchFromGitHub
, cmake
, eigen
, python
, catch
, numpy
, pytest
2019-09-01 01:59:55 +01:00
}:
2019-01-29 16:44:23 +00:00
buildPythonPackage rec {
pname = "pybind11";
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}";
sha256 = "sha256-iEXoNTsfsDq79bKV7A4aOCHr11rT/cqnyLghEtGsaks=";
2019-01-29 16:44:23 +00:00
};
nativeBuildInputs = [ cmake ];
2019-01-29 16:44:23 +00:00
dontUseCmakeBuildDir = true;
cmakeFlags = [
"-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3"
"-DBUILD_TESTING=on"
] ++ lib.optionals (python.isPy3k && !stdenv.cc.isClang) [
"-DPYBIND11_CXX_STANDARD=-std=c++17"
];
postBuild = ''
# build tests
make
'';
postInstall = ''
make install
# 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
'';
checkInputs = [
catch
numpy
pytest
];
checkPhase = ''
runHook preCheck
make check
runHook postCheck
'';
meta = with lib; {
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.
'';
license = licenses.bsd3;
maintainers = with maintainers; [ yuriaisaka dotlambda ];
2019-01-29 16:44:23 +00:00
};
}