Unify libtorch and libcaffe2 (#17783)

Summary:
This PR is an intermediate step toward the ultimate goal of eliminating "caffe2" in favor of "torch".  This PR moves all of the files that had constituted "libtorch.so" into the "libcaffe2.so" library, and wraps "libcaffe2.so" with a shell library named "libtorch.so".  This means that, for now, `caffe2/CMakeLists.txt` becomes a lot bigger, and `torch/CMakeLists.txt` becomes smaller.

The torch Python bindings (`torch_python.so`) still remain in `torch/CMakeLists.txt`.

The follow-up to this PR will rename references to `caffe2` to `torch`, and flatten the shell into one library.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17783

Differential Revision: D15284178

Pulled By: kostmo

fbshipit-source-id: a08387d735ae20652527ced4e69fd75b8ff88b05
This commit is contained in:
Karl Ostmo
2019-05-10 09:44:49 -07:00
committed by Facebook Github Bot
parent 872bab22c6
commit 4ba28deb6e
15 changed files with 751 additions and 587 deletions

View File

@ -429,7 +429,6 @@ def CppExtension(name, sources, *args, **kwargs):
libraries = kwargs.get('libraries', [])
libraries.append('c10')
libraries.append('caffe2')
libraries.append('torch')
libraries.append('torch_python')
libraries.append('_C')
kwargs['libraries'] = libraries
@ -476,7 +475,6 @@ def CUDAExtension(name, sources, *args, **kwargs):
libraries.append('c10')
libraries.append('c10_cuda')
libraries.append('caffe2')
libraries.append('torch')
libraries.append('torch_python')
libraries.append('caffe2_gpu')
libraries.append('_C')
@ -891,7 +889,6 @@ def _prepare_ldflags(extra_ldflags, with_cuda, verbose):
extra_ldflags.append('c10.lib')
extra_ldflags.append('caffe2.lib')
extra_ldflags.append('torch.lib')
extra_ldflags.append('torch_python.lib')
if with_cuda:
extra_ldflags.append('caffe2_gpu.lib')