From 5ae03c266a590cd119dd16e2eaaaef60b943df12 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 3 Nov 2022 14:25:37 +0000 Subject: [PATCH] Revert "Scaffolding for generation of intrinsics files." This reverts commit 6c5db2afa69756f8f07efd942c88ad5b173fc738. Reason for revert: Ran into issues integrating into all the required build environments. Original change's description: > Scaffolding for generation of intrinsics files. > > This CL sets up the basis for the intrinsic file generation. All of > the GN and CMake pieces are setup, but they aren't hooked into the > main build yet. That will be a followup which just enables the > generation in order to allow easy reverting. > > Change-Id: Iccac59377076ed6ac66eeaf0be965be2f49bc738 > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107981 > Kokoro: Kokoro > Commit-Queue: Dan Sinclair > Reviewed-by: Ben Clayton > Reviewed-by: Ryan Harrison # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: If289cd2769faea6466bcae68c3c58cf416b3567a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108421 Reviewed-by: Ben Clayton Reviewed-by: Dan Sinclair Kokoro: Kokoro Reviewed-by: Ryan Harrison Commit-Queue: Dan Sinclair --- generator/tint_gen_template.py | 53 ------------- src/tint/BUILD.gn | 135 +-------------------------------- 2 files changed, 1 insertion(+), 187 deletions(-) delete mode 100755 generator/tint_gen_template.py diff --git a/generator/tint_gen_template.py b/generator/tint_gen_template.py deleted file mode 100755 index d1df3265a2..0000000000 --- a/generator/tint_gen_template.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2022 The Dawn Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import argparse -import os -import subprocess -import sys - - -def run_generator(): - parser = argparse.ArgumentParser( - description= - "Tint template generator for GN build. Use tools/run gen for non-GN build.", - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - ) - parser.add_argument('--output', - default='', - type=str, - help='Base output directory.') - parser.add_argument('--template', - default='', - type=str, - help='Template to generate.') - args = parser.parse_args() - - root = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') - go = os.path.join(root, "tools", "golang", "bin", "go") - if sys.platform == 'win32': - go += '.exe' - - gen = os.path.join(root, "tools", "src", "cmd", "gen") - subprocess.check_call( - [go, "run", gen, "-o", args.output, - os.path.join(root, args.template)], - cwd=root) - - return 0 - - -if __name__ == '__main__': - sys.exit(run_generator()) diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn index 067b4d451a..97bffef50e 100644 --- a/src/tint/BUILD.gn +++ b/src/tint/BUILD.gn @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/build.gni") + import("../../tint_overrides_with_defaults.gni") if (tint_build_unittests) { @@ -848,140 +849,6 @@ libtint_source_set("libtint_glsl_writer_src") { public_deps = [ ":libtint_core_src" ] } -# Template to help invoke code generator for tint template files. -# -# Variables: -# input: The prefix for the template to generate, does not include the .tmpl extension -template("tint_intrinsic_generator") { - _sources = [ - "${invoker.input}.tmpl", - "${tint_root_dir}/src/tint/intrinsics.def", - ] - - _outputs = [ "${target_gen_dir}/${invoker.input}" ] - - _script = "${tint_root_dir}/generator/tint_gen_template.py" - _args = [ - "--output", - rebase_path(root_gen_dir), - "--template", - "src/tint/" + invoker.input + ".tmpl", - ] - - action("${target_name}") { - script = _script - outputs = _outputs - sources = _sources - args = _args - } -} - -# Template to help invoke code generator for tint template files for source files. By default this -# will generate a `h` and `cc` build rule for the provided `input` -# -# Variables: -# input: The prefix for the template, minus the file extension and .tmpl -# -# bench: set true to generate a bench template -# -# test: set true to generate a test template -template("tint_intrinsic_src_generator") { - tint_intrinsic_generator("${target_name}_h") { - input = "${invoker.input}.h" - } - tint_intrinsic_generator("${target_name}_cc") { - input = "${invoker.input}.cc" - } - - if (defined(invoker.bench) && invoker.bench) { - tint_intrinsic_generator("${target_name}_bench") { - input = "${invoker.input}_bench.cc" - } - } - if (defined(invoker.test) && invoker.test) { - tint_intrinsic_generator("${target_name}_test") { - input = "${invoker.input}_test.cc" - } - } - - source_set(target_name) { - deps = [ - ":${target_name}_cc", - ":${target_name}_h", - ] - - if (defined(invoker.bench) && invoker.bench) { - deps += [ ":${target_name}_bench" ] - } - if (defined(invoker.test) && invoker.test) { - deps += [ ":${target_name}_test" ] - } - } -} - -tint_intrinsic_generator("tint_intrinsics_inl") { - input = "resolver/intrinsic_table.inl" -} - -tint_intrinsic_src_generator("tint_init_conv_intrinsic") { - input = "resolver/init_conv_intrinsic" -} - -tint_intrinsic_src_generator("tint_sem_builtin_type") { - input = "sem/builtin_type" -} - -tint_intrinsic_src_generator("tint_sem_parameter_usage") { - input = "sem/parameter_usage" -} - -tint_intrinsic_src_generator("tint_ast_extension") { - input = "ast/extension" - bench = true - test = true -} - -tint_intrinsic_src_generator("tint_ast_access") { - input = "ast/access" -} - -tint_intrinsic_src_generator("tint_ast_builtin_value") { - input = "ast/builtin_value" - bench = true - test = true -} - -tint_intrinsic_src_generator("tint_ast_texel_format") { - input = "ast/texel_format" - bench = true - test = true -} - -tint_intrinsic_src_generator("tint_ast_address_space") { - input = "ast/address_space" - bench = true - test = true -} - -tint_intrinsic_src_generator("tint_ast_interpolate_attribute") { - input = "ast/interpolate_attribute" -} - -libtint_source_set("tint_gen_deps") { - deps = [ - ":tint_ast_access", - ":tint_ast_address_space", - ":tint_ast_builtin_value", - ":tint_ast_extension", - ":tint_ast_interpolate_attribute", - ":tint_ast_texel_format", - ":tint_init_conv_intrinsic", - ":tint_intrinsics_inl", - ":tint_sem_builtin_type", - ":tint_sem_parameter_usage", - ] -} - source_set("libtint") { public_deps = [ ":libtint_core_src" ]