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

Side by Side Diff: tools/gn/example/build/toolchain/BUILD.gn

Issue 1887533003: Add an output_dir override to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const Created 4 years, 8 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 | « tools/gn/docs/reference.md ('k') | tools/gn/function_toolchain.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 toolchain("gcc") { 5 toolchain("gcc") {
6 tool("cc") { 6 tool("cc") {
7 depfile = "{{output}}.d" 7 depfile = "{{output}}.d"
8 command = "gcc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{c flags_c}} -c {{source}} -o {{output}}" 8 command = "gcc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{c flags_c}} -c {{source}} -o {{output}}"
9 depsformat = "gcc" 9 depsformat = "gcc"
10 description = "CC {{output}}" 10 description = "CC {{output}}"
(...skipping 19 matching lines...) Expand all
30 rspfile_content = "{{inputs}}" 30 rspfile_content = "{{inputs}}"
31 outputs = [ 31 outputs = [
32 "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", 32 "{{target_out_dir}}/{{target_output_name}}{{output_extension}}",
33 ] 33 ]
34 default_output_extension = ".a" 34 default_output_extension = ".a"
35 output_prefix = "lib" 35 output_prefix = "lib"
36 } 36 }
37 37
38 tool("solink") { 38 tool("solink") {
39 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". 39 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
40 sofile = "{{output_dir}}/$soname"
40 rspfile = soname + ".rsp" 41 rspfile = soname + ".rsp"
41 42
42 command = "g++ -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" 43 command = "g++ -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile"
43 rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole- archive {{libs}}" 44 rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole- archive {{libs}}"
44 45
45 description = "SOLINK $soname" 46 description = "SOLINK $soname"
46 47
47 # Use this for {{output_extension}} expansions unless a target manually 48 # Use this for {{output_extension}} expansions unless a target manually
48 # overrides it (in which case {{output_extension}} will be what the target 49 # overrides it (in which case {{output_extension}} will be what the target
49 # specifies). 50 # specifies).
50 default_output_extension = ".so" 51 default_output_extension = ".so"
51 52
53 # Use this for {{output_dir}} expansions unless a target manually overrides
54 # it (in which case {{output_dir}} will be what the target specifies).
55 default_output_dir = "{{root_out_dir}}"
56
52 outputs = [ 57 outputs = [
53 soname, 58 sofile,
54 ] 59 ]
55 link_output = soname 60 link_output = sofile
56 depend_output = soname 61 depend_output = sofile
57 output_prefix = "lib" 62 output_prefix = "lib"
58 } 63 }
59 64
60 tool("link") { 65 tool("link") {
61 outfile = "{{target_output_name}}{{output_extension}}" 66 outfile = "{{target_output_name}}{{output_extension}}"
62 rspfile = "$outfile.rsp" 67 rspfile = "$outfile.rsp"
63 command = "g++ {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs} } -Wl,--end-group {{libs}}" 68 command = "g++ {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs} } -Wl,--end-group {{libs}}"
64 description = "LINK $outfile" 69 description = "LINK $outfile"
70 default_output_dir = "{{root_out_dir}}"
65 rspfile_content = "{{inputs}}" 71 rspfile_content = "{{inputs}}"
66 outputs = [ 72 outputs = [
67 outfile, 73 outfile,
68 ] 74 ]
69 } 75 }
70 76
71 tool("stamp") { 77 tool("stamp") {
72 command = "touch {{output}}" 78 command = "touch {{output}}"
73 description = "STAMP {{output}}" 79 description = "STAMP {{output}}"
74 } 80 }
75 81
76 tool("copy") { 82 tool("copy") {
77 command = "cp -af {{source}} {{output}}" 83 command = "cp -af {{source}} {{output}}"
78 description = "COPY {{source}} {{output}}" 84 description = "COPY {{source}} {{output}}"
79 } 85 }
80 } 86 }
OLDNEW
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/function_toolchain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698