xref: /aosp_15_r20/external/executorch/extension/android/jni/BUCK (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbsource//tools/build_defs/android:fb_android_cxx_library.bzl", "fb_android_cxx_library")
2load("@fbsource//xplat/executorch/backends/xnnpack/third-party:third_party_libs.bzl", "third_party_dep")
3load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
4load("@fbsource//xplat/executorch/codegen:codegen.bzl", "executorch_generated_lib")
5
6oncall("executorch")
7
8executorch_generated_lib(
9    name = "generated_op_lib_optimized",
10    custom_ops_aten_kernel_deps = [
11        "//executorch/kernels/portable:operators_aten",
12    ],
13    custom_ops_yaml_target = "//executorch/kernels/portable:custom_ops.yaml",
14    define_static_targets = True,
15    fallback_yaml_target = "//executorch/kernels/portable:functions.yaml",
16    functions_yaml_target = "//executorch/kernels/optimized:optimized.yaml",
17    visibility = ["PUBLIC"],
18    deps = [
19        "//executorch/kernels/optimized:optimized_operators",
20        "//executorch/kernels/optimized:optimized_oplist",
21        "//executorch/kernels/portable:executorch_aten_ops",
22        "//executorch/kernels/portable:executorch_custom_ops",
23        "//executorch/kernels/portable:operators",
24    ],
25)
26
27fb_android_cxx_library(
28    name = "executorch_jni",
29    srcs = ["jni_layer.cpp", "log.cpp"],
30    headers = ["jni_layer_constants.h"],
31    allow_jni_merging = False,
32    compiler_flags = [
33        "-frtti",
34        "-fexceptions",
35        "-Wno-unused-variable",
36    ],
37    soname = "libexecutorch.$(ext)",
38    visibility = ["PUBLIC"],
39    deps = [
40        ":log_provider_static",
41        "//fbandroid/libraries/fbjni:fbjni",
42        "//fbandroid/native/fb:fb",
43        "//third-party/glog:glog",
44        "//xplat/executorch/extension/module:module_static",
45        "//xplat/executorch/extension/runner_util:inputs_static",
46        "//xplat/executorch/extension/tensor:tensor_static",
47        "//xplat/executorch/extension/threadpool:threadpool_static",
48        third_party_dep("cpuinfo"),
49    ],
50)
51
52fb_android_cxx_library(
53    name = "executorch_jni_full",
54    srcs = ["jni_layer.cpp", "log.cpp"],
55    headers = ["jni_layer_constants.h"],
56    allow_jni_merging = False,
57    compiler_flags = [
58        "-frtti",
59        "-fexceptions",
60        "-Wno-unused-variable",
61    ],
62    soname = "libexecutorch.$(ext)",
63    visibility = ["PUBLIC"],
64    deps = [
65        ":log_provider_static",
66        ":generated_op_lib_optimized_static",
67        "//fbandroid/libraries/fbjni:fbjni",
68        "//fbandroid/native/fb:fb",
69        "//third-party/glog:glog",
70        "//xplat/executorch/backends/xnnpack:xnnpack_backend_static",
71        "//xplat/executorch/extension/module:module_static",
72        "//xplat/executorch/extension/runner_util:inputs_static",
73        "//xplat/executorch/extension/tensor:tensor_static",
74    ],
75)
76
77fb_android_cxx_library(
78    name = "executorch_llama_jni",
79    srcs = [
80        "jni_layer.cpp",
81        "jni_layer_llama.cpp",
82    ],
83    headers = ["jni_layer_constants.h"],
84    allow_jni_merging = False,
85    compiler_flags = [
86        "-frtti",
87        "-fexceptions",
88        "-DEXECUTORCH_BUILD_LLAMA_JNI",
89        "-Wno-format",
90    ],
91    soname = "libexecutorch.$(ext)",
92    visibility = ["PUBLIC"],
93    deps = [
94        ":log_provider_static",
95        "//fbandroid/libraries/fbjni:fbjni",
96        "//fbandroid/native/fb:fb",
97        "//third-party/glog:glog",
98        "//xplat/executorch/backends/xnnpack:xnnpack_backend_static",
99        "//xplat/executorch/examples/models/llama/runner:runner_static",
100        "//xplat/executorch/examples/models/llava/runner:runner_static",
101        "//xplat/executorch/extension/module:module_static",
102        "//xplat/executorch/extension/runner_util:inputs_static",
103        "//xplat/executorch/extension/tensor:tensor_static",
104        "//xplat/executorch/extension/threadpool:cpuinfo_utils_static",
105        "//xplat/executorch/extension/threadpool:threadpool_static",
106    ],
107)
108
109runtime.cxx_library(
110    name = "log_provider",
111    srcs = ["log.cpp"],
112    exported_headers = ["log.h"],
113    compiler_flags = [
114        "-frtti",
115        "-fexceptions",
116        "-Wno-unused-variable",
117    ],
118    deps = [
119        "//executorch/runtime/core:core",
120    ],
121    visibility = ["@EXECUTORCH_CLIENTS"],
122)
123