OLD | NEW |
(Empty) | |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 assert(is_win, "This only runs on Windows.") |
| 6 |
| 7 # Runs mc.exe over a list of sources. The outputs (a header and rc file) are |
| 8 # placed in the target gen dir, and compiled. |
| 9 # |
| 10 # sources |
| 11 # List of message files to process. |
| 12 # |
| 13 # user_mode_logging (optional bool) |
| 14 # Generates user-mode logging code. Defaults to false (no logging code). |
| 15 # |
| 16 # deps, public_deps, visibility |
| 17 # Normal meaning. |
| 18 template("message_compiler") { |
| 19 action_name = "${target_name}_mc" |
| 20 source_set_name = target_name |
| 21 |
| 22 action_foreach(action_name) { |
| 23 visibility = [ ":$source_set_name" ] |
| 24 |
| 25 script = "//build/win/message_compiler.py" |
| 26 |
| 27 outputs = [ |
| 28 "$target_gen_dir/{{source_name_part}}.h", |
| 29 "$target_gen_dir/{{source_name_part}}.rc", |
| 30 ] |
| 31 |
| 32 args = [ |
| 33 # The first argument is the environment file saved to the build |
| 34 # directory. This is required because the Windows toolchain setup saves |
| 35 # the VC paths and such so that running "mc.exe" will work with the |
| 36 # configured toolchain. This file is in the root build dir. |
| 37 "environment.$current_cpu", |
| 38 |
| 39 # Where to put the header. |
| 40 "-h", |
| 41 rebase_path(target_gen_dir, root_build_dir), |
| 42 |
| 43 # Where to put the .rc file. |
| 44 "-r", |
| 45 rebase_path(target_gen_dir, root_build_dir), |
| 46 |
| 47 # Input is Unicode. |
| 48 "-u", |
| 49 ] |
| 50 if (defined(invoker.user_mode_logging) && invoker.user_mode_logging) { |
| 51 args += [ "-um" ] |
| 52 } |
| 53 args += [ "{{source}}" ] |
| 54 |
| 55 forward_variables_from(invoker, |
| 56 [ |
| 57 "deps", |
| 58 "public_deps", |
| 59 "sources", |
| 60 ]) |
| 61 } |
| 62 |
| 63 # Compile the generated rc file. |
| 64 source_set(source_set_name) { |
| 65 forward_variables_from(invoker, [ "visibility" ]) |
| 66 sources = get_target_outputs(":$action_name") |
| 67 deps = [ |
| 68 ":$action_name", |
| 69 ] |
| 70 } |
| 71 } |
OLD | NEW |