2020-01-04 23:10:16 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2019-09-01 00:59:55 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2021-11-14 04:51:15 +00:00
|
|
|
, boost
|
2021-06-20 12:04:46 +00:00
|
|
|
, eigen
|
|
|
|
, python
|
2019-11-26 22:47:23 +00:00
|
|
|
, catch
|
|
|
|
, numpy
|
2022-01-14 07:00:34 +00:00
|
|
|
, pytestCheckHook
|
2019-09-01 00:59:55 +00:00
|
|
|
}:
|
2019-01-29 16:44:23 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pybind11";
|
2022-08-09 17:22:19 +00:00
|
|
|
version = "2.10.0";
|
2019-01-29 16:44:23 +00:00
|
|
|
|
2019-09-01 00:59:55 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pybind";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-08-09 17:22:19 +00:00
|
|
|
hash = "sha256-/X8DZPFsNrKGbhjZ1GFOj17/NU6p4R+saCW3pLKVNeA=";
|
2019-01-29 16:44:23 +00:00
|
|
|
};
|
|
|
|
|
2022-08-09 17:22:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i "/^timeout/d" pyproject.toml
|
|
|
|
'';
|
|
|
|
|
2019-10-17 09:44:43 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
2019-01-29 16:44:23 +00:00
|
|
|
|
2021-06-20 12:04:46 +00:00
|
|
|
dontUseCmakeBuildDir = true;
|
2019-11-26 22:47:23 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-11-14 04:51:15 +00:00
|
|
|
"-DBoost_INCLUDE_DIR=${lib.getDev boost}/include"
|
|
|
|
"-DEIGEN3_INCLUDE_DIR=${lib.getDev eigen}/include/eigen3"
|
2021-06-20 12:04:46 +00:00
|
|
|
"-DBUILD_TESTING=on"
|
2022-08-24 21:31:45 +00:00
|
|
|
"-DPYTHON_EXECUTABLE:FILEPATH=${python.pythonForBuild.interpreter}"
|
2020-01-04 23:10:16 +00:00
|
|
|
] ++ lib.optionals (python.isPy3k && !stdenv.cc.isClang) [
|
2021-06-20 12:04:46 +00:00
|
|
|
"-DPYBIND11_CXX_STANDARD=-std=c++17"
|
2019-11-26 22:47:23 +00:00
|
|
|
];
|
|
|
|
|
2021-06-20 12:04:46 +00:00
|
|
|
postBuild = ''
|
|
|
|
# build tests
|
2022-02-28 12:57:13 +00:00
|
|
|
make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES
|
2021-06-20 12:04:46 +00:00
|
|
|
'';
|
2019-11-26 22:47:23 +00:00
|
|
|
|
2021-06-20 12:04:46 +00:00
|
|
|
postInstall = ''
|
2021-06-21 15:51:09 +00: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 09:44:43 +00:00
|
|
|
'';
|
|
|
|
|
2019-11-26 22:47:23 +00:00
|
|
|
checkInputs = [
|
2021-06-20 12:04:46 +00:00
|
|
|
catch
|
2019-11-26 22:47:23 +00:00
|
|
|
numpy
|
2022-01-14 07:00:34 +00:00
|
|
|
pytestCheckHook
|
2019-11-26 22:47:23 +00:00
|
|
|
];
|
|
|
|
|
2022-01-14 07:00:34 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# require dependencies not available in nixpkgs
|
|
|
|
"tests/test_embed/test_trampoline.py"
|
|
|
|
"tests/test_embed/test_interpreter.py"
|
|
|
|
# numpy changed __repr__ output of numpy dtypes
|
|
|
|
"tests/test_numpy_dtypes.py"
|
|
|
|
# no need to test internal packaging
|
|
|
|
"tests/extra_python_package/test_files.py"
|
2022-02-15 16:39:18 +00:00
|
|
|
# tests that try to parse setuptools stdout
|
|
|
|
"tests/extra_setuptools/test_setuphelper.py"
|
2022-01-14 07:00:34 +00:00
|
|
|
];
|
2021-06-20 12:04:46 +00:00
|
|
|
|
2020-07-07 17:42:07 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/pybind/pybind11";
|
2022-04-17 18:54:53 +00:00
|
|
|
changelog = "https://github.com/pybind/pybind11/blob/${src.rev}/docs/changelog.rst";
|
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 17:42:07 +00:00
|
|
|
license = licenses.bsd3;
|
2021-06-20 12:04:46 +00:00
|
|
|
maintainers = with maintainers; [ yuriaisaka dotlambda ];
|
2019-01-29 16:44:23 +00:00
|
|
|
};
|
|
|
|
}
|