@@ -3,6 +3,7 @@ load("@fbsource//tools/build_defs/android:fb_android_cxx_library.bzl", "fb_andro
33load ("@fbsource//xplat/executorch/backends/xnnpack/third-party:third_party_libs.bzl" , "third_party_dep" )
44load ("@fbsource//xplat/executorch/build:runtime_wrapper.bzl" , "runtime" )
55load ("@fbsource//xplat/executorch/codegen:codegen.bzl" , "executorch_generated_lib" )
6+ load (":build_defs.bzl" , "ET_JNI_COMPILER_FLAGS" )
67
78oncall ("executorch" )
89
@@ -28,16 +29,12 @@ non_fbcode_target(_kind = executorch_generated_lib,
2829non_fbcode_target (_kind = fb_android_cxx_library ,
2930 name = "executorch_jni" ,
3031 srcs = ["jni_layer.cpp" , "log.cpp" ],
31- headers = ["jni_layer_constants.h" ],
3232 allow_jni_merging = False ,
33- compiler_flags = [
34- "-frtti" ,
35- "-fexceptions" ,
36- "-Wno-unused-variable" ,
37- ],
33+ compiler_flags = ET_JNI_COMPILER_FLAGS ,
3834 soname = "libexecutorch.$(ext)" ,
3935 visibility = ["PUBLIC" ],
4036 deps = [
37+ ":jni_headers" ,
4138 ":log_provider_static" ,
4239 "//fbandroid/libraries/fbjni:fbjni" ,
4340 "//fbandroid/native/fb:fb" ,
@@ -53,16 +50,12 @@ non_fbcode_target(_kind = fb_android_cxx_library,
5350non_fbcode_target (_kind = fb_android_cxx_library ,
5451 name = "executorch_jni_full" ,
5552 srcs = ["jni_layer.cpp" , "log.cpp" ],
56- headers = ["jni_layer_constants.h" ],
5753 allow_jni_merging = False ,
58- compiler_flags = [
59- "-frtti" ,
60- "-fexceptions" ,
61- "-Wno-unused-variable" ,
62- ],
54+ compiler_flags = ET_JNI_COMPILER_FLAGS ,
6355 soname = "libexecutorch.$(ext)" ,
6456 visibility = ["PUBLIC" ],
6557 deps = [
58+ ":jni_headers" ,
6659 ":log_provider_static" ,
6760 ":generated_op_lib_optimized_static" ,
6861 "//fbandroid/libraries/fbjni:fbjni" ,
@@ -82,17 +75,14 @@ non_fbcode_target(_kind = fb_android_cxx_library,
8275 "jni_layer.cpp" ,
8376 "jni_layer_llama.cpp" ,
8477 ],
85- headers = ["jni_layer_constants.h" ],
8678 allow_jni_merging = False ,
87- compiler_flags = [
88- "-frtti" ,
89- "-fexceptions" ,
79+ compiler_flags = ET_JNI_COMPILER_FLAGS + [
9080 "-DEXECUTORCH_BUILD_LLAMA_JNI" ,
91- "-Wno-format" ,
9281 ],
9382 soname = "libexecutorch.$(ext)" ,
9483 visibility = ["PUBLIC" ],
9584 deps = [
85+ ":jni_headers" ,
9686 ":log_provider_static" ,
9787 "//fbandroid/libraries/fbjni:fbjni" ,
9888 "//fbandroid/native/fb:fb" ,
@@ -112,13 +102,20 @@ non_fbcode_target(_kind = runtime.cxx_library,
112102 name = "log_provider" ,
113103 srcs = ["log.cpp" ],
114104 exported_headers = ["log.h" ],
115- compiler_flags = [
116- "-frtti" ,
117- "-fexceptions" ,
118- "-Wno-unused-variable" ,
119- ],
105+ compiler_flags = ET_JNI_COMPILER_FLAGS ,
120106 deps = [
121107 "//executorch/runtime/core:core" ,
122108 ],
123109 visibility = ["@EXECUTORCH_CLIENTS" ],
124110)
111+
112+ runtime .export_file (
113+ name = "jni_layer.cpp" ,
114+ )
115+
116+ runtime .cxx_library (
117+ name = "jni_headers" ,
118+ exported_headers = [
119+ "jni_layer_constants.h" ,
120+ ]
121+ )
0 commit comments