diff --git a/c10/BUILD.bazel b/c10/BUILD.bazel index 37ab56a1e76f..76164698cf31 100644 --- a/c10/BUILD.bazel +++ b/c10/BUILD.bazel @@ -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", diff --git a/c10/mobile/BUILD.bazel b/c10/mobile/BUILD.bazel new file mode 100644 index 000000000000..d1a0db360d23 --- /dev/null +++ b/c10/mobile/BUILD.bazel @@ -0,0 +1,4 @@ +load("//:tools/bazel.bzl", "rules") +load(":build.bzl", "define_targets") + +define_targets(rules = rules) diff --git a/c10/mobile/build.bzl b/c10/mobile/build.bzl new file mode 100644 index 000000000000..f4d17cf581cc --- /dev/null +++ b/c10/mobile/build.bzl @@ -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__"], + )