extract final two libraries out of //c10/util (#70856)

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

ghstack-source-id: 147302541

Test Plan: Relying on CI

Reviewed By: malfet

Differential Revision: D33329555

fbshipit-source-id: 1e7884b2df1c294a8fe9e7f3664a139487d27978
(cherry picked from commit 643cc436ec)
This commit is contained in:
Michael Dagitses 2022-01-26 07:32:24 -08:00 committed by PyTorch MergeBot
parent bfc481cf67
commit 130ca58601
2 changed files with 30 additions and 10 deletions

View File

@ -63,7 +63,6 @@ cc_library(
name = "c10", name = "c10",
srcs = [ srcs = [
"//c10/core:sources", "//c10/core:sources",
"//c10/util:sources",
] + glob([ ] + glob([
"mobile/*.cpp", "mobile/*.cpp",
]) + if_cuda( ]) + if_cuda(
@ -77,7 +76,9 @@ cc_library(
deps = [ deps = [
":headers", ":headers",
"//c10/core:ScalarType", "//c10/core:ScalarType",
"//c10/util:TypeCast",
"//c10/util:base", "//c10/util:base",
"//c10/util:typeid",
] + if_cuda( ] + if_cuda(
["@cuda"], ["@cuda"],
[], [],

View File

@ -1,4 +1,18 @@
def define_targets(rules): def define_targets(rules):
rules.cc_library(
name = "TypeCast",
srcs = ["TypeCast.cpp"],
hdrs = ["TypeCast.h"],
linkstatic = True,
local_defines = ["C10_BUILD_MAIN_LIB"],
visibility = ["//visibility:public"],
deps = [
":base",
"//c10/core:ScalarType",
"//c10/macros",
],
)
rules.cc_library( rules.cc_library(
name = "base", name = "base",
srcs = rules.glob( srcs = rules.glob(
@ -33,6 +47,20 @@ def define_targets(rules):
}), }),
) )
rules.cc_library(
name = "typeid",
srcs = ["typeid.cpp"],
hdrs = ["typeid.h"],
linkstatic = True,
local_defines = ["C10_BUILD_MAIN_LIB"],
visibility = ["//visibility:public"],
deps = [
":base",
"//c10/core:ScalarType",
"//c10/macros",
],
)
rules.filegroup( rules.filegroup(
name = "headers", name = "headers",
srcs = rules.glob( srcs = rules.glob(
@ -42,12 +70,3 @@ def define_targets(rules):
), ),
visibility = ["//c10:__pkg__"], visibility = ["//c10:__pkg__"],
) )
rules.filegroup(
name = "sources",
srcs = [
"TypeCast.cpp",
"typeid.cpp",
],
visibility = ["//c10:__pkg__"],
)