blob: 8ab6c42c2538edd1683399e71b75e3aeef6ea77f [file] [log] [blame]
Austin Engcc2516a2023-10-17 20:57:54 +00001# Copyright 2020 The Dawn & Tint Authors
Ryan Harrison29628882020-04-08 20:40:25 +00002#
Austin Engcc2516a2023-10-17 20:57:54 +00003# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions are met:
Ryan Harrison29628882020-04-08 20:40:25 +00005#
Austin Engcc2516a2023-10-17 20:57:54 +00006# 1. Redistributions of source code must retain the above copyright notice, this
7# list of conditions and the following disclaimer.
Ryan Harrison29628882020-04-08 20:40:25 +00008#
Austin Engcc2516a2023-10-17 20:57:54 +00009# 2. Redistributions in binary form must reproduce the above copyright notice,
10# this list of conditions and the following disclaimer in the documentation
11# and/or other materials provided with the distribution.
12#
13# 3. Neither the name of the copyright holder nor the names of its
14# contributors may be used to endorse or promote products derived from
15# this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Ryan Harrison29628882020-04-08 20:40:25 +000027
28import("//build_overrides/tint.gni")
29
30# This file contains Tint-related build flags.
31
Ben Clayton49a564c2023-10-11 16:04:52 +000032if (!defined(tint_standalone)) {
33 if (defined(dawn_standalone)) {
34 tint_standalone = dawn_standalone
35 } else {
36 tint_standalone = false
37 }
38}
39
Ben Clayton66b75662023-10-03 21:09:50 +000040if (!defined(tint_has_build)) {
41 tint_has_build = true
42}
43
44tint_has_fuzzers = tint_has_build
dan sinclair0c27cf22024-06-11 12:31:38 +000045
46declare_args() {
47 # Is protobuf support present
48 if (!defined(tint_has_protobuf)) {
49 tint_has_protobuf = tint_standalone || build_with_chromium
50 }
51}
Ben Clayton66b75662023-10-03 21:09:50 +000052
Ryan Harrison29628882020-04-08 20:40:25 +000053declare_args() {
Ryan Harrisond34b2102020-04-27 15:31:27 +000054 # Path to tint checkout
55 if (!defined(tint_root_dir)) {
56 tint_root_dir = "//"
57 }
58
Ryan Harrisond1cf8a82020-04-15 20:35:38 +000059 # Path to spirv-tools checkout
60 if (!defined(tint_spirv_tools_dir)) {
Yuly Novikov143523a2024-05-23 15:59:58 +000061 tint_spirv_tools_dir = "//third_party/spirv-tools/src"
Ryan Harrisond1cf8a82020-04-15 20:35:38 +000062 }
63
Ben Clayton7d81e552023-08-17 12:01:50 +000064 # Path to glslang checkout
65 if (!defined(tint_glslang_dir)) {
Yuly Novikov143523a2024-05-23 15:59:58 +000066 tint_glslang_dir = "//third_party/glslang/src"
Ben Clayton7d81e552023-08-17 12:01:50 +000067 }
68
Ryan Harrison0a196c12020-04-17 13:18:20 +000069 # Path to googletest checkout
70 if (!defined(tint_googletest_dir)) {
71 tint_googletest_dir = "//third_party/googletest"
72 }
73
Ryan Harrisond1cf8a82020-04-15 20:35:38 +000074 # Path to spirv-headers checkout
75 if (!defined(tint_spirv_headers_dir)) {
Yuly Novikov143523a2024-05-23 15:59:58 +000076 tint_spirv_headers_dir = "//third_party/spirv-headers/src"
Ryan Harrisond1cf8a82020-04-15 20:35:38 +000077 }
78
Ben Clayton818dfde2024-05-27 22:48:41 +000079 # Path to libprotobuf-mutator checkout
80 if (!defined(tint_lpm_dir)) {
81 tint_lpm_dir = "//third_party/libprotobuf-mutator"
82 }
83
Ben Clayton49a564c2023-10-11 16:04:52 +000084 if (!defined(tint_build_cmds)) {
85 tint_build_cmds = tint_standalone
86 }
87
Ryan Harrisond1cf8a82020-04-15 20:35:38 +000088 # Build the SPIR-V input reader
89 if (!defined(tint_build_spv_reader)) {
Ryan Harrison40f16dd2020-07-30 18:44:04 +000090 tint_build_spv_reader = true
Ryan Harrisond1cf8a82020-04-15 20:35:38 +000091 }
92
Ryan Harrison2b45a522020-04-15 20:37:02 +000093 # Build the SPIR-V output writer
94 if (!defined(tint_build_spv_writer)) {
Ryan Harrison40f16dd2020-07-30 18:44:04 +000095 tint_build_spv_writer = true
Ryan Harrison2b45a522020-04-15 20:37:02 +000096 }
97
Ryan Harrison0caab672020-04-15 20:47:55 +000098 # Build the WGSL input reader
99 if (!defined(tint_build_wgsl_reader)) {
Ryan Harrison40f16dd2020-07-30 18:44:04 +0000100 tint_build_wgsl_reader = true
Ryan Harrison0caab672020-04-15 20:47:55 +0000101 }
102
Ryan Harrison460345d2020-04-15 20:54:10 +0000103 # Build the WGSL output writer
104 if (!defined(tint_build_wgsl_writer)) {
Ryan Harrison40f16dd2020-07-30 18:44:04 +0000105 tint_build_wgsl_writer = true
Ryan Harrison460345d2020-04-15 20:54:10 +0000106 }
dan sinclair2a599012020-06-23 17:48:40 +0000107
108 # Build the MSL output writer
109 if (!defined(tint_build_msl_writer)) {
Ryan Harrison40f16dd2020-07-30 18:44:04 +0000110 tint_build_msl_writer = true
dan sinclair2a599012020-06-23 17:48:40 +0000111 }
Ryan Harrison7a0b7342020-07-22 20:41:12 +0000112
113 # Build the HLSL output writer
114 if (!defined(tint_build_hlsl_writer)) {
Ryan Harrison40f16dd2020-07-30 18:44:04 +0000115 tint_build_hlsl_writer = true
Ryan Harrison7a0b7342020-07-22 20:41:12 +0000116 }
Stephen Whitea9f8c7d2021-10-06 18:55:10 +0000117
118 # Build the GLSL output writer
119 if (!defined(tint_build_glsl_writer)) {
120 tint_build_glsl_writer = true
121 }
dan sinclair77bf2332022-06-22 12:40:43 +0000122
Ben Claytonf1b8a012023-10-11 17:15:52 +0000123 # Build the GLSL output validator
124 if (!defined(tint_build_glsl_validator)) {
125 tint_build_glsl_validator = true
126 }
127
dan sinclair0917fbb2023-03-07 18:28:38 +0000128 # Build the Syntax Tree writer
129 if (!defined(tint_build_syntax_tree_writer)) {
130 tint_build_syntax_tree_writer = false
131 }
132
Ben Clayton5e1a2a02024-06-05 21:34:28 +0000133 # Build IR binary format support
Ben Claytonfb07fa92023-11-17 18:48:59 +0000134 if (!defined(tint_build_ir_binary)) {
135 tint_build_ir_binary = tint_has_protobuf
136 }
137
Ben Clayton5e1a2a02024-06-05 21:34:28 +0000138 # Build IR binary fuzzer
139 if (!defined(tint_build_ir_fuzzer)) {
140 tint_build_ir_fuzzer = false
141 }
142
Ben Claytonf9a5b712024-03-13 17:37:33 +0000143 # Build the tintd language server
144 if (!defined(tint_build_tintd)) {
145 tint_build_tintd = false
146 }
147
dan sinclair77bf2332022-06-22 12:40:43 +0000148 # Build unittests
149 if (!defined(tint_build_unittests)) {
150 tint_build_unittests = true
151 }
Ben Clayton9d1b6102023-09-29 12:12:48 +0000152
153 # Build benchmarks
154 if (!defined(tint_build_benchmarks)) {
155 tint_build_benchmarks = true
156 }
Ryan Harrisond1cf8a82020-04-15 20:35:38 +0000157}
Ben Clayton7d81e552023-08-17 12:01:50 +0000158
159declare_args() {
160 # Directory holding tint source
161 if (!defined(tint_src_dir)) {
162 tint_src_dir = "${tint_root_dir}/src/tint"
163 }
164}