Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: build/config/win/manifest.gni

Issue 1240893004: Preliminary support for Windows manifests in the GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/win/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 # Reference this manifest as a source from windows_manifest targets to get
6 # the default Chrome OS compatibility list.
7 default_compatibility_manifest = "//build/win/compatibility.manifest"
8
9 # Reference this manifest as a source from windows_manifest targets to get
10 # the default Chrome common constrols compatibility.
11 common_controls_manifest = "//build/win/common_controls.manifest"
12
13 # Reference this manifest to request that Windows not perform any elevation
14 # when running your program. Otherwise, it might do some autodetection and
15 # request elevated privileges from the user. This is normally what you want.
16 as_invoker_manifest = "//build/win/as_invoker.manifest"
17
18 # HOW MANIFESTS WORK IN THE GN BUILD
Dirk Pranke 2015/07/17 20:02:47 can you move this comment above the variables?
19 #
20 # Use the windows_manifest declaration to declare a manifest generation step.
Dirk Pranke 2015/07/17 20:02:47 s/declaration/template?
21 # This will combine all listed .manifest files and generate a resource file
22 # referencing the resulting manifest. To link this manifest, just depend on
23 # the manifest target from your executable or shared library.
24 #
25 # This will define an empty placeholder target on non-Windows platforms so
26 # the manifest declarations and dependencies do not need to be inside of OS
27 # conditionals.
28 #
29 # Manifests uses different resource IDs for EXE and DLL targets. You will need
30 # to specify this in the manifest target declaration and only use that manifest
31 # target from the correct type of binary target.
32 #
33 # A binary can depend on only one manifest target, but the manifest target
34 # can depend on many individual .manifest files which will be merged. As a
35 # result, only executables and shared libraries should depend on manifest
36 # targets. If you want to add a manifest to a component, put the dependency
37 # behind a "if (is_component_build)" conditional.
38 #
39 # Generally you will just want the defaults for the Chrome build. In this case
40 # the binary should just depend on one of the targets in //build/win/. There
41 # are also individual manifest files in that directory you can reference via
42 # the variables defined at the top of the file to pick and choose only
43 # some defaults. You might combine these with a custom manifest file to
44 # get specific behavior.
45 #
46 # Variables for the windows_manifest template:
47 #
48 # sources: (required)
49 # List of source .manifest files to add.
50 #
51 # type: "dll" or "exe" (required)
52 # Indicates the type of target that this manifest will be used for.
53 # DLLs and EXEs have different manifest resource IDs.
54 #
55 # deps: (optional)
56 # visibility: (optional)
57 # Normal meaning.
58 #
59 # Example:
60 #
61 # windows_manifest("doom_melon_manifest") {
62 # sources = [
63 # "doom_melon.manifest", # Custom values in here.
64 # default_compatibility_manifest, # Want the normal OS compat list.
65 # ]
66 # type = "exe"
67 # }
68 #
69 # executable("doom_melon") {
70 # deps = [ ":doom_melon_manifest" ]
71 # ...
72 # }
73
74 if (is_win) {
75 # This is the environment file that gyp-win-tool will use for the current
76 # toolchain. It is placed in root_build_dir by the toolchain setup. This
77 # variable is the path relative to the root_build_dir which is what
78 # gyp-win-tool expects as an argument.
79 _environment_file = "environment.$current_cpu"
80
81 template("windows_manifest") {
82 manifest_action_name = "${target_name}__gen_manifest"
83 rc_action_name = "${target_name}__gen_rc"
84 source_set_name = target_name
85
86 output_manifest = "$target_gen_dir/$source_set_name.manifest"
87 rcfile = "$output_manifest.rc"
88
89 # Make the final .manifest file.
90 action(manifest_action_name) {
91 visibility = [ ":$source_set_name" ]
92
93 script = "$root_build_dir/gyp-win-tool"
94
95 assert(defined(invoker.sources),
96 "\"sources\" must be defined for a windows_manifest target")
97 inputs = invoker.sources
98
99 outputs = [
100 output_manifest,
101 ]
102
103 args = [
104 "manifest-wrapper",
105 _environment_file,
106 "mt.exe",
107 "-nologo",
108 "-manifest",
109 ]
110 args += rebase_path(invoker.sources, root_build_dir)
111 args += [ "-out:" + rebase_path(output_manifest, root_build_dir) ]
112
113 # Apply any dependencies from the invoker to this target, since those
114 # dependencies may have created the input manifest files.
115 if (defined(invoker.deps)) {
116 deps = invoker.deps
117 }
118 }
119
120 # Make the .rc file that references the final manifest file. The manifest
121 # generation doesn't need to be a dependency because it's not actually
122 # needed until the .rc is compiled.
123 #
124 # This could easily be combined into one step, but this current separation
125 # of .manifest and .rc matches GYP and allows us to re-use gyp-win-tool.
126 action(rc_action_name) {
127 visibility = [ ":$source_set_name" ]
128
129 script = "$root_build_dir/gyp-win-tool"
130
131 outputs = [
132 rcfile,
133 ]
134
135 # EXEs have a resource ID of 1 for their manifest, DLLs use 2.
136 assert(defined(invoker.type),
137 "\"type\" must be defined for a windows_manifest")
138 if (invoker.type == "exe") {
139 manifest_resource_id = "1"
140 } else if (invoker.type == "dll") {
141 manifest_resource_id = "2"
142 } else {
143 assert(false, "Bad value of \"type\", Must be \"exe\" or \"dll\"")
144 }
145
146 args = [
147 "manifest-to-rc",
148 "$_environment_file",
149 rebase_path(output_manifest),
150 rebase_path(rcfile, root_build_dir),
151 manifest_resource_id,
152 ]
153 }
154
155 # This source set only exists to compile and link the resource file.
156 source_set(source_set_name) {
157 if (defined(invoker.visibility)) {
158 visibility = invoker.visibility
159 }
160 sources = [
161 rcfile,
162 ]
163 deps = [
164 ":$manifest_action_name",
165 ":$rc_action_name",
166 ]
167 }
168 }
169 } else {
170 # Make a no-op group on non-Windows platforms so windows_manifest
171 # instantiations don't need to be inside windows blocks.
172 template("windows_manifest") {
173 group(target_name) {
174 # Prevent unused variable warnings on non-Windows platforms.
175 assert(defined(invoker.type))
176 assert(defined(invoker.sources))
177 assert(defined(invoker.deps) || true)
178 assert(defined(invoker.visibility) || true)
179 }
180 }
181 }
OLDNEW
« no previous file with comments | « no previous file | build/win/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698