blob: ec5f1f1086ee7f44abb1635178c035c8243fbbe6 [file] [log] [blame]
# 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.
# cmake_configure_file implements CMake's 'configure_file':
# https://cmake.org/cmake/help/latest/command/configure_file.html
#
# Unlike CMake, that replaces variables defined in the input file with those
# currently set in the CMake exceution environment, we must provide the
# values for each variable explicitly via the 'values' array.
template("cmake_configure_file") {
assert(defined(invoker.input), "must set 'input'")
assert(defined(invoker.output), "must set 'output'")
assert(defined(invoker.values), "must set 'values'")
action(target_name) {
script = "${invoker.dawn_dxc_gn_dir}/dxc/build/cmake_configure_file.py"
sources = [ invoker.input ]
outputs = [ invoker.output ]
args = [
rebase_path(invoker.input, root_build_dir),
rebase_path(invoker.output, root_build_dir),
] + invoker.values
}
}