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