Specify build dir as a global variable in BUILD_DIR in the build system.

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23318

Test Plan: Imported from OSS

Differential Revision: D16493987

Pulled By: ezyang

fbshipit-source-id: 497e9dd924280f61dde095b4f2b50f5402d9da97
This commit is contained in:
Hong Xu
2019-07-25 07:16:01 -07:00
committed by Facebook Github Bot
parent 915261c8be
commit 82545ecc71
4 changed files with 6 additions and 4 deletions

View File

@ -276,7 +276,7 @@ elif sha != 'Unknown':
version += '+' + sha[:7] version += '+' + sha[:7]
report("Building wheel {}-{}".format(package_name, version)) report("Building wheel {}-{}".format(package_name, version))
cmake = CMake('build') cmake = CMake()
# all the work we need to do _before_ setup runs # all the work we need to do _before_ setup runs
def build_deps(): def build_deps():

View File

@ -20,4 +20,4 @@ if __name__ == '__main__':
options = parser.parse_args() options = parser.parse_args()
build_caffe2(version=None, cmake_python_library=None, build_python=False, build_caffe2(version=None, cmake_python_library=None, build_python=False,
rerun_cmake=True, cmake_only=False, cmake=CMake('build')) rerun_cmake=True, cmake_only=False, cmake=CMake())

View File

@ -12,7 +12,7 @@ import distutils.sysconfig
from distutils.version import LooseVersion from distutils.version import LooseVersion
from . import escape_path, which from . import escape_path, which
from .env import (IS_64BIT, IS_DARWIN, IS_WINDOWS, check_env_flag, check_negative_env_flag, build_type) from .env import (BUILD_DIR, IS_64BIT, IS_DARWIN, IS_WINDOWS, check_env_flag, check_negative_env_flag, build_type)
from .cuda import USE_CUDA from .cuda import USE_CUDA
from .dist_check import USE_DISTRIBUTED, USE_GLOO_IBVERBS from .dist_check import USE_DISTRIBUTED, USE_GLOO_IBVERBS
from .numpy_ import USE_NUMPY, NUMPY_INCLUDE_DIR from .numpy_ import USE_NUMPY, NUMPY_INCLUDE_DIR
@ -35,7 +35,7 @@ USE_NINJA = (not check_negative_env_flag('USE_NINJA') and
class CMake: class CMake:
"Manages cmake." "Manages cmake."
def __init__(self, build_dir): def __init__(self, build_dir=BUILD_DIR):
self._cmake_command = CMake._get_cmake_command() self._cmake_command = CMake._get_cmake_command()
self.build_dir = build_dir self.build_dir = build_dir

View File

@ -14,6 +14,8 @@ CONDA_DIR = os.path.join(os.path.dirname(sys.executable), '..')
IS_64BIT = (struct.calcsize("P") == 8) IS_64BIT = (struct.calcsize("P") == 8)
BUILD_DIR = 'build'
def check_env_flag(name, default=''): def check_env_flag(name, default=''):
return os.getenv(name, default).upper() in ['ON', '1', 'YES', 'TRUE', 'Y'] return os.getenv(name, default).upper() in ['ON', '1', 'YES', 'TRUE', 'Y']