2020-01-04 23:10:16 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2019-09-01 01:59:55 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, python
|
|
|
|
, pytest
|
|
|
|
, cmake
|
2019-11-26 22:47:23 +00:00
|
|
|
, catch
|
|
|
|
, numpy
|
|
|
|
, eigen
|
|
|
|
, scipy
|
2019-09-01 01:59:55 +01:00
|
|
|
}:
|
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-10-17 10:44:43 +01:00
|
|
|
nativeBuildInputs = [ cmake ];
|
2019-01-29 16:44:23 +00:00
|
|
|
|
2019-11-26 22:47:23 +00:00
|
|
|
buildInputs = [ catch ];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3"
|
2020-01-04 23:10:16 +00:00
|
|
|
] ++ lib.optionals (python.isPy3k && !stdenv.cc.isClang) [
|
2019-11-26 22:47:23 +00:00
|
|
|
# Enable some tests only on Python 3. The "test_string_view" test
|
|
|
|
# 'testTypeError: string_view16_chars(): incompatible function arguments'
|
|
|
|
# fails on Python 2.
|
|
|
|
"-DPYBIND11_CPP_STANDARD=-std=c++17"
|
|
|
|
];
|
|
|
|
|
|
|
|
dontUseSetuptoolsBuild = true;
|
|
|
|
dontUsePipInstall = true;
|
|
|
|
dontUseSetuptoolsCheck = true;
|
|
|
|
|
2019-12-19 18:57:42 +00:00
|
|
|
patches = [
|
|
|
|
./0001-Find-include-directory.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pybind11/__init__.py --subst-var-by include "$out/include"
|
|
|
|
'';
|
|
|
|
|
2019-11-26 22:47:23 +00:00
|
|
|
preFixup = ''
|
|
|
|
pushd ..
|
|
|
|
export PYBIND11_USE_CMAKE=1
|
|
|
|
setuptoolsBuildPhase
|
|
|
|
pipInstallPhase
|
|
|
|
# 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
|
|
|
|
popd
|
2019-10-17 10:44:43 +01:00
|
|
|
'';
|
|
|
|
|
2019-11-26 22:47:23 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytest
|
|
|
|
numpy
|
|
|
|
scipy
|
|
|
|
];
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|