mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-19 03:14:03 +00:00
Merge pull request #320419 from paparodeo/faiss-stuff
faiss: refactor buildPhase and installPhase
This commit is contained in:
commit
b9a5c0fc8a
@ -97,20 +97,21 @@ stdenv.mkDerivation {
|
||||
"-DCUDAToolkit_INCLUDE_DIR=${cudaJoined}/include"
|
||||
];
|
||||
|
||||
buildFlags = [
|
||||
"faiss"
|
||||
"demo_ivfpq_indexing"
|
||||
] ++ lib.optionals pythonSupport [
|
||||
"swigfaiss"
|
||||
];
|
||||
|
||||
# pip wheel->pip install commands copied over from opencv4
|
||||
|
||||
buildPhase = ''
|
||||
make -j faiss
|
||||
make demo_ivfpq_indexing
|
||||
'' + lib.optionalString pythonSupport ''
|
||||
make -j swigfaiss
|
||||
postBuild = lib.optionalString pythonSupport ''
|
||||
(cd faiss/python &&
|
||||
python -m pip wheel --verbose --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist .)
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
make install
|
||||
postInstall = ''
|
||||
mkdir -p $demos/bin
|
||||
cp ./demos/demo_ivfpq_indexing $demos/bin/
|
||||
'' + lib.optionalString pythonSupport ''
|
||||
@ -118,7 +119,7 @@ stdenv.mkDerivation {
|
||||
(cd faiss/python && python -m pip install dist/*.whl --no-index --no-warn-script-location --prefix="$out" --no-cache)
|
||||
'';
|
||||
|
||||
fixupPhase = lib.optionalString (pythonSupport && cudaSupport) ''
|
||||
postFixup = lib.optionalString (pythonSupport && cudaSupport) ''
|
||||
addOpenGLRunpath $out/${pythonPackages.python.sitePackages}/faiss/*.so
|
||||
addOpenGLRunpath $demos/bin/*
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user