summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorPeter Goldsborough <psag@fb.com>2018-01-22 16:49:11 -0800
committerZachary DeVito <zdevito@gmail.com>2018-02-01 16:19:03 -0800
commit1262fba8e76833eb98ea4e435ec99d2c7f840932 (patch)
tree52ee1b62440e051e6ac9d2954de1dc438d21e89d /setup.py
parent6665a45d5e73949e6547bd19ac1c2962cb969b1a (diff)
downloadpytorch-1262fba8e76833eb98ea4e435ec99d2c7f840932.tar.gz
pytorch-1262fba8e76833eb98ea4e435ec99d2c7f840932.tar.bz2
pytorch-1262fba8e76833eb98ea4e435ec99d2c7f840932.zip
[cpp extensions] Create torch.h and update setup.py
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py60
1 files changed, 44 insertions, 16 deletions
diff --git a/setup.py b/setup.py
index eb14af168f..c99f64f889 100644
--- a/setup.py
+++ b/setup.py
@@ -348,6 +348,19 @@ class install(setuptools.command.install.install):
def run(self):
if not self.skip_build:
self.run_command('build_deps')
+
+ # Copy include directories necessary to compile C++ extensions.
+ def copy_and_overwrite(src, dst):
+ print('copying {} -> {}'.format(src, dst))
+ if os.path.exists(dst):
+ shutil.rmtree(dst)
+ shutil.copytree(src, dst)
+
+ copy_and_overwrite('torch/csrc', 'torch/lib/include/torch/csrc/')
+ copy_and_overwrite('torch/lib/pybind11/include/pybind11/',
+ 'torch/lib/include/pybind11')
+ shutil.copy2('torch/torch.h', 'torch/lib/include/torch/torch.h')
+
setuptools.command.install.install.run(self)
@@ -736,20 +749,35 @@ cmdclass = {
}
cmdclass.update(build_dep_cmds)
-
if __name__ == '__main__':
- setup(name="torch", version=version,
- description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
- ext_modules=extensions,
- cmdclass=cmdclass,
- packages=packages,
- package_data={'torch': [
- 'lib/*.so*', 'lib/*.dylib*', 'lib/*.dll', 'lib/*.lib',
- 'lib/torch_shm_manager',
- 'lib/*.h',
- 'lib/include/TH/*.h', 'lib/include/TH/generic/*.h',
- 'lib/include/THC/*.h', 'lib/include/THC/generic/*.h',
- 'lib/include/ATen/*.h',
- ]},
- install_requires=['pyyaml', 'numpy'],
- )
+ setup(
+ name="torch",
+ version=version,
+ description=("Tensors and Dynamic neural networks in "
+ "Python with strong GPU acceleration"),
+ ext_modules=extensions,
+ cmdclass=cmdclass,
+ packages=packages,
+ package_data={
+ 'torch': [
+ 'lib/*.so*',
+ 'lib/*.dylib*',
+ 'lib/*.dll',
+ 'lib/*.lib',
+ 'lib/torch_shm_manager',
+ 'lib/*.h',
+ 'lib/include/ATen/*.h',
+ 'lib/include/pybind11/*.h',
+ 'lib/include/pybind11/detail/*.h',
+ 'lib/include/TH/*.h',
+ 'lib/include/TH/generic/*.h',
+ 'lib/include/THC/*.h',
+ 'lib/include/THC/generic/*.h',
+ 'lib/include/torch/csrc/*.h',
+ 'lib/include/torch/csrc/autograd/*.h',
+ 'lib/include/torch/csrc/jit/*.h',
+ 'lib/include/torch/csrc/utils/*.h',
+ 'lib/include/torch/torch.h',
+ ]
+ },
+ install_requires=['pyyaml', 'numpy'], )