OLD | NEW |
1 # Copyright 2016 Google Inc. | 1 # Copyright 2016 Google Inc. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 declare_args() { | 6 declare_args() { |
7 ar = "ar" | 7 ar = "ar" |
8 cc = "cc" | 8 cc = "cc" |
9 cxx = "c++" | 9 cxx = "c++" |
10 | 10 |
11 if (is_android) { | 11 if (is_android) { |
12 ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar" | 12 ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar" |
13 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang" | 13 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang" |
14 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++" | 14 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++" |
15 } | 15 } |
16 | 16 |
17 extra_cflags = "" | 17 extra_cflags = "" |
18 extra_cflags_c = "" | 18 extra_cflags_c = "" |
19 extra_cflags_cc = "" | 19 extra_cflags_cc = "" |
| 20 extra_ldflags = "" |
20 | 21 |
21 compiler_prefix = "" | 22 compiler_prefix = "" |
22 } | 23 } |
23 | 24 |
24 config("no_rtti") { | 25 config("no_rtti") { |
25 cflags_cc = [ "-fno-rtti" ] | 26 cflags_cc = [ "-fno-rtti" ] |
26 } | 27 } |
27 | 28 |
28 config("default") { | 29 config("default") { |
29 cflags = [ | 30 cflags = [ |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 165 } |
165 | 166 |
166 tool("solink") { | 167 tool("solink") { |
167 soname = "{{target_output_name}}{{output_extension}}" | 168 soname = "{{target_output_name}}{{output_extension}}" |
168 | 169 |
169 rpath = "-Wl,-soname,$soname" | 170 rpath = "-Wl,-soname,$soname" |
170 if (is_mac) { | 171 if (is_mac) { |
171 rpath = "-Wl,-install_name,@rpath/$soname" | 172 rpath = "-Wl,-install_name,@rpath/$soname" |
172 } | 173 } |
173 | 174 |
174 command = "$compiler_prefix $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {
{libs}} $rpath -o {{output}}" | 175 command = "$compiler_prefix $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {
{libs}} $rpath $extra_ldflags -o {{output}}" |
175 outputs = [ | 176 outputs = [ |
176 "{{root_out_dir}}/$soname", | 177 "{{root_out_dir}}/$soname", |
177 ] | 178 ] |
178 output_prefix = "lib" | 179 output_prefix = "lib" |
179 default_output_extension = ".so" | 180 default_output_extension = ".so" |
180 description = "$compiler_prefix $cxx -shared ... -o {{output}}" | 181 description = "$compiler_prefix $cxx -shared ... -o {{output}}" |
181 } | 182 } |
182 | 183 |
183 tool("link") { | 184 tool("link") { |
184 command = "$compiler_prefix $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}}
-o {{output}}" | 185 command = "$compiler_prefix $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}}
$extra_ldflags -o {{output}}" |
185 outputs = [ | 186 outputs = [ |
186 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", | 187 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
187 ] | 188 ] |
188 description = "$compiler_prefix $cxx ... -o {{output}}" | 189 description = "$compiler_prefix $cxx ... -o {{output}}" |
189 } | 190 } |
190 | 191 |
191 tool("stamp") { | 192 tool("stamp") { |
192 command = "touch {{output}}" | 193 command = "touch {{output}}" |
193 } | 194 } |
194 | 195 |
195 tool("copy") { | 196 tool("copy") { |
196 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" | 197 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" |
197 } | 198 } |
198 } | 199 } |
OLD | NEW |