Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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("//build/toolchain/toolchain.gni") |
| 6 import("//build/config/mac/mac_sdk.gni") | 6 import("//build/config/mac/mac_sdk.gni") |
| 7 | 7 |
| 8 # This is used as the base template for both iOS and Mac frameworks.. | 8 # This is used as the base template for both iOS and Mac frameworks. |
| 9 # | |
| 10 # By default, the bundle target this template generates does not link the | |
|
brettw
2016/04/21 20:27:55
This seems like it would work in the other place.
Robert Sesek
2016/04/22 15:27:06
Done.
| |
| 11 # resulting framework into anything that depends on it. If a dependency wants | |
| 12 # a link-time (as well as build-time) dependency on the framework bundle, | |
| 13 # depend against "$target_name+link". If only the build-time dependency is | |
| 14 # required (e.g., for copying into another bundle), then use "$target_name". | |
| 9 # | 15 # |
| 10 # Arguments | 16 # Arguments |
| 11 # | 17 # |
| 12 # output_name: | 18 # output_name: |
| 13 # (optional) string, name of the generated framework without the | 19 # (optional) string, name of the generated framework without the |
| 14 # .framework suffix. If omitted, defaults to target_name. | 20 # .framework suffix. If omitted, defaults to target_name. |
| 15 # | 21 # |
| 16 # framework_version: | 22 # framework_version: |
| 17 # (optional) string, version of the framework. Typically this is a | 23 # (optional) string, version of the framework. Typically this is a |
| 18 # single letter, like "A". If omitted, the Versions/ subdirectory | 24 # single letter, like "A". If omitted, the Versions/ subdirectory |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 public_deps = [ | 79 public_deps = [ |
| 74 ":$_shared_library_target", | 80 ":$_shared_library_target", |
| 75 ] | 81 ] |
| 76 } | 82 } |
| 77 | 83 |
| 78 _framework_public_config = _target_name + "_public_config" | 84 _framework_public_config = _target_name + "_public_config" |
| 79 config(_framework_public_config) { | 85 config(_framework_public_config) { |
| 80 # TODO(sdefresne): should we have a framework_dirs similar to lib_dirs | 86 # TODO(sdefresne): should we have a framework_dirs similar to lib_dirs |
| 81 # and include_dirs to avoid duplicate values on the command-line. | 87 # and include_dirs to avoid duplicate values on the command-line. |
| 82 visibility = [ ":$_framework_target" ] | 88 visibility = [ ":$_framework_target" ] |
| 83 common_flags = [ "-F" + rebase_path("$root_out_dir/.", root_out_dir) ] | 89 ldflags = [ "-F" + rebase_path("$root_out_dir/.", root_out_dir) ] |
| 84 cflags_objc = common_flags | |
|
sdefresne
2016/04/22 07:59:48
I think we need -F in cflags_objc/cflags_objcc whe
Robert Sesek
2016/04/22 15:27:06
I moved that to the ios/rules.gni config since Mac
| |
| 85 cflags_objcc = common_flags | |
| 86 ldflags = common_flags | |
| 87 lib_dirs = [ root_out_dir ] | 90 lib_dirs = [ root_out_dir ] |
| 88 libs = [ _framework_name ] | 91 libs = [ _framework_name ] |
| 89 } | 92 } |
| 90 | 93 |
| 91 create_bundle(_framework_target) { | 94 create_bundle(_framework_target) { |
| 92 forward_variables_from(invoker, | 95 forward_variables_from(invoker, |
| 93 [ | 96 [ |
| 94 "data_deps", | 97 "data_deps", |
| 95 "deps", | 98 "deps", |
| 96 "public_deps", | 99 "public_deps", |
| 97 "testonly", | 100 "testonly", |
| 98 ]) | 101 ]) |
| 99 | 102 |
| 100 if (defined(_framework_version)) { | 103 if (defined(_framework_version)) { |
| 101 visibility = [ ":$_target_name" ] | 104 visibility = [ ":$_target_name" ] |
| 102 } else { | 105 } else { |
| 103 forward_variables_from(invoker, [ "visibility" ]) | 106 if (defined(invoker.visibility)) { |
| 107 visibility = invoker.visibility | |
| 108 visibility += [ ":$_target_name+link" ] | |
| 109 } | |
| 104 } | 110 } |
| 105 | 111 |
| 106 if (!defined(public_deps)) { | 112 if (!defined(public_deps)) { |
| 107 public_deps = [] | 113 public_deps = [] |
| 108 } | 114 } |
| 109 public_deps += [ ":$_shared_library_bundle_data" ] | 115 public_deps += [ ":$_shared_library_bundle_data" ] |
| 110 | 116 |
| 111 public_configs = [ ":$_framework_public_config" ] | |
| 112 | |
| 113 bundle_root_dir = _framework_root_dir | 117 bundle_root_dir = _framework_root_dir |
| 114 bundle_resources_dir = "$bundle_root_dir/Resources" | 118 bundle_resources_dir = "$bundle_root_dir/Resources" |
| 115 bundle_executable_dir = "$bundle_root_dir" | 119 bundle_executable_dir = "$bundle_root_dir" |
| 116 } | 120 } |
| 117 | 121 |
| 118 if (defined(_framework_version)) { | 122 if (defined(_framework_version)) { |
| 119 action(_target_name) { | 123 action(_target_name) { |
| 120 forward_variables_from(invoker, | 124 forward_variables_from(invoker, [ "testonly" ]) |
| 121 [ | 125 |
| 122 "visibility", | 126 if (defined(invoker.visibility)) { |
| 123 "testonly", | 127 visibility = invoker.visibility |
| 124 ]) | 128 visibility += [ ":$_target_name+link" ] |
| 129 } | |
| 130 | |
| 125 script = "$root_out_dir/gyp-mac-tool" | 131 script = "$root_out_dir/gyp-mac-tool" |
| 126 outputs = [ | 132 outputs = [ |
| 127 "$root_out_dir/$_framework_name/Versions/Current", | 133 "$root_out_dir/$_framework_name/Versions/Current", |
| 128 ] | 134 ] |
| 129 args = [ | 135 args = [ |
| 130 "package-framework", | 136 "package-framework", |
| 131 "$_framework_name", | 137 "$_framework_name", |
| 132 "$_framework_version", | 138 "$_framework_version", |
| 133 ] | 139 ] |
| 134 public_deps = [ | 140 public_deps = [ |
| 135 ":$_framework_target", | 141 ":$_framework_target", |
| 136 ] | 142 ] |
| 137 } | 143 } |
| 138 } | 144 } |
| 145 | |
| 146 group(_target_name + "+link") { | |
| 147 forward_variables_from(invoker, | |
| 148 [ | |
| 149 "visibility", | |
| 150 "testonly", | |
| 151 ]) | |
| 152 public_deps = [ | |
| 153 ":$_target_name", | |
| 154 ] | |
| 155 public_configs = [ ":$_framework_public_config" ] | |
| 156 } | |
| 139 } | 157 } |
| 140 | 158 |
| 141 # Template to combile .xib or .storyboard files. | 159 # Template to combile .xib or .storyboard files. |
| 142 # | 160 # |
| 143 # | 161 # |
| 144 # Arguments | 162 # Arguments |
| 145 # | 163 # |
| 146 # sources: | 164 # sources: |
| 147 # list of string, sources to compile | 165 # list of string, sources to compile |
| 148 # | 166 # |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 ]) | 433 ]) |
| 416 if (!defined(deps)) { | 434 if (!defined(deps)) { |
| 417 deps = [] | 435 deps = [] |
| 418 } | 436 } |
| 419 deps += [ ":$_loadable_module_bundle_data" ] | 437 deps += [ ":$_loadable_module_bundle_data" ] |
| 420 | 438 |
| 421 bundle_root_dir = "$root_out_dir/$_target_name.plugin/Contents" | 439 bundle_root_dir = "$root_out_dir/$_target_name.plugin/Contents" |
| 422 bundle_executable_dir = "$bundle_root_dir/MacOS" | 440 bundle_executable_dir = "$bundle_root_dir/MacOS" |
| 423 } | 441 } |
| 424 } | 442 } |
| OLD | NEW |