remove ONNX & Turn on NO_API for mobile build (#23546)

Summary:
### Summary
The iOS build was broken after this PR 👉 [23195](https://github.com/pytorch/pytorch/pull/23195/files) was merged, as there are two files still have dependency on ONNX.
- `test.cpp` in `test/cpp/jit`
-  `export.cpp` in `torch/csrc/jit`

This PR is to remove ONNX completely from mobile build.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23546

Test Plan:
- The `build_ios.sh` finished successfully.
- The `libtorch.a` can  be compiled and run on iOS devices

Differential Revision: D16558236

Pulled By: xta0

fbshipit-source-id: b7ff1db750698cfd5a72d5cb0b9f2f378e315077
This commit is contained in:
Tao Xu 2019-07-31 10:26:58 -07:00 committed by Facebook Github Bot
parent 9130ab380a
commit 87a75bd605
2 changed files with 11 additions and 7 deletions

View file

@ -221,6 +221,7 @@ if (INTERN_BUILD_MOBILE AND NOT BUILD_CAFFE2_MOBILE)
set(BUILD_CAFFE2_OPS OFF)
set(USE_DISTRIBUTED OFF)
set(FEATURE_TORCH_MOBILE ON)
set(NO_API ON)
endif()
if (BUILD_ATEN_ONLY)

View file

@ -366,7 +366,6 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
${TORCH_SRC_DIR}/csrc/jit/autodiff.cpp
${TORCH_SRC_DIR}/csrc/jit/attributes.cpp
${TORCH_SRC_DIR}/csrc/jit/argument_spec.cpp
${TORCH_SRC_DIR}/csrc/jit/export.cpp
${TORCH_SRC_DIR}/csrc/jit/pass_manager.cpp
${TORCH_SRC_DIR}/csrc/jit/pickler.cpp
${TORCH_SRC_DIR}/csrc/jit/graph_executor.cpp
@ -430,7 +429,6 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
${TORCH_SRC_DIR}/csrc/jit/register_special_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/scope.cpp
${TORCH_SRC_DIR}/csrc/jit/script/compiler.cpp
${TORCH_SRC_DIR}/csrc/api/src/jit.cpp
${TORCH_SRC_DIR}/csrc/jit/testing/file_check.cpp
${TORCH_SRC_DIR}/csrc/jit/script/convert_to_ssa.cpp
${TORCH_SRC_DIR}/csrc/jit/script/exit_transforms.cpp
@ -457,14 +455,19 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
${TORCH_SRC_DIR}/csrc/jit/fuser/codegen.cpp
${TORCH_SRC_DIR}/csrc/jit/fuser/fallback.cpp
${TORCH_SRC_DIR}/csrc/jit/function.cpp
${TORCH_ROOT}/test/cpp/jit/test.cpp
)
if (NOT WIN32 AND NOT INTERN_BUILD_MOBILE)
list(APPEND TORCH_SRCS
${TORCH_SRC_DIR}/csrc/jit/fuser/cpu/fused_kernel.cpp
if (NOT INTERN_BUILD_MOBILE)
list(APPEND TORCH_SRCS
${TORCH_SRC_DIR}/csrc/api/src/jit.cpp
${TORCH_SRC_DIR}/csrc/jit/export.cpp
${TORCH_ROOT}/test/cpp/jit/test.cpp
)
endif ()
if (NOT WIN32)
list(APPEND TORCH_SRCS
${TORCH_SRC_DIR}/csrc/jit/fuser/cpu/fused_kernel.cpp)
endif()
endif()
if (USE_CUDA)
if (NOT USE_ROCM)