| # Copyright 2023 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. |
| |
| # system_binary_action() is like action, except that it runs a system binary. |
| # The binary can be in PATH or in the build directory environment file (so that |
| # executables in the toolchain dirs are picked up). |
| template("system_binary_action") { |
| assert(defined(invoker.args), "must set 'args' in $target_name") |
| assert(defined(invoker.outputs), "must set 'outputs' in $target_name") |
| assert(!defined(invoker.sources), |
| "use 'inputs' instead of 'sources' in $target_name") |
| |
| action(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "inputs", |
| "outputs", |
| ]) |
| script = "build/run_system_binary.py" |
| args = [ |
| # Pass in the env file saved to the build directory that contains |
| # the VC paths in it. |
| "environment.$current_cpu", |
| ] + invoker.args |
| } |
| } |