2 // Copyright (C) 2018 The Android Open Source Project
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 // genrules were obtained from the CMake build:
20 // $ cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug
21 // $ ninja -v -j 1 >log.log
22 // Find Python invocations.
23 // Use regex replacements to get "cmd:" lines below.
26 name: "swiftshader_spvtools_generate_grammar_tables",
28 "core.insts-unified1.inc",
29 "debuginfo.insts.inc",
30 "enum_string_mapping.inc",
32 "glsl.std.450.insts.inc",
33 "opencl.debuginfo.100.insts.inc",
34 "opencl.std.insts.inc",
35 "operand.kinds-unified1.inc",
36 "spv-amd-gcn-shader.insts.inc",
37 "spv-amd-shader-ballot.insts.inc",
38 "spv-amd-shader-explicit-vertex-parameter.insts.inc",
39 "spv-amd-shader-trinary-minmax.insts.inc",
42 ":swiftshader_spirv_headers_unified1_extinst.glsl.std.450.grammar.json",
43 ":swiftshader_spirv_headers_unified1_extinst.opencl.std.100.grammar.json",
44 ":swiftshader_spirv_headers_unified1_spirv.core.grammar.json",
45 "source/extinst.debuginfo.grammar.json",
46 "source/extinst.opencl.debuginfo.100.grammar.json",
47 "source/extinst.spv-amd-gcn-shader.grammar.json",
48 "source/extinst.spv-amd-shader-ballot.grammar.json",
49 "source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json",
50 "source/extinst.spv-amd-shader-trinary-minmax.grammar.json",
52 tool_files: ["utils/generate_grammar_tables.py"],
54 "$(location) --extinst-vendor-grammar=$(location source/extinst.spv-amd-gcn-shader.grammar.json) --vendor-insts-output=$(location spv-amd-gcn-shader.insts.inc) --vendor-operand-kind-prefix=; "+
55 "$(location) --spirv-core-grammar=$(location :swiftshader_spirv_headers_unified1_spirv.core.grammar.json) --extinst-debuginfo-grammar=$(location source/extinst.debuginfo.grammar.json) --extinst-cldebuginfo100-grammar=$(location source/extinst.opencl.debuginfo.100.grammar.json) --core-insts-output=$(location core.insts-unified1.inc) --operand-kinds-output=$(location operand.kinds-unified1.inc); "+
56 "$(location) --extinst-vendor-grammar=$(location source/extinst.debuginfo.grammar.json) --vendor-insts-output=$(location debuginfo.insts.inc) --vendor-operand-kind-prefix=; "+
57 "$(location) --extinst-vendor-grammar=$(location source/extinst.spv-amd-shader-ballot.grammar.json) --vendor-insts-output=$(location spv-amd-shader-ballot.insts.inc) --vendor-operand-kind-prefix=; "+
58 "$(location) --extinst-vendor-grammar=$(location source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json) --vendor-insts-output=$(location spv-amd-shader-explicit-vertex-parameter.insts.inc) --vendor-operand-kind-prefix=; "+
59 "$(location) --extinst-vendor-grammar=$(location source/extinst.spv-amd-shader-trinary-minmax.grammar.json) --vendor-insts-output=$(location spv-amd-shader-trinary-minmax.insts.inc) --vendor-operand-kind-prefix=; "+
60 "$(location) --extinst-vendor-grammar=$(location source/extinst.opencl.debuginfo.100.grammar.json) --vendor-insts-output=$(location opencl.debuginfo.100.insts.inc) --vendor-operand-kind-prefix=CLDEBUG100_; "+
61 "$(location) --spirv-core-grammar=$(location :swiftshader_spirv_headers_unified1_spirv.core.grammar.json) --extinst-debuginfo-grammar=$(location source/extinst.debuginfo.grammar.json) --extinst-cldebuginfo100-grammar=$(location source/extinst.opencl.debuginfo.100.grammar.json) --extension-enum-output=$(location extension_enum.inc) --enum-string-mapping-output=$(location enum_string_mapping.inc); "+
62 "$(location) --extinst-opencl-grammar=$(location :swiftshader_spirv_headers_unified1_extinst.opencl.std.100.grammar.json) --opencl-insts-output=$(location opencl.std.insts.inc); "+
63 "$(location) --extinst-glsl-grammar=$(location :swiftshader_spirv_headers_unified1_extinst.glsl.std.450.grammar.json) --glsl-insts-output=$(location glsl.std.450.insts.inc); "
68 name: "swiftshader_spvtools_generate_language_headers",
71 "OpenCLDebugInfo100.h",
74 "source/extinst.debuginfo.grammar.json",
75 "source/extinst.opencl.debuginfo.100.grammar.json",
77 tool_files: ["utils/generate_language_headers.py"],
79 "$(location) --extinst-grammar=$(location source/extinst.debuginfo.grammar.json) --extinst-output-path=$(location DebugInfo.h); "+
80 "$(location) --extinst-grammar=$(location source/extinst.opencl.debuginfo.100.grammar.json) --extinst-output-path=$(location OpenCLDebugInfo100.h); "
84 name: "swiftshader_spvtools_generate_registry_tables",
89 ":swiftshader_spirv_headers_spir-v.xml"
91 tool_files: ["utils/generate_registry_tables.py"],
92 cmd: "$(location) --xml=$(location :swiftshader_spirv_headers_spir-v.xml) --generator-output=$(location generators.inc)",
95 genrule { // FIXME this relies on `git` which is no good on build machines
96 name: "swiftshader_spvtools_update_build_version",
97 out: ["build-version.inc"],
99 tool_files: ["utils/update_build_version.py"],
100 cmd: "$(location) $$(dirname $(location CHANGES)) " +
101 "$(location build-version.inc)",
105 name: "swiftshader_spirv-tools",
106 vendor_available: true,
113 local_include_dirs: [
116 export_include_dirs: [
120 "external/swiftshader/third_party/SPIRV-Headers/include"
123 "swiftshader_spvtools_generate_grammar_tables",
124 "swiftshader_spvtools_generate_language_headers",
125 "swiftshader_spvtools_update_build_version",
126 "swiftshader_spvtools_generate_registry_tables",
128 stl: "libc++_static",
130 "-Wno-implicit-fallthrough"