-
Notifications
You must be signed in to change notification settings - Fork 1
/
BUILD
97 lines (85 loc) · 2.83 KB
/
BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("//iree:build_defs.oss.bzl", "FLATBUFFER_SUPPORTS_REFLECTIONS", "iree_build_test", "iree_flatbuffer_cc_library")
load("//build_tools/embed_data:build_defs.bzl", "cc_embed_data")
package(
default_visibility = ["//visibility:public"],
licenses = ["notice"], # Apache 2.0
)
FLATC_ARGS = [
# Preserve workspace-relative include paths in generated code.
"--keep-prefix",
# Use C++11 'enum class' for enums.
"--scoped-enums",
# Include reflection tables used for dumping debug representations.
"--reflect-names",
# Generate FooT types for unpack/pack support. Note that this should only
# be used in tooling as the code size/runtime overhead is non-trivial.
"--gen-object-api",
]
iree_flatbuffer_cc_library(
name = "buffer_data_def_cc_fbs",
srcs = ["buffer_data_def.fbs"],
flatc_args = FLATC_ARGS,
)
# TODO(benvanik): also expose as C using flatcc.
iree_flatbuffer_cc_library(
name = "bytecode_module_def_cc_fbs",
srcs = ["bytecode_module_def.fbs"],
flatc_args = FLATC_ARGS,
)
iree_flatbuffer_cc_library(
name = "interpreter_module_def_cc_fbs",
srcs = ["interpreter_module_def.fbs"],
flatc_args = FLATC_ARGS,
)
iree_flatbuffer_cc_library(
name = "spirv_executable_def_cc_fbs",
srcs = ["spirv_executable_def.fbs"],
flatc_args = FLATC_ARGS,
)
iree_flatbuffer_cc_library(
name = "vmla_executable_def_cc_fbs",
srcs = ["vmla_executable_def.fbs"],
flatc_args = FLATC_ARGS,
)
iree_flatbuffer_cc_library(
name = "llvmir_executable_def_cc_fbs",
srcs = ["llvmir_executable_def.fbs"],
flatc_args = FLATC_ARGS,
)
iree_build_test(
name = "schema_build_test",
targets = [
":buffer_data_def_cc_fbs",
":bytecode_module_def_cc_fbs",
":interpreter_module_def_cc_fbs",
":spirv_executable_def_cc_fbs",
":vmla_executable_def_cc_fbs",
],
)
REFLECTION_SRCS = [] if not FLATBUFFER_SUPPORTS_REFLECTIONS else [
"buffer_data_def.bfbs",
"bytecode_module_def.bfbs",
"interpreter_module_def.bfbs",
"spirv_executable_def.bfbs",
"vmla_executable_def.bfbs",
]
cc_embed_data(
name = "reflection_data",
srcs = REFLECTION_SRCS,
cc_file_output = "reflection_data.cc",
cpp_namespace = "iree::schemas",
h_file_output = "reflection_data.h",
)