define //c10/core:CPUAllocator target (#70862)

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

ghstack-source-id: 147642558

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

Reviewed By: malfet

Differential Revision: D33330151

fbshipit-source-id: f566993f47cffa0df85105f3787bb5c6385cf5d6
This commit is contained in:
mikey dagitses 2022-01-26 23:23:39 -08:00 committed by Facebook GitHub Bot
parent 2b5264ebc4
commit a17c3865ef
2 changed files with 21 additions and 9 deletions

View File

@ -62,9 +62,7 @@ cc_library(
cc_library(
name = "c10",
srcs = [
"//c10/core:sources",
] + if_cuda(
srcs = if_cuda(
glob([
"cuda/*.cpp",
"cuda/impl/*.cpp",
@ -74,6 +72,7 @@ cc_library(
local_defines = ["C10_BUILD_MAIN_LIB"],
deps = [
":headers",
"//c10/core:CPUAllocator",
"//c10/core:ScalarType",
"//c10/core:alloc_cpu",
"//c10/core:base",

View File

@ -1,4 +1,23 @@
def define_targets(rules):
rules.cc_library(
name = "CPUAllocator",
srcs = ["CPUAllocator.cpp"],
hdrs = ["CPUAllocator.h"],
# This library defines a flag, The use of alwayslink keeps it
# from being stripped.
alwayslink = True,
linkstatic = True,
local_defines = ["C10_BUILD_MAIN_LIB"],
visibility = ["//visibility:public"],
deps = [
":alignment",
":base",
"//c10/mobile:CPUCachingAllocator",
"//c10/mobile:CPUProfilingAllocator",
"//c10/util:base",
],
)
rules.cc_library(
name = "ScalarType",
hdrs = ["ScalarType.h"],
@ -83,9 +102,3 @@ def define_targets(rules):
),
visibility = ["//c10:__pkg__"],
)
rules.filegroup(
name = "sources",
srcs = ["CPUAllocator.cpp"],
visibility = ["//c10:__pkg__"],
)