Skip to content

Commit

Permalink
fix TORCH_INSTALL_PREFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Jan 20, 2023
1 parent 301d013 commit 36555d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion recipes/torchtext/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source:
patches:
# don't build pytorch/text/tree/main/third_party; pull in from conda-forge
- patches/0001-do-not-build-third_party-libs.patch
# make sure we install from and into $PREFIX
# make sure we install from $PREFIX and into $SP_DIR/torchtext
- patches/0002-fix-some-CMake-arguments-for-our-infrastructure.patch

build:
Expand All @@ -23,6 +23,7 @@ build:
rpaths:
- lib/
- {{ SP_DIR }}/torch/lib
- {{ SP_DIR }}/torchtext/lib

requirements:
build:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From e1ce5ea884009e5e1397e61b02933501c53aba19 Mon Sep 17 00:00:00 2001
From 420cbd5a4c2b46e285529eb3c15de8847818f5dc Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Wed, 1 Dec 2021 21:07:42 +1100
Subject: [PATCH 1/2] do not build third_party libs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 24403f88e608cdc3f1939370df7ac361d648046e Mon Sep 17 00:00:00 2001
From 60d8122796befb3fe5798c09463e18ac16f5d8d1 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Wed, 18 Jan 2023 16:56:57 +1100
Subject: [PATCH 2/2] fix some CMake arguments for our infrastructure
Expand All @@ -8,7 +8,7 @@ Subject: [PATCH 2/2] fix some CMake arguments for our infrastructure
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tools/setup_helpers/extension.py b/tools/setup_helpers/extension.py
index 760b3bb7..fdf64f94 100644
index 760b3bb7..98b909b7 100644
--- a/tools/setup_helpers/extension.py
+++ b/tools/setup_helpers/extension.py
@@ -64,12 +64,13 @@ class CMakeBuild(build_ext):
Expand All @@ -20,11 +20,11 @@ index 760b3bb7..fdf64f94 100644
- f"-DCMAKE_PREFIX_PATH={torch.utils.cmake_prefix_path}",
- f"-DCMAKE_INSTALL_PREFIX={extdir}",
+ f"-DCMAKE_PREFIX_PATH={os.environ['PREFIX']}",
+ f"-DCMAKE_INSTALL_PREFIX=lib",
+ f"-DCMAKE_INSTALL_PREFIX={os.environ['SP_DIR'] + '/torchtext'}",
"-DCMAKE_VERBOSE_MAKEFILE=ON",
f"-DPython_INCLUDE_DIR={distutils.sysconfig.get_python_inc()}",
- f"-DTORCH_INSTALL_PREFIX:STRING={os.path.dirname(torch.__file__)}",
+ f"-DTORCH_INSTALL_PREFIX:STRING={os.environ['PREFIX']}",
+ f"-DTORCH_INSTALL_PREFIX:STRING={os.environ['SP_DIR'] + '/torch'}",
"-DBUILD_TORCHTEXT_PYTHON_EXTENSION:BOOL=ON",
"-DRE2_BUILD_TESTING:BOOL=OFF",
"-DBUILD_TESTING:BOOL=OFF",
Expand Down

0 comments on commit 36555d7

Please sign in to comment.