From a5b4839f35f89151b4346c91627aad89af5fb06a Mon Sep 17 00:00:00 2001 From: Sergii Dymchenko Date: Fri, 15 Apr 2022 17:25:29 +0000 Subject: [PATCH] Move //xplat/caffe2:caffe2_serialize to shared build structure Summary: This is a first step to migrate xplat targets to shared build structure. Eventually both xplat buck and open source bazel targets will be generated from shared build.bzl. Test Plan: Should be no-op, rely on CI. Reviewed By: malfet Differential Revision: D35270004 Pull Request resolved: https://github.com/pytorch/pytorch/pull/75847 Approved by: https://github.com/linbinyu --- build.bzl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 build.bzl diff --git a/build.bzl b/build.bzl new file mode 100644 index 0000000000000..33d6c02b7c1c8 --- /dev/null +++ b/build.bzl @@ -0,0 +1,25 @@ +def define_targets(rules): + rules.cc_library( + name = "caffe2_serialize", + srcs = [ + "caffe2/serialize/file_adapter.cc", + "caffe2/serialize/inline_container.cc", + "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", + ], + visibility = ["//visibility:public"], + deps = [ + ":caffe2_headers", + ":miniz", + "//third-party/glog:glog", + "//xplat/caffe2/c10:c10", + ], + )