mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/70863 ghstack-source-id: 148159368 Test Plan: Ought to be a no-op: rely on CI to validate. Reviewed By: malfet Differential Revision: D33367290 fbshipit-source-id: cb550538b9eafaa0117f94077ebd4cb920688881 (cherry picked from commit 077d9578bcbf5e41e806c6acb7a8f7c622f66fe9)
89 lines
2.0 KiB
Python
89 lines
2.0 KiB
Python
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
|
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
|
load("//tools/config:defs.bzl", "if_cuda")
|
|
|
|
# The bool_flag targets allow configuring the build from the
|
|
# command-line, e.g. --//c10:use_gflags or --no//c10:use_gflags to
|
|
# disable.
|
|
|
|
bool_flag(
|
|
name = "use_gflags",
|
|
build_setting_default = True,
|
|
)
|
|
|
|
bool_flag(
|
|
name = "use_glog",
|
|
build_setting_default = True,
|
|
)
|
|
|
|
config_setting(
|
|
name = "using_gflags",
|
|
flag_values = {":use_gflags": "true"},
|
|
)
|
|
|
|
config_setting(
|
|
name = "using_glog",
|
|
flag_values = {":use_glog": "true"},
|
|
)
|
|
|
|
cc_library(
|
|
name = "headers",
|
|
hdrs = [
|
|
"//c10/core:headers",
|
|
"//c10/cuda:headers",
|
|
"//c10/mobile:headers",
|
|
"//c10/util:headers",
|
|
],
|
|
deps = [
|
|
"//c10/core:alignment",
|
|
"//c10/cuda:Macros",
|
|
"//c10/macros",
|
|
] + select({
|
|
":using_gflags": ["@com_github_gflags_gflags//:gflags"],
|
|
"//conditions:default": [],
|
|
}) + select({
|
|
":using_glog": ["@com_github_glog//:glog"],
|
|
"//conditions:default": [],
|
|
}),
|
|
visibility = ["//:__pkg__"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "c10",
|
|
deps = [
|
|
":headers",
|
|
"//c10/core:CPUAllocator",
|
|
"//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",
|
|
] + if_cuda(
|
|
["//c10/cuda"],
|
|
[],
|
|
),
|
|
alwayslink = True,
|
|
visibility = ["//:__pkg__"],
|
|
)
|
|
|
|
cc_test(
|
|
name = "tests",
|
|
size = "small",
|
|
srcs = glob([
|
|
"test/util/*.cpp",
|
|
"test/util/*.h",
|
|
"test/core/*.cpp",
|
|
"test/core/impl/*.cpp",
|
|
]),
|
|
copts = ["-Wno-deprecated-declarations"],
|
|
deps = [
|
|
":c10",
|
|
":headers",
|
|
"@com_google_googletest//:gtest_main",
|
|
],
|
|
visibility = ["//:__pkg__"],
|
|
)
|