summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSsnL <tongzhou.wang.1994@gmail.com>2019-01-28 13:35:36 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-01-28 13:43:17 -0800
commitfb17be13685afad7ed09ef3cfd64f7b5388ed5ca (patch)
tree8d282a5e769dba11cd8a26ea6dbcd022a1d590d8 /tools
parente866bc7c8857351626c5fe5cdd06f4a5f499e09e (diff)
downloadpytorch-fb17be13685afad7ed09ef3cfd64f7b5388ed5ca.tar.gz
pytorch-fb17be13685afad7ed09ef3cfd64f7b5388ed5ca.tar.bz2
pytorch-fb17be13685afad7ed09ef3cfd64f7b5388ed5ca.zip
Clear cmake cache when --cmake (#16426)
Summary: Also, because sometimes we have `CMakeCache.txt` but cmake errored out so I'm adding the existence of `'build.ninja'` as another criterion of rerunning cmake. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16426 Differential Revision: D13843801 Pulled By: ezyang fbshipit-source-id: ea1efb201062f23b7608f8d061997d8a8e293445
Diffstat (limited to 'tools')
-rw-r--r--tools/build_pytorch_libs.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/build_pytorch_libs.py b/tools/build_pytorch_libs.py
index 0f6ca9261c..7751d09f44 100644
--- a/tools/build_pytorch_libs.py
+++ b/tools/build_pytorch_libs.py
@@ -243,7 +243,10 @@ def build_caffe2(version,
rerun_cmake,
build_dir):
build_test = not check_negative_env_flag('BUILD_TEST')
- if rerun_cmake or not os.path.exists('build/CMakeCache.txt'):
+ cmake_cache_file = 'build/CMakeCache.txt'
+ if rerun_cmake and os.path.isfile(cmake_cache_file):
+ os.remove(cmake_cache_file)
+ if not os.path.exists(cmake_cache_file) or (USE_NINJA and not os.path.exists('build/build.ninja')):
run_cmake(version,
cmake_python_library,
build_python,