libtorch-bin: fix CMake library paths for split outputs

The libtorch CMake files are in the `dev` output and used relative
paths to locate the shared libraries. This fails, because the
libraries are in the `out` output. This change patches the CMake files
to use library paths from `out`.

See #102146.
This commit is contained in:
Daniël de Kok 2020-11-08 10:49:31 +01:00
parent d36077239c
commit e8721af065

View file

@ -45,6 +45,14 @@ in stdenv.mkDerivation {
# We do not care about Java support...
rm -f $out/lib/lib*jni* 2> /dev/null || true
# Fix up library paths for split outputs
substituteInPlace $dev/share/cmake/Torch/TorchConfig.cmake \
--replace \''${TORCH_INSTALL_PREFIX}/lib "$out/lib" \
substituteInPlace \
$dev/share/cmake/Caffe2/Caffe2Targets-release.cmake \
--replace \''${_IMPORT_PREFIX}/lib "$out/lib" \
'';
postFixup = let