@@ -3,6 +3,7 @@ load("@fbsource//tools/build_defs/android:fb_android_cxx_library.bzl", "fb_andro
3
3
load ("@fbsource//xplat/executorch/backends/xnnpack/third-party:third_party_libs.bzl" , "third_party_dep" )
4
4
load ("@fbsource//xplat/executorch/build:runtime_wrapper.bzl" , "runtime" )
5
5
load ("@fbsource//xplat/executorch/codegen:codegen.bzl" , "executorch_generated_lib" )
6
+ load (":build_defs.bzl" , "ET_JNI_COMPILER_FLAGS" )
6
7
7
8
oncall ("executorch" )
8
9
@@ -28,16 +29,12 @@ non_fbcode_target(_kind = executorch_generated_lib,
28
29
non_fbcode_target (_kind = fb_android_cxx_library ,
29
30
name = "executorch_jni" ,
30
31
srcs = ["jni_layer.cpp" , "log.cpp" ],
31
- headers = ["jni_layer_constants.h" ],
32
32
allow_jni_merging = False ,
33
- compiler_flags = [
34
- "-frtti" ,
35
- "-fexceptions" ,
36
- "-Wno-unused-variable" ,
37
- ],
33
+ compiler_flags = ET_JNI_COMPILER_FLAGS ,
38
34
soname = "libexecutorch.$(ext)" ,
39
35
visibility = ["PUBLIC" ],
40
36
deps = [
37
+ ":jni_headers" ,
41
38
":log_provider_static" ,
42
39
"//fbandroid/libraries/fbjni:fbjni" ,
43
40
"//fbandroid/native/fb:fb" ,
@@ -53,16 +50,12 @@ non_fbcode_target(_kind = fb_android_cxx_library,
53
50
non_fbcode_target (_kind = fb_android_cxx_library ,
54
51
name = "executorch_jni_full" ,
55
52
srcs = ["jni_layer.cpp" , "log.cpp" ],
56
- headers = ["jni_layer_constants.h" ],
57
53
allow_jni_merging = False ,
58
- compiler_flags = [
59
- "-frtti" ,
60
- "-fexceptions" ,
61
- "-Wno-unused-variable" ,
62
- ],
54
+ compiler_flags = ET_JNI_COMPILER_FLAGS ,
63
55
soname = "libexecutorch.$(ext)" ,
64
56
visibility = ["PUBLIC" ],
65
57
deps = [
58
+ ":jni_headers" ,
66
59
":log_provider_static" ,
67
60
":generated_op_lib_optimized_static" ,
68
61
"//fbandroid/libraries/fbjni:fbjni" ,
@@ -82,17 +75,14 @@ non_fbcode_target(_kind = fb_android_cxx_library,
82
75
"jni_layer.cpp" ,
83
76
"jni_layer_llama.cpp" ,
84
77
],
85
- headers = ["jni_layer_constants.h" ],
86
78
allow_jni_merging = False ,
87
- compiler_flags = [
88
- "-frtti" ,
89
- "-fexceptions" ,
79
+ compiler_flags = ET_JNI_COMPILER_FLAGS + [
90
80
"-DEXECUTORCH_BUILD_LLAMA_JNI" ,
91
- "-Wno-format" ,
92
81
],
93
82
soname = "libexecutorch.$(ext)" ,
94
83
visibility = ["PUBLIC" ],
95
84
deps = [
85
+ ":jni_headers" ,
96
86
":log_provider_static" ,
97
87
"//fbandroid/libraries/fbjni:fbjni" ,
98
88
"//fbandroid/native/fb:fb" ,
@@ -112,13 +102,20 @@ non_fbcode_target(_kind = runtime.cxx_library,
112
102
name = "log_provider" ,
113
103
srcs = ["log.cpp" ],
114
104
exported_headers = ["log.h" ],
115
- compiler_flags = [
116
- "-frtti" ,
117
- "-fexceptions" ,
118
- "-Wno-unused-variable" ,
119
- ],
105
+ compiler_flags = ET_JNI_COMPILER_FLAGS ,
120
106
deps = [
121
107
"//executorch/runtime/core:core" ,
122
108
],
123
109
visibility = ["@EXECUTORCH_CLIENTS" ],
124
110
)
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