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("//build/toolchain/toolchain.gni") |
5 import("mojo.gni") | 6 import("mojo.gni") |
6 if (is_android) { | |
7 import("//build/config/android/config.gni") | |
8 } | |
9 | 7 |
10 # Generate a binary Mojo application in a self-named directory. | 8 # Generate a binary Mojo application in a self-named directory. |
11 # Application resources are copied to a "resources" directory alongside the app. | 9 # Application resources are copied to a "resources" directory alongside the app. |
12 # The parameters of this template are those of a shared library. | 10 # The parameters of this template are those of a shared library. |
13 template("mojo_native_application") { | 11 template("mojo_native_application") { |
14 base_target_name = target_name | 12 base_target_name = target_name |
15 if (defined(invoker.output_name)) { | 13 if (defined(invoker.output_name)) { |
16 base_target_name = invoker.output_name | 14 base_target_name = invoker.output_name |
17 } | 15 } |
18 | 16 |
(...skipping 15 matching lines...) Expand all Loading... |
34 testonly = invoker.testonly | 32 testonly = invoker.testonly |
35 } | 33 } |
36 deps = mojo_deps | 34 deps = mojo_deps |
37 } | 35 } |
38 mojo_deps += [ ":$copy_step_name" ] | 36 mojo_deps += [ ":$copy_step_name" ] |
39 } | 37 } |
40 | 38 |
41 if (!is_nacl) { | 39 if (!is_nacl) { |
42 output = base_target_name + ".mojo" | 40 output = base_target_name + ".mojo" |
43 library_target_name = base_target_name + "_library" | 41 library_target_name = base_target_name + "_library" |
44 | 42 library_name = "${shlib_prefix}${library_target_name}${shlib_extension}" |
45 if (is_linux) { | |
46 library_name = "lib${library_target_name}.so" | |
47 } else if (is_android) { | |
48 library_name = "lib${library_target_name}${android_product_extension}" | |
49 } else if (is_win) { | |
50 library_name = "${library_target_name}.dll" | |
51 } else if (is_mac) { | |
52 library_name = "lib${library_target_name}.dylib" | |
53 } else { | |
54 assert(false, "Platform not supported.") | |
55 } | |
56 | |
57 if (is_android) { | |
58 # On android, use the stripped version of the library, because | |
59 # applications are always fetched over the network. | |
60 library_dir = "${root_out_dir}/lib.stripped" | |
61 } else { | |
62 library_dir = root_out_dir | |
63 } | |
64 | 43 |
65 shared_library(library_target_name) { | 44 shared_library(library_target_name) { |
66 if (defined(invoker.cflags)) { | 45 if (defined(invoker.cflags)) { |
67 cflags = invoker.cflags | 46 cflags = invoker.cflags |
68 } | 47 } |
69 if (defined(invoker.cflags_c)) { | 48 if (defined(invoker.cflags_c)) { |
70 cflags_c = invoker.cflags_c | 49 cflags_c = invoker.cflags_c |
71 } | 50 } |
72 if (defined(invoker.cflags_cc)) { | 51 if (defined(invoker.cflags_cc)) { |
73 cflags_cc = invoker.cflags_cc | 52 cflags_cc = invoker.cflags_cc |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 testonly = invoker.testonly | 138 testonly = invoker.testonly |
160 } | 139 } |
161 if (defined(invoker.visibility)) { | 140 if (defined(invoker.visibility)) { |
162 visibility = invoker.visibility | 141 visibility = invoker.visibility |
163 } | 142 } |
164 deps = [ | 143 deps = [ |
165 ":${library_target_name}", | 144 ":${library_target_name}", |
166 ] | 145 ] |
167 | 146 |
168 sources = [ | 147 sources = [ |
169 "${library_dir}/${library_name}", | 148 "${root_shlib_dir}/${library_name}", |
170 ] | 149 ] |
171 outputs = [ | 150 outputs = [ |
172 "${root_out_dir}/${base_target_name}/${output}", | 151 "${root_out_dir}/${base_target_name}/${output}", |
173 ] | 152 ] |
174 } | 153 } |
175 } else { | 154 } else { |
176 nexe_target_name = base_target_name + "_nexe" | 155 nexe_target_name = base_target_name + "_nexe" |
177 nexe_name = base_target_name + ".nexe" | 156 nexe_name = base_target_name + ".nexe" |
178 | 157 |
179 output = "${base_target_name}_${target_cpu}.nexe.mojo" | 158 output = "${base_target_name}_${target_cpu}.nexe.mojo" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 ] | 386 ] |
408 | 387 |
409 deps = mojo_deps | 388 deps = mojo_deps |
410 | 389 |
411 public_deps = [ | 390 public_deps = [ |
412 ":$zip_action_name", | 391 ":$zip_action_name", |
413 ] | 392 ] |
414 } | 393 } |
415 } | 394 } |
416 } | 395 } |
OLD | NEW |