[AMDGPU] prevent shrinking udiv/urem if either operand is in (SignedMax,UnsignedMax...
[llvm-project.git] / llvm / utils / gn / build / write_cmake_config.gni
blobbbaab212350ce9a0e4a654bcd5350961726e0aa9
1 # This file introduces a templates for calling write_cmake_config.py.
3 # write_cmake_config behaves like CMake's configure_file(), but runs at build
4 # time, not at generator time.  See write_cmake_config.py for details.
6 # Parameters:
8 #   input (required) [string]
10 #   output (required) [string]
12 #   values (required) [list of strings]
13 #       Each entry is a '='-separated key-value pair used for substitution.
15 # Example use:
17 #   write_cmake_config("attributes_compat_func_gen") {
18 #     input = "Version.inc.in"
19 #     output = "$root_gen_dir/clang/include/clang/Basic/Version.inc",
20 #     values = [
21 #       "CLANG_VERSION=$llvm_version",
22 #     ]
23 #   }
25 template("write_cmake_config") {
26   assert(defined(invoker.input), "must set 'input' in $target_name")
27   assert(defined(invoker.output), "must set 'output' in $target_name")
28   assert(defined(invoker.values), "must set 'values' in $target_name")
30   action(target_name) {
31     script = "//llvm/utils/gn/build/write_cmake_config.py"
33     sources = [ invoker.input ]
34     outputs = [ invoker.output ]
35     args = [
36              "-o",
37              rebase_path(outputs[0], root_build_dir),
38              rebase_path(sources[0], root_build_dir),
39            ] + invoker.values
41     forward_variables_from(invoker,
42                            [
43                              "configs",
44                              "deps",
45                              "public_configs",
46                              "public_deps",
47                              "visibility",
48                            ])
49   }