blob: 4f9304e5ff51ba07735dc495d38e3b55c6f32ac4 [file] [log] [blame]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -04001import("../third_party.gni")
2
3template("spirv_core_tables") {
4 version = invoker.version
5 action("spirv_core_tables_" + target_name) {
6 script = "../externals/spirv-tools/utils/generate_grammar_tables.py"
7 sources = [
8 "../externals/spirv-headers/include/spirv/$version/spirv.core.grammar.json",
9 ]
10 outputs = [
11 "$root_out_dir/spirv-tools/core.insts-$version.inc",
12 "$root_out_dir/spirv-tools/operand.kinds-$version.inc",
13 ]
14 args = [
15 "--spirv-core-grammar=" + rebase_path(
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070016 "../externals/spirv-headers/include/spirv/$version/spirv.core.grammar.json",
17 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040018 "--core-insts-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070019 rebase_path("$root_out_dir/spirv-tools/core.insts-$version.inc",
20 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040021 "--operand-kinds-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070022 rebase_path("$root_out_dir/spirv-tools/operand.kinds-$version.inc",
23 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040024 ]
25 }
26}
27
28spirv_core_tables("1.0") {
29 version = "1.0"
30}
31spirv_core_tables("1.1") {
32 version = "1.1"
33}
34
35action("spirv_glsl_tables") {
36 script = "../externals/spirv-tools/utils/generate_grammar_tables.py"
37 sources = [
38 "../externals/spirv-headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json",
39 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
40 ]
41 outputs = [
42 "$root_out_dir/spirv-tools/glsl.std.450.insts-1.0.inc",
43 ]
44 args = [
45 "--spirv-core-grammar=" + rebase_path(
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070046 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
47 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040048 "--extinst-glsl-grammar=" +
49 rebase_path("../externals/spirv-headers/include/spirv/1.0/" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070050 "extinst.glsl.std.450.grammar.json",
51 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040052 "--glsl-insts-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070053 rebase_path("$root_out_dir/spirv-tools/glsl.std.450.insts-1.0.inc",
54 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040055 ]
56}
57
58action("spirv_opencl_tables") {
59 script = "../externals/spirv-tools/utils/generate_grammar_tables.py"
60 sources = [
61 "../externals/spirv-headers/include/spirv/1.0/extinst.opencl.std.100.grammar.json",
62 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
63 ]
64 outputs = [
65 "$root_out_dir/spirv-tools/opencl.std.insts-1.0.inc",
66 ]
67 args = [
68 "--spirv-core-grammar=" + rebase_path(
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070069 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
70 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040071 "--extinst-opencl-grammar=" +
72 rebase_path("../externals/spirv-headers/include/spirv/1.0/" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070073 "extinst.glsl.std.450.grammar.json",
74 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040075 "--opencl-insts-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070076 rebase_path("$root_out_dir/spirv-tools/opencl.std.insts-1.0.inc",
77 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040078 ]
79}
80
81action("spirv_build_version") {
82 script = "../externals/spirv-tools/utils/update_build_version.py"
83 sources = [
84 "../externals/spirv-tools/CHANGES",
85 ]
86 outputs = [
87 "$root_out_dir/spirv-tools/build.inc",
88 ]
89 args = [
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070090 rebase_path("../externals/spirv-tools", root_build_dir),
91 rebase_path("$root_out_dir/spirv-tools/build-version.inc", root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040092 ]
93}
94
95action("spirv_generators") {
96 script = "../externals/spirv-tools/utils/generate_registry_tables.py"
97 sources = [
98 "../externals/spirv-headers/include/spirv/spir-v.xml",
99 ]
100 outputs = [
101 "$root_out_dir/spirv-tools/generators.inc",
102 ]
103 args = [
104 "--xml=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -0700105 rebase_path("../externals/spirv-headers/include/spirv/spir-v.xml",
106 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400107 "--generator-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -0700108 rebase_path("$root_out_dir/spirv-tools/generators.inc",
109 root_build_dir,
110 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400111 ]
112}
113
114third_party("spirv-tools") {
115 public_include_dirs = [
116 "../externals/spirv-tools/include",
117 "../externals/spirv-tools/source",
118 "$root_out_dir/spirv-tools",
119 ]
120 deps = [
121 ":spirv_build_version",
122 ":spirv_core_tables_1.0",
123 ":spirv_core_tables_1.1",
Ethan Nicholasdc3c3362017-03-16 12:16:20 -0400124 ":spirv_generators",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400125 ":spirv_glsl_tables",
126 ":spirv_opencl_tables",
127 "//third_party/spirv-headers",
128 ]
129 sources = [
130 "../externals/spirv-tools/source/assembly_grammar.cpp",
131 "../externals/spirv-tools/source/binary.cpp",
132 "../externals/spirv-tools/source/diagnostic.cpp",
133 "../externals/spirv-tools/source/disassemble.cpp",
134 "../externals/spirv-tools/source/ext_inst.cpp",
135 "../externals/spirv-tools/source/extensions.cpp",
136 "../externals/spirv-tools/source/libspirv.cpp",
137 "../externals/spirv-tools/source/message.cpp",
138 "../externals/spirv-tools/source/name_mapper.cpp",
139 "../externals/spirv-tools/source/opcode.cpp",
140 "../externals/spirv-tools/source/operand.cpp",
141 "../externals/spirv-tools/source/opt/build_module.cpp",
142 "../externals/spirv-tools/source/opt/def_use_manager.cpp",
143 "../externals/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp",
144 "../externals/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp",
145 "../externals/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp",
146 "../externals/spirv-tools/source/opt/function.cpp",
147 "../externals/spirv-tools/source/opt/instruction.cpp",
148 "../externals/spirv-tools/source/opt/ir_loader.cpp",
149 "../externals/spirv-tools/source/opt/module.cpp",
150 "../externals/spirv-tools/source/opt/optimizer.cpp",
151 "../externals/spirv-tools/source/opt/pass_manager.cpp",
152 "../externals/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp",
153 "../externals/spirv-tools/source/opt/strip_debug_info_pass.cpp",
154 "../externals/spirv-tools/source/opt/type_manager.cpp",
155 "../externals/spirv-tools/source/opt/types.cpp",
156 "../externals/spirv-tools/source/opt/unify_const_pass.cpp",
157 "../externals/spirv-tools/source/parsed_operand.cpp",
158 "../externals/spirv-tools/source/print.cpp",
159 "../externals/spirv-tools/source/software_version.cpp",
160 "../externals/spirv-tools/source/spirv_endian.cpp",
161 "../externals/spirv-tools/source/spirv_target_env.cpp",
162 "../externals/spirv-tools/source/spirv_validator_options.cpp",
163 "../externals/spirv-tools/source/table.cpp",
164 "../externals/spirv-tools/source/text.cpp",
165 "../externals/spirv-tools/source/text_handler.cpp",
166 "../externals/spirv-tools/source/util/parse_number.cpp",
167 "../externals/spirv-tools/source/val/basic_block.cpp",
168 "../externals/spirv-tools/source/val/construct.cpp",
169 "../externals/spirv-tools/source/val/function.cpp",
170 "../externals/spirv-tools/source/val/instruction.cpp",
171 "../externals/spirv-tools/source/val/validation_state.cpp",
172 "../externals/spirv-tools/source/validate.cpp",
173 "../externals/spirv-tools/source/validate_cfg.cpp",
174 "../externals/spirv-tools/source/validate_datarules.cpp",
175 "../externals/spirv-tools/source/validate_decorations.cpp",
176 "../externals/spirv-tools/source/validate_id.cpp",
177 "../externals/spirv-tools/source/validate_instruction.cpp",
178 "../externals/spirv-tools/source/validate_layout.cpp",
179 "../externals/spirv-tools/source/validate_type_unique.cpp",
180 ]
181}