1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") 2 3def define_common_targets(): 4 """Defines targets that should be shared between fbcode and xplat. 5 6 The directory containing this targets.bzl file should also contain both 7 TARGETS and BUCK files that call this function. 8 """ 9 10 for aten_mode in (True, False): 11 aten_suffix = "_aten" if aten_mode else "" 12 13 # Depend on this target if your types (Tensor, ArrayRef, etc) should be flexible between ATen and executor 14 runtime.cxx_library( 15 name = "lib" + aten_suffix, 16 exported_headers = ["exec_aten.h"], 17 exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], 18 visibility = [ 19 "//executorch/...", 20 "@EXECUTORCH_CLIENTS", 21 ], 22 exported_deps = ["//executorch/runtime/core:tensor_shape_dynamism"] + ([] if aten_mode else ["//executorch/runtime/core/portable_type:portable_type"]), 23 exported_external_deps = ["libtorch"] if aten_mode else [], 24 ) 25