aboutsummaryrefslogtreecommitdiff
path: root/pkgs/development/libraries/science/math/libtorch
diff options
context:
space:
mode:
authorDaniël de Kok <me@danieldk.eu>2020-11-08 10:49:31 +0100
committerDaniël de Kok <me@danieldk.eu>2020-11-09 07:49:54 +0100
commite8721af065934457b4ebf4ca819009ab5a2cb3de (patch)
tree37fc50e9f99f13a49e2e43dc77e5b911c7dabce1 /pkgs/development/libraries/science/math/libtorch
parentd36077239cd504a82788411d0a58a24a6c529fb8 (diff)
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.
Diffstat (limited to 'pkgs/development/libraries/science/math/libtorch')
-rw-r--r--pkgs/development/libraries/science/math/libtorch/bin.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/development/libraries/science/math/libtorch/bin.nix b/pkgs/development/libraries/science/math/libtorch/bin.nix
index 6180c14c4d72..7c78f61af694 100644
--- a/pkgs/development/libraries/science/math/libtorch/bin.nix
+++ b/pkgs/development/libraries/science/math/libtorch/bin.nix
@@ -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