OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # Generate a binary mojo application.The parameters of this template are those |
| 6 # of a shared library. |
| 7 template("mojo_native_application") { |
| 8 if (defined(invoker.output_name)) { |
| 9 output = invoker.output_name + ".mojo" |
| 10 library_target_name = invoker.output_name + "_library" |
| 11 } else { |
| 12 output = target_name + ".mojo" |
| 13 library_target_name = target_name + "_library" |
| 14 } |
| 15 |
| 16 if (is_linux || is_android) { |
| 17 library_name = "lib${library_target_name}.so" |
| 18 } else if (is_windows) { |
| 19 library_name = "${library_target_name}.dll" |
| 20 } else if (is_mac) { |
| 21 library_name = "${library_target_name}.so" |
| 22 } else { |
| 23 assert(false, "Platform not supported.") |
| 24 } |
| 25 |
| 26 final_target_name = target_name |
| 27 |
| 28 shared_library(library_target_name) { |
| 29 if (defined(invoker.cflags)) { |
| 30 cflags = invoker.cflags |
| 31 } |
| 32 if (defined(invoker.cflags_c)) { |
| 33 cflags_c = invoker.cflags_c |
| 34 } |
| 35 if (defined(invoker.cflags_cc)) { |
| 36 cflags_cc = invoker.cflags_cc |
| 37 } |
| 38 if (defined(invoker.cflags_objc)) { |
| 39 cflags_objc = invoker.cflags_objc |
| 40 } |
| 41 if (defined(invoker.cflags_objcc)) { |
| 42 cflags_objcc = invoker.cflags_objcc |
| 43 } |
| 44 if (defined(invoker.defines)) { |
| 45 defines = invoker.defines |
| 46 } |
| 47 if (defined(invoker.include_dirs)) { |
| 48 include_dirs = invoker.include_dirs |
| 49 } |
| 50 if (defined(invoker.ldflags)) { |
| 51 ldflags = invoker.ldflags |
| 52 } |
| 53 if (defined(invoker.lib_dirs)) { |
| 54 lib_dirs = invoker.lib_dirs |
| 55 } |
| 56 if (defined(invoker.libs)) { |
| 57 libs = invoker.libs |
| 58 } |
| 59 if (defined(invoker.datadeps)) { |
| 60 datadeps = invoker.datadeps |
| 61 } |
| 62 if (defined(invoker.deps)) { |
| 63 deps = invoker.deps |
| 64 } |
| 65 if (defined(invoker.forward_dependent_configs_from)) { |
| 66 forward_dependent_configs_from = invoker.forward_dependent_configs_from |
| 67 } |
| 68 if (defined(invoker.public_deps)) { |
| 69 public_deps = invoker.public_deps |
| 70 } |
| 71 if (defined(invoker.all_dependent_configs)) { |
| 72 all_dependent_configs = invoker.all_dependent_configs |
| 73 } |
| 74 if (defined(invoker.public_configs)) { |
| 75 public_configs = invoker.public_configs |
| 76 } |
| 77 if (defined(invoker.check_includes)) { |
| 78 check_includes = invoker.check_includes |
| 79 } |
| 80 if (defined(invoker.configs)) { |
| 81 configs = invoker.configs |
| 82 } |
| 83 if (defined(invoker.data)) { |
| 84 data = invoker.data |
| 85 } |
| 86 if (defined(invoker.inputs)) { |
| 87 inputs = invoker.inputs |
| 88 } |
| 89 if (defined(invoker.public)) { |
| 90 public = invoker.public |
| 91 } |
| 92 if (defined(invoker.sources)) { |
| 93 sources = invoker.sources |
| 94 } |
| 95 if (defined(invoker.testonly)) { |
| 96 testonly = invoker.testonly |
| 97 } |
| 98 |
| 99 visibility = [ |
| 100 ":${final_target_name}", |
| 101 ] |
| 102 } |
| 103 |
| 104 copy(final_target_name) { |
| 105 if (defined(invoker.testonly)) { |
| 106 testonly = invoker.testonly |
| 107 } |
| 108 if (defined(invoker.visibility)) { |
| 109 visibility = invoker.visibility |
| 110 } |
| 111 deps = [ |
| 112 ":${library_target_name}", |
| 113 ] |
| 114 sources = [ "${root_out_dir}/${library_name}" ] |
| 115 outputs = [ "${root_out_dir}/${output}" ] |
| 116 } |
| 117 } |
OLD | NEW |