Skip to content

Commit 76d83cc

Browse files
committed
[Executorch][llama] Split main in lib + binary
Main reason to do so is to allow internal benchmarking binary to link against main_lib Differential Revision: [D87547090](https://our.internmc.facebook.com/intern/diff/D87547090/) ghstack-source-id: 324690959 Pull Request resolved: #15919
1 parent aff5086 commit 76d83cc

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

examples/models/llama/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ DEFINE_int32(
6464

6565
DEFINE_bool(warmup, false, "Whether to run a warmup run.");
6666

67+
std::vector<std::string> parseStringList(const std::string& input);
68+
6769
// Helper function to parse comma-separated string lists
6870
std::vector<std::string> parseStringList(const std::string& input) {
6971
std::vector<std::string> result;

examples/models/llama/targets.bzl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ def define_common_targets():
55
if not runtime.is_oss or not aten:
66
aten_suffix = "_aten" if aten else ""
77

8-
runtime.cxx_binary(
9-
name = "main" + aten_suffix,
8+
runtime.cxx_library(
9+
name = "main" + aten_suffix + "_lib",
1010
srcs = [
1111
"main.cpp",
1212
],
@@ -25,3 +25,11 @@ def define_common_targets():
2525
],
2626
**get_oss_build_kwargs()
2727
)
28+
29+
runtime.cxx_binary(
30+
name = "main" + aten_suffix,
31+
srcs = [],
32+
deps = [
33+
":main" + aten_suffix + "_lib",
34+
],
35+
)

0 commit comments

Comments
 (0)