Skip to content

Commit

Permalink
patch some CMake variables; always use ninja
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Jan 20, 2023
1 parent 4e1146f commit f174c91
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
2 changes: 2 additions & 0 deletions recipes/torchtext/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ 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
- patches/0002-fix-some-CMake-arguments-for-our-infrastructure.patch

build:
number: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From b530b275f1af85d2ae8da140e58796aa506186f8 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Wed, 1 Dec 2021 21:07:42 +1100
Subject: [PATCH] do not build third_party libs
Subject: [PATCH 1/2] do not build third_party libs

---
CMakeLists.txt | 5 ++++-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From b9711d40d1a4b3a6d152d11ca925c949a413c53a 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

---
tools/setup_helpers/extension.py | 10 ++++------
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
--- a/tools/setup_helpers/extension.py
+++ b/tools/setup_helpers/extension.py
@@ -64,12 +64,13 @@ class CMakeBuild(build_ext):
cfg = "Debug" if self.debug else "Release"

cmake_args = [
+ "-GNinja",
f"-DCMAKE_BUILD_TYPE={cfg}",
- 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",
"-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']}",
"-DBUILD_TORCHTEXT_PYTHON_EXTENSION:BOOL=ON",
"-DRE2_BUILD_TESTING:BOOL=OFF",
"-DBUILD_TESTING:BOOL=OFF",
@@ -80,9 +81,6 @@ class CMakeBuild(build_ext):
]
build_args = ["--target", "install"]

- # Default to Ninja
- if "CMAKE_GENERATOR" not in os.environ or platform.system() == "Windows":
- cmake_args += ["-GNinja"]
if platform.system() == "Windows":
import sys

--
2.38.1.windows.1

0 comments on commit f174c91

Please sign in to comment.