Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame^] | 1 | # Copyright 2020 The Tint Authors. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | set(TINT_LIB_SRCS |
| 16 | ast/array_accessor_expression.cc |
| 17 | ast/array_accessor_expression.h |
| 18 | ast/as_expression.cc |
| 19 | ast/as_expression.h |
| 20 | ast/assignment_statement.cc |
| 21 | ast/assignment_statement.h |
| 22 | ast/binding_decoration.cc |
| 23 | ast/binding_decoration.h |
| 24 | ast/bool_literal.h |
| 25 | ast/bool_literal.cc |
| 26 | ast/break_statement.cc |
| 27 | ast/break_statement.h |
| 28 | ast/builtin.cc |
| 29 | ast/builtin.h |
| 30 | ast/builtin_decoration.cc |
| 31 | ast/builtin_decoration.h |
| 32 | ast/call_expression.cc |
| 33 | ast/call_expression.h |
| 34 | ast/case_statement.cc |
| 35 | ast/case_statement.h |
| 36 | ast/cast_expression.cc |
| 37 | ast/cast_expression.h |
| 38 | ast/const_initializer_expression.cc |
| 39 | ast/const_initializer_expression.h |
| 40 | ast/continue_statement.cc |
| 41 | ast/continue_statement.h |
| 42 | ast/decorated_variable.cc |
| 43 | ast/decorated_variable.h |
| 44 | ast/derivative_modifier.cc |
| 45 | ast/derivative_modifier.h |
| 46 | ast/else_statement.cc |
| 47 | ast/else_statement.h |
| 48 | ast/entry_point.cc |
| 49 | ast/entry_point.h |
| 50 | ast/expression.cc |
| 51 | ast/expression.h |
| 52 | ast/fallthrough_statement.cc |
| 53 | ast/fallthrough_statement.h |
| 54 | ast/float_literal.cc |
| 55 | ast/float_literal.h |
| 56 | ast/function.cc |
| 57 | ast/function.h |
| 58 | ast/identifier_expression.cc |
| 59 | ast/identifier_expression.h |
| 60 | ast/if_statement.cc |
| 61 | ast/if_statement.h |
| 62 | ast/import.cc |
| 63 | ast/import.h |
| 64 | ast/initializer_expression.cc |
| 65 | ast/initializer_expression.h |
| 66 | ast/int_literal.cc |
| 67 | ast/int_literal.h |
| 68 | ast/kill_statement.cc |
| 69 | ast/kill_statement.h |
| 70 | ast/literal.h |
| 71 | ast/literal.cc |
| 72 | ast/location_decoration.cc |
| 73 | ast/location_decoration.h |
| 74 | ast/loop_statement.cc |
| 75 | ast/loop_statement.h |
| 76 | ast/member_accessor_expression.cc |
| 77 | ast/member_accessor_expression.h |
| 78 | ast/module.cc |
| 79 | ast/module.h |
| 80 | ast/node.cc |
| 81 | ast/node.h |
| 82 | ast/nop_statement.cc |
| 83 | ast/nop_statement.h |
| 84 | ast/pipeline_stage.cc |
| 85 | ast/pipeline_stage.h |
| 86 | ast/regardless_statement.cc |
| 87 | ast/regardless_statement.h |
| 88 | ast/relational_expression.cc |
| 89 | ast/relational_expression.h |
| 90 | ast/return_statement.cc |
| 91 | ast/return_statement.h |
| 92 | ast/set_decoration.cc |
| 93 | ast/set_decoration.h |
| 94 | ast/statement.cc |
| 95 | ast/statement.h |
| 96 | ast/statement_condition.cc |
| 97 | ast/statement_condition.h |
| 98 | ast/storage_class.cc |
| 99 | ast/storage_class.h |
| 100 | ast/struct_decoration.cc |
| 101 | ast/struct_decoration.h |
| 102 | ast/struct.cc |
| 103 | ast/struct.h |
| 104 | ast/struct_member.cc |
| 105 | ast/struct_member.h |
| 106 | ast/struct_member_decoration.cc |
| 107 | ast/struct_member_decoration.h |
| 108 | ast/struct_member_offset_decoration.cc |
| 109 | ast/struct_member_offset_decoration.h |
| 110 | ast/switch_statement.cc |
| 111 | ast/switch_statement.h |
| 112 | ast/type_initializer_expression.h |
| 113 | ast/type_initializer_expression.cc |
| 114 | ast/type/alias_type.cc |
| 115 | ast/type/alias_type.h |
| 116 | ast/type/array_type.cc |
| 117 | ast/type/array_type.h |
| 118 | ast/type/bool_type.cc |
| 119 | ast/type/bool_type.h |
| 120 | ast/type/f32_type.cc |
| 121 | ast/type/f32_type.h |
| 122 | ast/type/i32_type.cc |
| 123 | ast/type/i32_type.h |
| 124 | ast/type/matrix_type.cc |
| 125 | ast/type/matrix_type.h |
| 126 | ast/type/pointer_type.cc |
| 127 | ast/type/pointer_type.h |
| 128 | ast/type/struct_type.cc |
| 129 | ast/type/struct_type.h |
| 130 | ast/type/type.cc |
| 131 | ast/type/type.h |
| 132 | ast/type/u32_type.cc |
| 133 | ast/type/u32_type.h |
| 134 | ast/type/vector_type.cc |
| 135 | ast/type/vector_type.h |
| 136 | ast/type/void_type.cc |
| 137 | ast/type/void_type.h |
| 138 | ast/uint_literal.cc |
| 139 | ast/uint_literal.h |
| 140 | ast/unary_derivative.cc |
| 141 | ast/unary_derivative.h |
| 142 | ast/unary_derivative_expression.cc |
| 143 | ast/unary_derivative_expression.h |
| 144 | ast/unary_method.cc |
| 145 | ast/unary_method.h |
| 146 | ast/unary_method_expression.cc |
| 147 | ast/unary_method_expression.h |
| 148 | ast/unary_op.cc |
| 149 | ast/unary_op.h |
| 150 | ast/unary_op_expression.cc |
| 151 | ast/unary_op_expression.h |
| 152 | ast/unless_statement.cc |
| 153 | ast/unless_statement.h |
| 154 | ast/variable.cc |
| 155 | ast/variable.h |
| 156 | ast/variable_decoration.cc |
| 157 | ast/variable_decoration.h |
| 158 | ast/variable_statement.cc |
| 159 | ast/variable_statement.h |
| 160 | reader/reader.cc |
| 161 | reader/reader.h |
| 162 | reader/wgsl/lexer.cc |
| 163 | reader/wgsl/lexer.h |
| 164 | reader/wgsl/parser.cc |
| 165 | reader/wgsl/parser.h |
| 166 | reader/wgsl/parser_impl.cc |
| 167 | reader/wgsl/parser_impl.h |
| 168 | reader/wgsl/token.cc |
| 169 | reader/wgsl/token.h |
| 170 | source.h |
| 171 | type_determiner.cc |
| 172 | type_determiner.h |
| 173 | type_manager.cc |
| 174 | type_manager.h |
| 175 | validator.cc |
| 176 | validator.h |
| 177 | # TODO(dsinclair): The writers should all be optional |
| 178 | writer/spv/generator.cc |
| 179 | writer/spv/generator.h |
| 180 | writer/wgsl/generator.cc |
| 181 | writer/wgsl/generator.h |
| 182 | writer/writer.cc |
| 183 | writer/writer.h |
| 184 | ) |
| 185 | |
| 186 | if(TINT_BUILD_SPV_PARSER) |
| 187 | list(APPEND TINT_LIB_SRCS |
| 188 | reader/spv/parser.cc |
| 189 | reader/spv/parser.h |
| 190 | ) |
| 191 | endif() |
| 192 | |
| 193 | set(TINT_TEST_SRCS |
| 194 | ast/binding_decoration_test.cc |
| 195 | ast/bool_literal_test.cc |
| 196 | ast/builtin_decoration_test.cc |
| 197 | ast/entry_point_test.cc |
| 198 | ast/import_test.cc |
| 199 | ast/int_literal_test.cc |
| 200 | ast/location_decoration_test.cc |
| 201 | ast/module_test.cc |
| 202 | ast/set_decoration_test.cc |
| 203 | ast/struct_member_test.cc |
| 204 | ast/struct_member_offset_decoration_test.cc |
| 205 | ast/struct_test.cc |
| 206 | ast/type/alias_type_test.cc |
| 207 | ast/type/array_type_test.cc |
| 208 | ast/type/bool_type_test.cc |
| 209 | ast/type/f32_type_test.cc |
| 210 | ast/type/i32_type_test.cc |
| 211 | ast/type/matrix_type_test.cc |
| 212 | ast/type/pointer_type_test.cc |
| 213 | ast/type/struct_type_test.cc |
| 214 | ast/type/u32_type_test.cc |
| 215 | ast/type/vector_type_test.cc |
| 216 | ast/uint_literal_test.cc |
| 217 | ast/variable_test.cc |
| 218 | reader/wgsl/lexer_test.cc |
| 219 | reader/wgsl/parser_test.cc |
| 220 | reader/wgsl/parser_impl_additive_expression_test.cc |
| 221 | reader/wgsl/parser_impl_and_expression_test.cc |
| 222 | reader/wgsl/parser_impl_argument_expression_list_test.cc |
| 223 | reader/wgsl/parser_impl_assignment_stmt_test.cc |
| 224 | reader/wgsl/parser_impl_body_stmt_test.cc |
| 225 | reader/wgsl/parser_impl_break_stmt_test.cc |
| 226 | reader/wgsl/parser_impl_builtin_decoration_test.cc |
| 227 | reader/wgsl/parser_impl_case_body_test.cc |
| 228 | reader/wgsl/parser_impl_const_expr_test.cc |
| 229 | reader/wgsl/parser_impl_const_literal_test.cc |
| 230 | reader/wgsl/parser_impl_continue_stmt_test.cc |
| 231 | reader/wgsl/parser_impl_continuing_stmt_test.cc |
| 232 | reader/wgsl/parser_impl_derivative_modifier_test.cc |
| 233 | reader/wgsl/parser_impl_else_stmt_test.cc |
| 234 | reader/wgsl/parser_impl_elseif_stmt_test.cc |
| 235 | reader/wgsl/parser_impl_entry_point_decl_test.cc |
| 236 | reader/wgsl/parser_impl_equality_expression_test.cc |
| 237 | reader/wgsl/parser_impl_exclusive_or_expression_test.cc |
| 238 | reader/wgsl/parser_impl_function_decl_test.cc |
| 239 | reader/wgsl/parser_impl_function_header_test.cc |
| 240 | reader/wgsl/parser_impl_function_type_decl_test.cc |
| 241 | reader/wgsl/parser_impl_global_constant_decl_test.cc |
| 242 | reader/wgsl/parser_impl_global_decl_test.cc |
| 243 | reader/wgsl/parser_impl_global_variable_decl_test.cc |
| 244 | reader/wgsl/parser_impl_if_stmt_test.cc |
| 245 | reader/wgsl/parser_impl_import_decl_test.cc |
| 246 | reader/wgsl/parser_impl_inclusive_or_expression_test.cc |
| 247 | reader/wgsl/parser_impl_logical_and_expression_test.cc |
| 248 | reader/wgsl/parser_impl_logical_or_expression_test.cc |
| 249 | reader/wgsl/parser_impl_loop_stmt_test.cc |
| 250 | reader/wgsl/parser_impl_multiplicative_expression_test.cc |
| 251 | reader/wgsl/parser_impl_param_list_test.cc |
| 252 | reader/wgsl/parser_impl_paren_rhs_stmt_test.cc |
| 253 | reader/wgsl/parser_impl_pipeline_stage_test.cc |
| 254 | reader/wgsl/parser_impl_postfix_expression_test.cc |
| 255 | reader/wgsl/parser_impl_premerge_stmt_test.cc |
| 256 | reader/wgsl/parser_impl_primary_expression_test.cc |
| 257 | reader/wgsl/parser_impl_regardless_stmt_test.cc |
| 258 | reader/wgsl/parser_impl_relational_expression_test.cc |
| 259 | reader/wgsl/parser_impl_shift_expression_test.cc |
| 260 | reader/wgsl/parser_impl_statement_test.cc |
| 261 | reader/wgsl/parser_impl_statements_test.cc |
| 262 | reader/wgsl/parser_impl_storage_class_test.cc |
| 263 | reader/wgsl/parser_impl_struct_body_decl_test.cc |
| 264 | reader/wgsl/parser_impl_struct_decl_test.cc |
| 265 | reader/wgsl/parser_impl_struct_decoration_decl_test.cc |
| 266 | reader/wgsl/parser_impl_struct_decoration_test.cc |
| 267 | reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc |
| 268 | reader/wgsl/parser_impl_struct_member_decoration_test.cc |
| 269 | reader/wgsl/parser_impl_struct_member_test.cc |
| 270 | reader/wgsl/parser_impl_switch_body_test.cc |
| 271 | reader/wgsl/parser_impl_switch_stmt_test.cc |
| 272 | reader/wgsl/parser_impl_test.cc |
| 273 | reader/wgsl/parser_impl_type_alias_test.cc |
| 274 | reader/wgsl/parser_impl_type_decl_test.cc |
| 275 | reader/wgsl/parser_impl_unary_expression_test.cc |
| 276 | reader/wgsl/parser_impl_unless_stmt_test.cc |
| 277 | reader/wgsl/parser_impl_variable_decl_test.cc |
| 278 | reader/wgsl/parser_impl_variable_decoration_list_test.cc |
| 279 | reader/wgsl/parser_impl_variable_decoration_test.cc |
| 280 | reader/wgsl/parser_impl_variable_ident_decl_test.cc |
| 281 | reader/wgsl/parser_impl_variable_stmt_test.cc |
| 282 | reader/wgsl/parser_impl_variable_storage_decoration_test.cc |
| 283 | reader/wgsl/token_test.cc |
| 284 | type_manager_test.cc |
| 285 | ) |
| 286 | |
| 287 | ## Tint library |
| 288 | add_library(libtint ${TINT_LIB_SRCS}) |
| 289 | tint_default_compile_options(libtint) |
| 290 | set_target_properties(libtint PROPERTIES OUTPUT_NAME "tint") |
| 291 | |
| 292 | if(${TINT_ENABLE_SPV_PARSER}) |
| 293 | target_link_libraries(libtint SPIRV-Tools) |
| 294 | endif() |
| 295 | |
| 296 | add_executable(tint_unittests ${TINT_TEST_SRCS}) |
| 297 | if (NOT MSVC) |
| 298 | target_compile_options(tint_unittests PRIVATE |
| 299 | -Wno-global-constructors |
| 300 | -Wno-weak-vtables |
| 301 | ) |
| 302 | endif() |
| 303 | |
| 304 | ## Test executable |
| 305 | target_include_directories( |
| 306 | tint_unittests PRIVATE ${gmock_SOURCE_DIR}/include) |
| 307 | target_link_libraries(tint_unittests libtint gmock_main) |
| 308 | tint_default_compile_options(tint_unittests) |
| 309 | |
| 310 | add_test(NAME tint_unittests COMMAND tint_unittests) |