@@ -35,45 +35,49 @@ def define_common_targets():
3535        ],
3636    )
3737
38-     runtime .cxx_library (
39-         name  =  "runtime" ,
40-         srcs  =  glob (
41-             [
42-                 "*.cpp" ,
43-                 "backends/*.cpp" ,
44-                 "backends/htpbackend/*.cpp" ,
45-                 "backends/htpbackend/aarch64/*.cpp" ,
38+     # "runtime" target is used for offline compile, can be renamed to runtime_aot_build as a BE. 
39+     for  include_aot_qnn_lib  in  (True , False ):
40+         qnn_build_suffix  =  (""  if  include_aot_qnn_lib  else  "_android_build" )
41+         runtime .cxx_library (
42+             name  =  "runtime"  +  qnn_build_suffix ,
43+             srcs  =  glob (
44+                 [
45+                     "*.cpp" ,
46+                     "backends/*.cpp" ,
47+                     "backends/htpbackend/*.cpp" ,
48+                     "backends/htpbackend/aarch64/*.cpp" ,
49+                 ],
50+                 exclude  =  ["Logging.cpp" ],
51+             ),
52+             exported_headers  =  glob (
53+                 [
54+                     "*.h" ,
55+                     "backends/*.h" ,
56+                     "backends/htpbackend/*.h" ,
57+                 ],
58+                 exclude  =  ["Logging.h" ],
59+             ),
60+             define_static_target  =  True ,
61+             link_whole  =  True ,  # needed for executorch/examples/models/llama:main to register QnnBackend 
62+             platforms  =  [ANDROID ],
63+             visibility  =  ["@EXECUTORCH_CLIENTS" ],
64+             resources  =  ({
65+                 "qnn_lib" : "fbsource//third-party/qualcomm/qnn/qnn-{0}:qnn_offline_compile_libs" .format (get_qnn_library_verision ()),
66+                 } if  include_aot_qnn_lib  else  {
67+             }),
68+             deps  =  [
69+                 "fbsource//third-party/qualcomm/qnn/qnn-{0}:api" .format (get_qnn_library_verision ()),
70+                 ":logging" ,
71+                 "//executorch/backends/qualcomm:schema" ,
72+                 "//executorch/backends/qualcomm:qc_binary_info_schema" ,
73+                 "//executorch/backends/qualcomm/aot/ir:qcir_utils" ,
74+                 "//executorch/backends/qualcomm/aot/wrappers:wrappers" ,
75+                 "//executorch/runtime/backend:interface" ,
76+                 "//executorch/runtime/core:core" ,
77+                 "//executorch/extension/tensor:tensor" ,
4678            ],
47-             exclude  =  ["Logging.cpp" ],
48-         ),
49-         exported_headers  =  glob (
50-             [
51-                 "*.h" ,
52-                 "backends/*.h" ,
53-                 "backends/htpbackend/*.h" ,
79+             exported_deps  =  [
80+                 "//executorch/runtime/core/exec_aten/util:scalar_type_util" ,
81+                 "//executorch/runtime/core:event_tracer" ,
5482            ],
55-             exclude  =  ["Logging.h" ],
56-         ),
57-         define_static_target  =  True ,
58-         link_whole  =  True ,  # needed for executorch/examples/models/llama:main to register QnnBackend 
59-         platforms  =  [ANDROID ],
60-         visibility  =  ["@EXECUTORCH_CLIENTS" ],
61-         resources  =  {
62-             "qnn_lib" : "fbsource//third-party/qualcomm/qnn/qnn-{0}:qnn_offline_compile_libs" .format (get_qnn_library_verision ()),
63-         },
64-         deps  =  [
65-             "fbsource//third-party/qualcomm/qnn/qnn-{0}:api" .format (get_qnn_library_verision ()),
66-             ":logging" ,
67-             "//executorch/backends/qualcomm:schema" ,
68-             "//executorch/backends/qualcomm:qc_binary_info_schema" ,
69-             "//executorch/backends/qualcomm/aot/ir:qcir_utils" ,
70-             "//executorch/backends/qualcomm/aot/wrappers:wrappers" ,
71-             "//executorch/runtime/backend:interface" ,
72-             "//executorch/runtime/core:core" ,
73-             "//executorch/extension/tensor:tensor" ,
74-         ],
75-         exported_deps  =  [
76-             "//executorch/runtime/core/exec_aten/util:scalar_type_util" ,
77-             "//executorch/runtime/core:event_tracer" ,
78-         ],
79-     )
83+         )
0 commit comments