diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index af19028f3..f91be9a89 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,6 +42,10 @@ git clone git@github.com:pytorch/torchcodec.git # Or, using https instead of ssh: git clone https://github.com/pytorch/torchcodec.git cd torchcodec +# Optional, but recommended: define a persistent build directory which speeds-up +# subsequent builds. +export TORCHCODEC_CMAKE_BUILD_DIR="${PWD}/build" + pip install -e ".[dev]" --no-build-isolation -vv # Or, for cuda support: ENABLE_CUDA=1 pip install -e ".[dev]" --no-build-isolation -vv ``` diff --git a/setup.py b/setup.py index 5074ef478..2efccf982 100644 --- a/setup.py +++ b/setup.py @@ -126,12 +126,17 @@ def _build_all_extensions_with_cmake(self): f"-DTORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR={torchcodec_disable_compile_warning_as_error}", ] + self.build_temp = os.getenv("TORCHCODEC_CMAKE_BUILD_DIR", self.build_temp) + print(f"Using {self.build_temp = }", flush=True) Path(self.build_temp).mkdir(parents=True, exist_ok=True) + print("Calling cmake (configure)", flush=True) subprocess.check_call( ["cmake", str(_ROOT_DIR)] + cmake_args, cwd=self.build_temp ) + print("Calling cmake --build", flush=True) subprocess.check_call(["cmake", "--build", "."], cwd=self.build_temp) + print("Calling cmake --install", flush=True) subprocess.check_call(["cmake", "--install", "."], cwd=self.build_temp) def copy_extensions_to_source(self):