define //c10/mobile targets (#70861)

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

ghstack-source-id: 147642549

Test Plan: Should be a no-op. Rely on CI to validate.

Reviewed By: malfet

Differential Revision: D33329870

fbshipit-source-id: 7dbccaa994737c5fe7195d02dffd61eeceb19ceb
(cherry picked from commit 2b5264ebc49e4a5445c066e07f15bad041f42ac8)
This commit is contained in:
mikey dagitses
2022-01-26 23:23:39 -08:00
committed by PyTorch MergeBot
parent 844a4b47df
commit 41690d7804
3 changed files with 40 additions and 4 deletions

View File

@ -40,11 +40,11 @@ cc_library(
name = "headers",
hdrs = [
"//c10/core:headers",
"//c10/mobile:headers",
"//c10/util:headers",
] + glob([
"cuda/*.h",
"cuda/impl/*.h",
"mobile/*.h",
]),
deps = [
":cuda_cmake_macros_h",
@ -64,9 +64,7 @@ cc_library(
name = "c10",
srcs = [
"//c10/core:sources",
] + glob([
"mobile/*.cpp",
]) + if_cuda(
] + if_cuda(
glob([
"cuda/*.cpp",
"cuda/impl/*.cpp",
@ -79,6 +77,8 @@ cc_library(
"//c10/core:ScalarType",
"//c10/core:alloc_cpu",
"//c10/core:base",
"//c10/mobile:CPUCachingAllocator",
"//c10/mobile:CPUProfilingAllocator",
"//c10/util:TypeCast",
"//c10/util:base",
"//c10/util:typeid",

4
c10/mobile/BUILD.bazel Normal file
View File

@ -0,0 +1,4 @@
load("//:tools/bazel.bzl", "rules")
load(":build.bzl", "define_targets")
define_targets(rules = rules)

32
c10/mobile/build.bzl Normal file
View File

@ -0,0 +1,32 @@
def define_targets(rules):
rules.cc_library(
name = "CPUCachingAllocator",
srcs = ["CPUCachingAllocator.cpp"],
hdrs = ["CPUCachingAllocator.h"],
linkstatic = True,
local_defines = ["C10_BUILD_MAIN_LIB"],
visibility = ["//visibility:public"],
deps = [
"//c10/core:alloc_cpu",
"//c10/util:base",
],
)
rules.cc_library(
name = "CPUProfilingAllocator",
srcs = ["CPUProfilingAllocator.cpp"],
hdrs = ["CPUProfilingAllocator.h"],
linkstatic = True,
local_defines = ["C10_BUILD_MAIN_LIB"],
visibility = ["//visibility:public"],
deps = [
"//c10/core:alloc_cpu",
"//c10/util:base",
],
)
rules.filegroup(
name = "headers",
srcs = rules.glob(["*.h"]),
visibility = ["//c10:__pkg__"],
)