From 404189766cfad8b6d6f0a393770fa12c3301693b Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 17 Sep 2024 11:59:25 -0700 Subject: [PATCH] Allow specifying cmake setup directory (#1186) Allow specifying cmake directory Signed-off-by: Ryan Li Co-authored-by: Ryan Li --- build_tools/build_ext.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build_tools/build_ext.py b/build_tools/build_ext.py index f71cef08ea..af11ada34c 100644 --- a/build_tools/build_ext.py +++ b/build_tools/build_ext.py @@ -106,8 +106,12 @@ def run(self) -> None: if isinstance(ext, CMakeExtension): print(f"Building CMake extension {ext.name}") # Set up incremental builds for CMake extensions - setup_dir = Path(__file__).resolve().parent.parent - build_dir = setup_dir / "build" / "cmake" + build_dir = os.getenv("NVTE_CMAKE_BUILD_DIR") + if build_dir: + build_dir = Path(build_dir).resolve() + else: + root_dir = Path(__file__).resolve().parent.parent + build_dir = root_dir / "build" / "cmake" # Ensure the directory exists build_dir.mkdir(parents=True, exist_ok=True)