mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
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
24 lines
1015 B
Python
24 lines
1015 B
Python
import argparse
|
|
from os.path import dirname, abspath
|
|
import sys
|
|
|
|
# By appending pytorch_root to sys.path, this module can import other torch
|
|
# modules even when run as a standalone script. i.e., it's okay either you
|
|
# do `python build_libtorch.py` or `python -m tools.build_libtorch`.
|
|
pytorch_root = dirname(dirname(abspath(__file__)))
|
|
sys.path.append(pytorch_root)
|
|
|
|
# If you want to modify flags or environmental variables that is set when
|
|
# building torch, you should do it in tools/setup_helpers/configure.py.
|
|
# Please don't add it here unless it's only used in LibTorch.
|
|
from tools.build_pytorch_libs import build_caffe2
|
|
from tools.setup_helpers.cmake import CMake
|
|
|
|
if __name__ == '__main__':
|
|
# Placeholder for future interface. For now just gives a nice -h.
|
|
parser = argparse.ArgumentParser(description='Build libtorch')
|
|
options = parser.parse_args()
|
|
|
|
build_caffe2(version=None, cmake_python_library=None, build_python=False,
|
|
rerun_cmake=True, cmake_only=False, cmake=CMake())
|