Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2018 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 | |
| 17 | // SPIRV Tools |
| 18 | |
| 19 | filegroup { |
| 20 | name: "swiftshader_spirv.debuginfo.grammar.json", |
| 21 | srcs: ["source/extinst.debuginfo.grammar.json"], |
| 22 | } |
| 23 | |
| 24 | genrule { |
| 25 | name: "swiftshader_gen_spvtools_grammar_tables_1.0", |
| 26 | out: [ |
| 27 | "core.insts-1.0.inc", |
| 28 | "operand.kinds-1.0.inc", |
| 29 | "glsl.std.450.insts.inc", |
| 30 | "opencl.std.insts.inc", |
| 31 | ], |
| 32 | srcs: [ |
| 33 | ":swiftshader_spirv.core.grammar.json-1.0", |
| 34 | ":swiftshader_spirv.glsl.grammar.json", |
| 35 | ":swiftshader_spirv.opencl.grammar.json", |
| 36 | ":swiftshader_spirv.debuginfo.grammar.json", |
| 37 | ], |
| 38 | tool_files: ["utils/generate_grammar_tables.py"], |
| 39 | cmd: "$(location) --spirv-core-grammar=$(location :swiftshader_spirv.core.grammar.json-1.0) "+ |
| 40 | "--extinst-glsl-grammar=$(location :swiftshader_spirv.glsl.grammar.json) "+ |
| 41 | "--extinst-opencl-grammar=$(location :swiftshader_spirv.opencl.grammar.json) "+ |
| 42 | "--extinst-debuginfo-grammar=$(location :swiftshader_spirv.debuginfo.grammar.json) "+ |
| 43 | "--core-insts-output=$(location core.insts-1.0.inc) "+ |
| 44 | "--glsl-insts-output=$(location glsl.std.450.insts.inc) "+ |
| 45 | "--opencl-insts-output=$(location opencl.std.insts.inc) "+ |
| 46 | "--operand-kinds-output=$(location operand.kinds-1.0.inc)", |
| 47 | } |
| 48 | |
| 49 | genrule { |
| 50 | name: "swiftshader_gen_spvtools_grammar_tables_1.1", |
| 51 | out: [ |
| 52 | "core.insts-1.1.inc", |
| 53 | "operand.kinds-1.1.inc", |
| 54 | ], |
| 55 | srcs: [ |
| 56 | ":swiftshader_spirv.core.grammar.json-1.1", |
| 57 | ":swiftshader_spirv.debuginfo.grammar.json", |
| 58 | ], |
| 59 | tool_files: ["utils/generate_grammar_tables.py"], |
| 60 | cmd: "$(location) --spirv-core-grammar=$(location :swiftshader_spirv.core.grammar.json-1.1) "+ |
| 61 | "--extinst-debuginfo-grammar=$(location :swiftshader_spirv.debuginfo.grammar.json) "+ |
| 62 | "--core-insts-output=$(location core.insts-1.1.inc) "+ |
| 63 | "--operand-kinds-output=$(location operand.kinds-1.1.inc)", |
| 64 | } |
| 65 | |
| 66 | genrule { |
| 67 | name: "swiftshader_gen_spvtools_grammar_tables_1.2", |
| 68 | out: [ |
| 69 | "core.insts-1.2.inc", |
| 70 | "operand.kinds-1.2.inc", |
| 71 | ], |
| 72 | srcs: [ |
| 73 | ":swiftshader_spirv.core.grammar.json-1.2", |
| 74 | ":swiftshader_spirv.debuginfo.grammar.json", |
| 75 | ], |
| 76 | tool_files: ["utils/generate_grammar_tables.py"], |
| 77 | cmd: "$(location) --spirv-core-grammar=$(location :swiftshader_spirv.core.grammar.json-1.2) "+ |
| 78 | "--extinst-debuginfo-grammar=$(location :swiftshader_spirv.debuginfo.grammar.json) "+ |
| 79 | "--core-insts-output=$(location core.insts-1.2.inc) "+ |
| 80 | "--operand-kinds-output=$(location operand.kinds-1.2.inc)", |
| 81 | } |
| 82 | |
| 83 | genrule { |
| 84 | name: "swiftshader_gen_spvtools_grammar_tables_unified1", |
| 85 | out: [ |
| 86 | "core.insts-unified1.inc", |
| 87 | "operand.kinds-unified1.inc", |
| 88 | ], |
| 89 | srcs: [ |
| 90 | ":swiftshader_spirv.core.grammar.json-unified1", |
| 91 | ":swiftshader_spirv.debuginfo.grammar.json", |
| 92 | ], |
| 93 | tool_files: ["utils/generate_grammar_tables.py"], |
| 94 | cmd: "$(location) --spirv-core-grammar=$(location :swiftshader_spirv.core.grammar.json-unified1) "+ |
| 95 | "--extinst-debuginfo-grammar=$(location :swiftshader_spirv.debuginfo.grammar.json) "+ |
| 96 | "--core-insts-output=$(location core.insts-unified1.inc) "+ |
| 97 | "--operand-kinds-output=$(location operand.kinds-unified1.inc)", |
| 98 | } |
| 99 | |
| 100 | genrule { |
| 101 | name: "swiftshader_gen_spvtools_grammar_tables_debuginfo", |
| 102 | out: [ |
| 103 | "debuginfo.insts.inc", |
| 104 | ], |
| 105 | srcs: [ |
| 106 | ":swiftshader_spirv.debuginfo.grammar.json", |
| 107 | ], |
| 108 | tool_files: ["utils/generate_grammar_tables.py"], |
| 109 | cmd: "$(location) --extinst-vendor-grammar=$(in) "+ |
| 110 | "--vendor-insts-output=$(out)" |
| 111 | } |
| 112 | |
| 113 | genrule { |
| 114 | name: "swiftshader_gen_spvtools_grammar_tables_amd-gcn-shader", |
| 115 | out: [ |
| 116 | "spv-amd-gcn-shader.insts.inc", |
| 117 | ], |
| 118 | srcs: [ |
| 119 | "source/extinst.spv-amd-gcn-shader.grammar.json", |
| 120 | ], |
| 121 | tool_files: ["utils/generate_grammar_tables.py"], |
| 122 | cmd: "$(location) --extinst-vendor-grammar=$(in) "+ |
| 123 | "--vendor-insts-output=$(out)" |
| 124 | } |
| 125 | |
| 126 | genrule { |
| 127 | name: "swiftshader_gen_spvtools_grammar_tables_amd-shader-ballot", |
| 128 | out: [ |
| 129 | "spv-amd-shader-ballot.insts.inc", |
| 130 | ], |
| 131 | srcs: [ |
| 132 | "source/extinst.spv-amd-shader-ballot.grammar.json", |
| 133 | ], |
| 134 | tool_files: ["utils/generate_grammar_tables.py"], |
| 135 | cmd: "$(location) --extinst-vendor-grammar=$(in) "+ |
| 136 | "--vendor-insts-output=$(out)" |
| 137 | } |
| 138 | |
| 139 | genrule { |
| 140 | name: "swiftshader_gen_spvtools_grammar_tables_amd-shader-explicit-vertex-parameter", |
| 141 | out: [ |
| 142 | "spv-amd-shader-explicit-vertex-parameter.insts.inc", |
| 143 | ], |
| 144 | srcs: [ |
| 145 | "source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json", |
| 146 | ], |
| 147 | tool_files: ["utils/generate_grammar_tables.py"], |
| 148 | cmd: "$(location) --extinst-vendor-grammar=$(in) "+ |
| 149 | "--vendor-insts-output=$(out)" |
| 150 | } |
| 151 | |
| 152 | genrule { |
| 153 | name: "swiftshader_gen_spvtools_grammar_tables_amd-shader-trinary-minmax", |
| 154 | out: [ |
| 155 | "spv-amd-shader-trinary-minmax.insts.inc", |
| 156 | ], |
| 157 | srcs: [ |
| 158 | "source/extinst.spv-amd-shader-trinary-minmax.grammar.json", |
| 159 | ], |
| 160 | tool_files: ["utils/generate_grammar_tables.py"], |
| 161 | cmd: "$(location) --extinst-vendor-grammar=$(in) "+ |
| 162 | "--vendor-insts-output=$(out)" |
| 163 | } |
| 164 | |
| 165 | genrule { |
| 166 | name: "swiftshader_gen_spvtools_lang_headers", |
| 167 | out: [ |
| 168 | "DebugInfo.h", |
| 169 | ], |
| 170 | srcs: [ |
| 171 | ":swiftshader_spirv.debuginfo.grammar.json", |
| 172 | ], |
| 173 | tool_files: ["utils/generate_language_headers.py"], |
| 174 | cmd: "$(location) --extinst-name=DebugInfo "+ |
| 175 | "--extinst-grammar=$(location :swiftshader_spirv.debuginfo.grammar.json) "+ |
| 176 | "--extinst-output-base=$$(dirname $(location DebugInfo.h))/DebugInfo", |
| 177 | } |
| 178 | |
| 179 | genrule { |
| 180 | name: "swiftshader_gen_spvtools_enum_string_mapping", |
| 181 | out: [ |
| 182 | "extension_enum.inc", |
| 183 | "enum_string_mapping.inc", |
| 184 | ], |
| 185 | srcs: [ |
| 186 | ":swiftshader_spirv.core.grammar.json-unified1", |
| 187 | ":swiftshader_spirv.debuginfo.grammar.json", |
| 188 | ], |
| 189 | tool_files: ["utils/generate_grammar_tables.py"], |
| 190 | cmd: "$(location) --spirv-core-grammar=$(location :swiftshader_spirv.core.grammar.json-unified1) "+ |
| 191 | "--extinst-debuginfo-grammar=$(location :swiftshader_spirv.debuginfo.grammar.json) "+ |
| 192 | "--extension-enum-output=$(location extension_enum.inc) "+ |
| 193 | "--enum-string-mapping-output=$(location enum_string_mapping.inc) " |
| 194 | } |
| 195 | |
| 196 | genrule { |
| 197 | name: "swiftshader_gen_spvtools_generators_inc", |
| 198 | out: [ |
| 199 | "generators.inc" |
| 200 | ], |
| 201 | srcs: [ |
| 202 | ":swiftshader_spirv.registry.xml" |
| 203 | ], |
| 204 | tool_files: ["utils/generate_registry_tables.py"], |
| 205 | cmd: "$(location) --xml=$(location :swiftshader_spirv.registry.xml) --generator-output=$(location generators.inc)", |
| 206 | } |
| 207 | |
| 208 | genrule { // FIXME this relies on `git` which is no good on build machines |
| 209 | name: "swiftshader_gen_spvtools_build_version_inc", |
| 210 | out: ["build-version.inc"], |
| 211 | srcs: ["CHANGES"], |
| 212 | tool_files: ["utils/update_build_version.py"], |
| 213 | cmd: "$(location) $$(dirname $(location CHANGES)) " + |
| 214 | "$(location build-version.inc)", |
| 215 | } |
| 216 | |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 217 | cc_library_static { |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 218 | name: "swiftshader_spirv-tools", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 219 | vendor_available: true, |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 220 | srcs: [ |
| 221 | "source/*.cpp", |
| 222 | "source/util/*.cpp", |
| 223 | "source/val/*.cpp", |
| 224 | "source/opt/*.cpp", |
| 225 | ], |
| 226 | local_include_dirs: [ |
| 227 | "source", |
| 228 | ], |
| 229 | export_include_dirs: [ |
| 230 | "include", |
| 231 | ], |
| 232 | include_dirs: [ |
| 233 | "external/swiftshader/third_party/SPIRV-Headers/include" |
| 234 | ], |
| 235 | generated_headers: [ |
| 236 | "swiftshader_gen_spvtools_grammar_tables_1.0", |
| 237 | "swiftshader_gen_spvtools_grammar_tables_1.1", |
| 238 | "swiftshader_gen_spvtools_grammar_tables_1.2", |
| 239 | "swiftshader_gen_spvtools_grammar_tables_unified1", |
| 240 | "swiftshader_gen_spvtools_grammar_tables_debuginfo", |
| 241 | "swiftshader_gen_spvtools_grammar_tables_amd-gcn-shader", |
| 242 | "swiftshader_gen_spvtools_grammar_tables_amd-shader-ballot", |
| 243 | "swiftshader_gen_spvtools_grammar_tables_amd-shader-explicit-vertex-parameter", |
| 244 | "swiftshader_gen_spvtools_grammar_tables_amd-shader-trinary-minmax", |
| 245 | "swiftshader_gen_spvtools_enum_string_mapping", |
| 246 | "swiftshader_gen_spvtools_generators_inc", |
| 247 | "swiftshader_gen_spvtools_build_version_inc", |
| 248 | "swiftshader_gen_spvtools_lang_headers", |
| 249 | ], |
| 250 | stl: "libc++_static", |
| 251 | cppflags: [ |
| 252 | "-Wno-implicit-fallthrough" |
| 253 | ], |
| 254 | } |