Skip to content

Commit 0d6a620

Browse files
authored
Add TARGETS file for internal build (#35)
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent 8b04217 commit 0d6a620

File tree

2 files changed

+66
-57
lines changed

2 files changed

+66
-57
lines changed

third-party/TARGETS

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,8 @@
1-
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2-
load("@fbsource//xplat/executorch/third-party:glob_defs.bzl", "subdir_glob")
1+
# Any targets that should be shared between fbcode and xplat must be defined in
2+
# targets.bzl. This file can contain fbcode-only targets.
33

4-
oncall("executorch")
5-
6-
runtime.cxx_library(
7-
name = "abseil",
8-
public_include_directories = ["abseil-cpp"],
9-
srcs = glob(
10-
["abseil-cpp/absl/**/*.cc"],
11-
exclude = [
12-
"abseil-cpp/absl/**/*test*.cc",
13-
"abseil-cpp/absl/**/*mock*.cc",
14-
"abseil-cpp/absl/**/*matchers*.cc",
15-
"abseil-cpp/absl/**/*benchmark*.cc",
16-
],
17-
),
18-
exported_linker_flags = select(
19-
{
20-
"DEFAULT": [],
21-
"ovr_config//os:macos": ["-Wl,-framework,CoreFoundation"],
22-
},
23-
),
24-
visibility = ["PUBLIC"],
25-
_is_external_target = True,
26-
)
4+
load(":targets.bzl", "define_common_targets")
275

28-
runtime.cxx_library(
29-
name = "re2",
30-
public_include_directories = ["re2"],
31-
srcs = glob(
32-
[
33-
"re2/re2/**/*.cc",
34-
"re2/util/**/*.cc",
35-
],
36-
exclude = [
37-
"re2/re2/**/*test*.cc",
38-
"re2/re2/testing/*.cc",
39-
"re2/re2/fuzzing/*.cc",
40-
"re2/re2/**/*benchmark*.cc",
41-
],
42-
),
43-
exported_deps = [
44-
":abseil",
45-
],
46-
visibility = ["PUBLIC"],
47-
_is_external_target = True,
48-
)
6+
oncall("executorch")
497

50-
runtime.cxx_library(
51-
name = "unicode",
52-
srcs = [
53-
"llama.cpp-unicode/src/unicode.cpp",
54-
"llama.cpp-unicode/src/unicode-data.cpp",
55-
],
56-
exported_headers = subdir_glob([
57-
("include", "*.h"),
58-
]),
59-
header_namespace = "",
60-
)
8+
define_common_targets()

third-party/targets.bzl

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2+
load("@fbsource//xplat/executorch/third-party:glob_defs.bzl", "subdir_glob")
3+
4+
def define_common_targets():
5+
runtime.cxx_library(
6+
name = "unicode",
7+
srcs = [
8+
"llama.cpp-unicode/src/unicode.cpp",
9+
"llama.cpp-unicode/src/unicode-data.cpp",
10+
],
11+
header_namespace = "",
12+
exported_headers = subdir_glob([
13+
("llama.cpp-unicode/include", "*.h"),
14+
]),
15+
visibility = ["@EXECUTORCH_CLIENTS", "//pytorch/tokenizers/..."],
16+
)
17+
18+
if runtime.is_oss:
19+
runtime.cxx_library(
20+
name = "abseil",
21+
srcs = glob(
22+
["abseil-cpp/absl/**/*.cc"],
23+
exclude = [
24+
"abseil-cpp/absl/**/*test*.cc",
25+
"abseil-cpp/absl/**/*mock*.cc",
26+
"abseil-cpp/absl/**/*matchers*.cc",
27+
"abseil-cpp/absl/**/*benchmark*.cc",
28+
],
29+
),
30+
_is_external_target = True,
31+
exported_linker_flags = select(
32+
{
33+
"DEFAULT": [],
34+
"ovr_config//os:macos": ["-Wl,-framework,CoreFoundation"],
35+
},
36+
),
37+
public_include_directories = ["abseil-cpp"],
38+
visibility = ["PUBLIC"],
39+
)
40+
41+
runtime.cxx_library(
42+
name = "re2",
43+
srcs = glob(
44+
[
45+
"re2/re2/**/*.cc",
46+
"re2/util/**/*.cc",
47+
],
48+
exclude = [
49+
"re2/re2/**/*test*.cc",
50+
"re2/re2/testing/*.cc",
51+
"re2/re2/fuzzing/*.cc",
52+
"re2/re2/**/*benchmark*.cc",
53+
],
54+
),
55+
_is_external_target = True,
56+
public_include_directories = ["re2"],
57+
visibility = ["PUBLIC"],
58+
exported_deps = [
59+
":abseil",
60+
],
61+
)

0 commit comments

Comments
 (0)