1def define_targets(rules): 2 rules.cc_library( 3 name = "CPUAllocator", 4 srcs = ["CPUAllocator.cpp"], 5 hdrs = ["CPUAllocator.h"], 6 linkstatic = True, 7 local_defines = ["C10_BUILD_MAIN_LIB"], 8 visibility = ["//visibility:public"], 9 deps = [ 10 ":alignment", 11 ":base", 12 "//c10/mobile:CPUCachingAllocator", 13 "//c10/mobile:CPUProfilingAllocator", 14 "//c10/util:base", 15 ], 16 # This library defines a flag, The use of alwayslink keeps it 17 # from being stripped. 18 alwayslink = True, 19 ) 20 21 rules.cc_library( 22 name = "ScalarType", 23 hdrs = ["ScalarType.h"], 24 linkstatic = True, 25 local_defines = ["C10_BUILD_MAIN_LIB"], 26 visibility = ["//visibility:public"], 27 deps = ["//c10/util:base"], 28 ) 29 30 rules.cc_library( 31 name = "alignment", 32 hdrs = ["alignment.h"], 33 linkstatic = True, 34 local_defines = ["C10_BUILD_MAIN_LIB"], 35 visibility = ["//visibility:public"], 36 ) 37 38 rules.cc_library( 39 name = "alloc_cpu", 40 srcs = ["impl/alloc_cpu.cpp"], 41 hdrs = ["impl/alloc_cpu.h"], 42 linkstatic = True, 43 local_defines = ["C10_BUILD_MAIN_LIB"], 44 visibility = ["//visibility:public"], 45 deps = [ 46 ":alignment", 47 "//c10/macros", 48 "//c10/util:base", 49 ], 50 # This library defines flags, The use of alwayslink keeps them 51 # from being stripped. 52 alwayslink = True, 53 ) 54 55 rules.cc_library( 56 name = "base", 57 srcs = rules.glob( 58 [ 59 "*.cpp", 60 "impl/*.cpp", 61 ], 62 exclude = [ 63 "CPUAllocator.cpp", 64 "impl/alloc_cpu.cpp", 65 ], 66 ), 67 hdrs = rules.glob( 68 [ 69 "*.h", 70 "impl/*.h", 71 ], 72 exclude = [ 73 "CPUAllocator.h", 74 "impl/alloc_cpu.h", 75 ], 76 ), 77 linkstatic = True, 78 local_defines = ["C10_BUILD_MAIN_LIB"], 79 visibility = ["//visibility:public"], 80 deps = [ 81 ":ScalarType", 82 "//third_party/cpuinfo", 83 "//c10/macros", 84 "//c10/util:TypeCast", 85 "//c10/util:base", 86 "//c10/util:typeid", 87 ], 88 # This library uses flags and registration. Do not let the 89 # linker remove them. 90 alwayslink = True, 91 ) 92 93 rules.filegroup( 94 name = "headers", 95 srcs = rules.glob( 96 [ 97 "*.h", 98 "impl/*.h", 99 ], 100 exclude = [ 101 "alignment.h", 102 ], 103 ), 104 visibility = ["//c10:__pkg__"], 105 ) 106