ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / build / toolchain / win / midl.gni
blob30bcbf779cef688f4ee149ad0b1d18ca4901848f
1 # Copyright 2014 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.
5 assert(is_win)
7 import("//build/config/win/visual_studio_version.gni")
9 # This template defines a rule to invoke the MS IDL compiler.
11 # Parameters
13 #   sources
14 #      List of .idl file to process.
16 #   out_dir (optional)
17 #       Directory to write the generated files to. Defaults to target_gen_dir.
19 #   visibility (optional)
21 template("midl") {
22   action_name = "${target_name}_idl_action"
23   source_set_name = target_name
25   assert(defined(invoker.sources), "Source must be defined for $target_name")
27   if (defined(invoker.out_dir)) {
28     out_dir = invoker.out_dir
29   } else {
30     out_dir = target_gen_dir
31   }
33   header_file = "{{source_name_part}}.h"
34   dlldata_file = "{{source_name_part}}.dlldata.c"
35   interface_identifier_file = "{{source_name_part}}_i.c"
36   proxy_file = "{{source_name_part}}_p.c"
37   type_library_file = "{{source_name_part}}.tlb"
39   action_foreach(action_name) {
40     visibility = [ ":$source_set_name" ]
42     # This functionality is handled by the win-tool because the GYP build has
43     # MIDL support built-in.
44     # TODO(brettw) move this to a separate MIDL wrapper script for better
45     # clarity once GYP support is not needed.
46     script = "$root_build_dir/gyp-win-tool"
48     sources = invoker.sources
50     # Note that .tlb is not included in the outputs as it is not always
51     # generated depending on the content of the input idl file.
52     outputs = [
53       "$out_dir/$header_file",
54       "$out_dir/$dlldata_file",
55       "$out_dir/$interface_identifier_file",
56       "$out_dir/$proxy_file",
57     ]
59     if (current_cpu == "x86") {
60       win_tool_arch = "environment.x86"
61       idl_target_platform = "win32"
62     } else if (current_cpu == "x64") {
63       win_tool_arch = "environment.x64"
64       idl_target_platform = "x64"
65     } else {
66       assert(false, "Need environment for this arch")
67     }
69     args = [
70       "midl-wrapper",
71       win_tool_arch,
72       rebase_path(out_dir, root_build_dir),
73       type_library_file,
74       header_file,
75       dlldata_file,
76       interface_identifier_file,
77       proxy_file,
78       "{{source}}",
79       "/char",
80       "signed",
81       "/env",
82       idl_target_platform,
83       "/Oicf",
84     ]
85   }
87   source_set(target_name) {
88     if (defined(invoker.visibility)) {
89       visibility = invoker.visibility
90     }
92     # We only compile the IID files from the IDL tool rather than all outputs.
93     sources = process_file_template(invoker.sources,
94                                     [ "$out_dir/$interface_identifier_file" ])
96     deps = [
97       ":$action_name",
98     ]
99   }