define the caffe2_serialize target in Bazel (#75942)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75942

This also requires changes to the target definition and the xplat translator to get it working.
ghstack-source-id: 154678046

Test Plan: Verify locally and rely on CI.

Reviewed By: malfet

Differential Revision: D35704597

fbshipit-source-id: 6b0d9f5a044609b24dda656f80233ba6186c097f
(cherry picked from commit 6de43c5ca7a973c9f8b71f4d60d4d5e85cc2ba21)
This commit is contained in:
mikey dagitses
2022-04-25 09:04:57 -07:00
committed by PyTorch MergeBot
parent 0d7be81c9c
commit d78dd825ba
2 changed files with 7 additions and 7 deletions

View File

@ -3,10 +3,14 @@ load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "cc_test")
load("//third_party:substitution.bzl", "header_template_rule")
load("//:tools/bazel.bzl", "rules")
load("//:tools/build_variables.bzl", "jit_core_sources", "libtorch_core_sources", "libtorch_cuda_sources", "libtorch_distributed_sources", "libtorch_extra_sources", "libtorch_nvfuser_generated_headers", "libtorch_nvfuser_runtime_sources", "libtorch_python_core_sources", "torch_cpp_srcs", "lazy_tensor_ts_sources")
load("//tools/rules:cu.bzl", "cu_library")
load("//tools/config:defs.bzl", "if_cuda")
load("//:aten.bzl", "intern_build_aten_ops", "generate_aten", "aten_ufunc_generated_cpu_sources", "aten_ufunc_generated_cpu_kernel_sources", "aten_ufunc_generated_cuda_sources")
load(":build.bzl", "define_targets")
define_targets(rules = rules)
COMMON_COPTS = [
"-DHAVE_MALLOC_USABLE_SIZE=1",

View File

@ -7,10 +7,6 @@ def define_targets(rules):
"caffe2/serialize/istream_adapter.cc",
"caffe2/serialize/read_adapter_interface.cc",
],
# Flags that end with '()' are converted to a list of strings
# by calling the function when translating in to buck/bazel.
# TODO: find a better way to do this.
copts = ["get_c2_fbandroid_xplat_compiler_flags()", "-frtti"],
tags = [
"supermodule:android/default/pytorch",
"supermodule:ios/default/public.pytorch",
@ -18,8 +14,8 @@ def define_targets(rules):
visibility = ["//visibility:public"],
deps = [
":caffe2_headers",
":miniz",
"//third-party/glog:glog",
"//xplat/caffe2/c10:c10",
"@com_github_glog//:glog",
"//c10",
"//third_party/miniz-2.0.8:miniz",
],
)