OLD | NEW |
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 import("mojo.gni") | 5 import("mojo.gni") |
6 import("mojo_sdk.gni") | 6 import("mojo_sdk.gni") |
7 | 7 |
8 # Generate a binary mojo application.The parameters of this template are those | 8 # Generate a binary mojo application.The parameters of this template are those |
9 # of a shared library. | 9 # of a shared library. |
10 template("mojo_native_application") { | 10 template("mojo_native_application") { |
11 if (defined(invoker.output_name)) { | 11 if (defined(invoker.output_name)) { |
12 output = invoker.output_name + ".mojo" | 12 output = invoker.output_name + ".mojo" |
13 library_target_name = invoker.output_name + "_library" | 13 library_target_name = invoker.output_name + "_library" |
14 } else { | 14 } else { |
15 output = target_name + ".mojo" | 15 output = target_name + ".mojo" |
16 library_target_name = target_name + "_library" | 16 library_target_name = target_name + "_library" |
17 } | 17 } |
18 | 18 |
19 if (is_linux || is_android) { | 19 if (is_linux || is_android) { |
20 library_name = "lib${library_target_name}.so" | 20 library_name = "lib${library_target_name}.so" |
21 } else if (is_win) { | 21 } else if (is_win) { |
22 library_name = "${library_target_name}.dll" | 22 library_name = "${library_target_name}.dll" |
23 } else if (is_mac) { | 23 } else if (is_mac) { |
24 library_name = "lib${library_target_name}.dylib" | 24 library_name = "lib${library_target_name}.dylib" |
25 } else { | 25 } else { |
26 assert(false, "Platform not supported.") | 26 assert(false, "Platform not supported.") |
27 } | 27 } |
28 | 28 |
| 29 if (is_android) { |
| 30 # On android, use the stripped version of the library, because applications |
| 31 # are always fetched over the network. |
| 32 library_dir = "${root_out_dir}/lib.stripped" |
| 33 } else { |
| 34 library_dir = root_out_dir |
| 35 } |
| 36 |
29 final_target_name = target_name | 37 final_target_name = target_name |
30 | 38 |
31 shared_library(library_target_name) { | 39 shared_library(library_target_name) { |
32 if (defined(invoker.cflags)) { | 40 if (defined(invoker.cflags)) { |
33 cflags = invoker.cflags | 41 cflags = invoker.cflags |
34 } | 42 } |
35 if (defined(invoker.cflags_c)) { | 43 if (defined(invoker.cflags_c)) { |
36 cflags_c = invoker.cflags_c | 44 cflags_c = invoker.cflags_c |
37 } | 45 } |
38 if (defined(invoker.cflags_cc)) { | 46 if (defined(invoker.cflags_cc)) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 copy(final_target_name) { | 135 copy(final_target_name) { |
128 if (defined(invoker.testonly)) { | 136 if (defined(invoker.testonly)) { |
129 testonly = invoker.testonly | 137 testonly = invoker.testonly |
130 } | 138 } |
131 if (defined(invoker.visibility)) { | 139 if (defined(invoker.visibility)) { |
132 visibility = invoker.visibility | 140 visibility = invoker.visibility |
133 } | 141 } |
134 deps = [ | 142 deps = [ |
135 ":${library_target_name}", | 143 ":${library_target_name}", |
136 ] | 144 ] |
| 145 |
137 sources = [ | 146 sources = [ |
138 "${root_out_dir}/${library_name}", | 147 "${library_dir}/${library_name}", |
139 ] | 148 ] |
140 outputs = [ | 149 outputs = [ |
141 "${root_out_dir}/${output}", | 150 "${root_out_dir}/${output}", |
142 ] | 151 ] |
143 } | 152 } |
144 } | 153 } |
145 | 154 |
146 if (is_android) { | 155 if (is_android) { |
147 # Declares an Android Mojo application consisting of an .so file and a | 156 # Declares an Android Mojo application consisting of an .so file and a |
148 # corresponding .dex.jar file. | 157 # corresponding .dex.jar file. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 rebase_input = rebase_path(input, root_build_dir) | 209 rebase_input = rebase_path(input, root_build_dir) |
201 rebase_output = rebase_path(output, root_build_dir) | 210 rebase_output = rebase_path(output, root_build_dir) |
202 args = [ | 211 args = [ |
203 "--input=$rebase_input", | 212 "--input=$rebase_input", |
204 "--output=$rebase_output", | 213 "--output=$rebase_output", |
205 "--line=#!mojo:android_handler", | 214 "--line=#!mojo:android_handler", |
206 ] | 215 ] |
207 } | 216 } |
208 } | 217 } |
209 } | 218 } |
OLD | NEW |