• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17cc_defaults {
18    name: "spirit_defaults",
19
20    cflags: [
21        "-Wall",
22        "-Werror",
23    ],
24    target: {
25        host: {
26            compile_multilib: "first",
27        },
28    },
29    product_variables: {
30        pdk: {
31            enabled: false,
32        },
33        unbundled_build: {
34            enabled: false,
35        },
36    },
37}
38
39python_binary_host {
40    name: "libspirit_generate_py",
41    main: "generate.py",
42    srcs: ["generate.py"],
43    version: {
44        py2: {
45            enabled: true,
46            embedded_launcher: true,
47        },
48        py3: {
49            enabled: false,
50        },
51    },
52}
53
54genrule {
55    name: "libspirit_gen",
56    tools: ["libspirit_generate_py"],
57    cmd: "$(location libspirit_generate_py) $(location :spirv.core.grammar.json-1.1) " +
58        "--instructions=$(location instructions_generated.h) " +
59        "--types=$(location types_generated.h) " +
60        "--opcodes=$(location opcodes_generated.h) " +
61        "--instruction_dispatches=$(location instruction_dispatches_generated.h) " +
62        "--enum_dispatches=$(location enum_dispatches_generated.h) " +
63        "--type_inst_dispatches=$(location type_inst_dispatches_generated.h) " +
64        "--const_inst_dispatches=$(location const_inst_dispatches_generated.h) " +
65        "--factory_methods=$(location factory_methods_generated.h)",
66    srcs: [":spirv.core.grammar.json-1.1"],
67    out: [
68        "instructions_generated.h",
69        "types_generated.h",
70        "opcodes_generated.h",
71        "instruction_dispatches_generated.h",
72        "enum_dispatches_generated.h",
73        "type_inst_dispatches_generated.h",
74        "const_inst_dispatches_generated.h",
75        "factory_methods_generated.h",
76    ],
77}
78
79//=====================================================================
80// Host and device shared library libspirit.so
81//=====================================================================
82cc_library_shared {
83    name: "libspirit",
84    defaults: ["spirit_defaults"],
85    host_supported: true,
86
87    srcs: [
88        "builder.cpp",
89        "entity.cpp",
90        "instructions.cpp",
91        "module.cpp",
92        "pass.cpp",
93        "pass_queue.cpp",
94        "transformer.cpp",
95        "visitor.cpp",
96        "word_stream.cpp",
97        "word_stream_impl.cpp",
98    ],
99
100    generated_headers: ["libspirit_gen"],
101    export_generated_headers: ["libspirit_gen"],
102
103    export_include_dirs: ["."],
104
105    target: {
106        android: {
107            cflags: ["-Wno-error=non-virtual-dtor"],
108        },
109    },
110}
111
112//=====================================================================
113// Tests for host module word_stream
114//=====================================================================
115cc_test_host {
116    name: "word_stream_test",
117    defaults: ["spirit_defaults"],
118    srcs: [
119        "word_stream.cpp",
120        "word_stream_impl.cpp",
121        "word_stream_test.cpp",
122    ],
123    generated_headers: ["libspirit_gen"],
124}
125
126//=====================================================================
127// Tests for host module instructions
128//=====================================================================
129
130cc_test_host {
131    name: "instructions_test",
132    defaults: ["spirit_defaults"],
133    srcs: [
134        "entity.cpp",
135        "instructions.cpp",
136        "instructions_test.cpp",
137        "visitor.cpp",
138        "word_stream.cpp",
139        "word_stream_impl.cpp",
140    ],
141    generated_headers: ["libspirit_gen"],
142}
143
144//=====================================================================
145// Tests for host module pass queue
146//=====================================================================
147
148cc_test_host {
149    name: "pass_queue_test",
150    defaults: ["spirit_defaults"],
151    srcs: [
152        "pass.cpp",
153        "pass_queue.cpp",
154        "pass_queue_test.cpp",
155    ],
156    shared_libs: ["libspirit"],
157}
158
159//=====================================================================
160// Tests for host shared library
161//=====================================================================
162
163cc_test_host {
164    name: "libspirit_test",
165    defaults: ["spirit_defaults"],
166    srcs: [
167        "builder_test.cpp",
168        "module_test.cpp",
169        "transformer_test.cpp",
170    ],
171    shared_libs: ["libspirit"],
172}
173