[torch] Add torch cpp cpu target for torch/csrc/api/src files (#87327)

Summary: Duplicating fbcode target `fbcode//caffe2:torch-cpp-cpu` target in xplat. In D40460749 our user wants to use `torch::kNearest` enum which is defined in `torch/csrc/api/src/enum.cpp`. Adding this target to support it.

Test Plan: Rely on CI

Differential Revision: D40532087

Pull Request resolved: https://github.com/pytorch/pytorch/pull/87327
Approved by: https://github.com/ezyang
This commit is contained in:
Mengwei Liu
2022-10-27 06:04:22 +00:00
committed by PyTorch MergeBot
parent bf113e38fa
commit 4b23905172

View File

@ -22,6 +22,7 @@ load(
"jit_core_headers",
"jit_core_sources",
"libtorch_profiler_sources",
"torch_cpp_srcs",
"torch_mobile_tracer_sources",
)
load(
@ -1368,6 +1369,19 @@ def define_buck_targets(
],
)
pt_xplat_cxx_library(
name = "torch_cpp_cpu",
srcs = torch_cpp_srcs,
headers = native.glob(["torch/csrc/api/include/**/*.h"]) + ["torch/script.h"],
compiler_flags = get_pt_compiler_flags(),
exported_preprocessor_flags = get_pt_preprocessor_flags(),
visibility = ["PUBLIC"],
exported_deps = [
":torch",
":torch_mobile_deserialize_common", # for torch/csrc/api/src/serialize/input-archive.cpp
],
)
pt_xplat_cxx_library(
name = "torch_core",
srcs = core_sources_full_mobile_no_backend_interface + [