build torch for libtorch mobile build (#21234)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21234
ghimport-source-id: 8d401691a811991c79acf5e09e60389910910365

Differential Revision: D15616540

Pulled By: ljk53

fbshipit-source-id: 150e706630911bf14c55f47f4058eaada1edf1cc
This commit is contained in:
Jiakai Liu
2019-06-03 19:42:33 -07:00
committed by Facebook Github Bot
parent 82ceeaeca2
commit 702ba3d2fb
2 changed files with 2 additions and 3 deletions

View File

@ -194,7 +194,6 @@ endif()
# TorchScript model, but doesn't contain not-yet-unified caffe2 ops;
if (INTERN_BUILD_MOBILE AND NOT BUILD_CAFFE2_MOBILE)
set(BUILD_PYTHON OFF)
set(BUILD_TORCH ON)
set(BUILD_CAFFE2_OPS OFF)
set(USE_DISTRIBUTED OFF)
set(FEATURE_TORCH_MOBILE ON)

View File

@ -228,7 +228,7 @@ endif()
if (NOT INTERN_BUILD_MOBILE)
if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
@ -557,7 +557,7 @@ target_link_libraries(torch caffe2)
# formerly-libtorch flags
# ==========================================================
if (NOT INTERN_BUILD_MOBILE)
if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
# Forces caffe2.pb.h to be generated before its dependents are compiled.
# Adding the generated header file to the ${TORCH_SRCS} list is not sufficient