| 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/config/ios/ios_sdk.gni") | 5 import("//build/config/ios/ios_sdk.gni") |
| 6 import("//build/config/mac/rules.gni") | 6 import("//build/config/mac/rules.gni") |
| 7 | 7 |
| 8 # TODO(crbug.com/297668): refactor this template to extract common behaviour | 8 # TODO(crbug.com/297668): refactor this template to extract common behaviour |
| 9 # between OS X and iOS bundle generation, then create a generic "app" template | 9 # between OS X and iOS bundle generation, then create a generic "app" template |
| 10 # that forward to "executable" on all platform except iOS/OS X. | 10 # that forward to "executable" on all platform except iOS/OS X. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 sources = get_target_outputs(":$_compile_xib") | 215 sources = get_target_outputs(":$_compile_xib") |
| 216 | 216 |
| 217 outputs = [ | 217 outputs = [ |
| 218 "{{bundle_resources_dir}}/{{source_file_part}}", | 218 "{{bundle_resources_dir}}/{{source_file_part}}", |
| 219 ] | 219 ] |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 # Template to package a shared library into an iOS framework bundle. | 223 # Template to package a shared library into an iOS framework bundle. |
| 224 # | 224 # |
| 225 # This template provides two targets to control whether the framework is |
| 226 # merely built when targets depend on it, or whether it is linked as well: |
| 227 # "$target_name" and "$target_name+link". |
| 228 # |
| 229 # See the //build/config/mac/rules.gni:framework_bundle for a discussion |
| 230 # and examples. |
| 231 # |
| 225 # Arguments | 232 # Arguments |
| 226 # | 233 # |
| 227 # output_name: | 234 # output_name: |
| 228 # (optional) string, name of the generated framework without the | 235 # (optional) string, name of the generated framework without the |
| 229 # .framework suffix. If omitted, defaults to target_name. | 236 # .framework suffix. If omitted, defaults to target_name. |
| 230 # | 237 # |
| 231 # framework_version: | 238 # framework_version: |
| 232 # (optional) string, version of the framework. Typically this is a | 239 # (optional) string, version of the framework. Typically this is a |
| 233 # single letter, like "A". If omitted, the Versions/ subdirectory | 240 # single letter, like "A". If omitted, the Versions/ subdirectory |
| 234 # structure will not be created, and build output will go directly | 241 # structure will not be created, and build output will go directly |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 332 |
| 326 group(_framework_headers_target) { | 333 group(_framework_headers_target) { |
| 327 deps = [ | 334 deps = [ |
| 328 ":$_compile_headers_map_target", | 335 ":$_compile_headers_map_target", |
| 329 ":$_copy_public_headers_target", | 336 ":$_copy_public_headers_target", |
| 330 ":$_create_module_map_target", | 337 ":$_create_module_map_target", |
| 331 ] | 338 ] |
| 332 } | 339 } |
| 333 } | 340 } |
| 334 | 341 |
| 342 _framework_public_config = _target_name + "_ios_public_config" |
| 343 config(_framework_public_config) { |
| 344 visibility = [ ":$_framework_public_config" ] |
| 345 if (defined(_public_headers)) { |
| 346 common_flags = [ "-F" + rebase_path("$root_out_dir/.", root_out_dir) ] |
| 347 cflags_objc = common_flags |
| 348 cflags_objcc = common_flags |
| 349 } |
| 350 |
| 351 # The link settings are inherited from the framework_bundle config. |
| 352 } |
| 353 |
| 335 framework_bundle(_framework_target) { | 354 framework_bundle(_framework_target) { |
| 336 forward_variables_from(invoker, | 355 forward_variables_from(invoker, |
| 337 "*", | 356 "*", |
| 338 [ | 357 [ |
| 339 "output_name", | 358 "output_name", |
| 340 "public_headers", | 359 "public_headers", |
| 341 "visibility", | 360 "visibility", |
| 342 ]) | 361 ]) |
| 343 output_name = _output_name | 362 output_name = _output_name |
| 344 | 363 |
| 364 if (!defined(public_configs)) { |
| 365 public_configs = [] |
| 366 } |
| 367 public_configs += [ ":$_framework_public_config" ] |
| 368 |
| 345 if (defined(_public_headers)) { | 369 if (defined(_public_headers)) { |
| 346 visibility = [ ":$_target_name" ] | 370 visibility = [ |
| 371 ":$_target_name", |
| 372 ":$_target_name+link", |
| 373 ] |
| 347 configs += [ ":$_headers_map_config" ] | 374 configs += [ ":$_headers_map_config" ] |
| 348 | 375 |
| 349 if (!defined(deps)) { | 376 if (!defined(deps)) { |
| 350 deps = [] | 377 deps = [] |
| 351 } | 378 } |
| 352 deps += [ ":$_framework_headers_target" ] | 379 deps += [ ":$_framework_headers_target" ] |
| 353 } else { | 380 } else { |
| 354 forward_variables_from(invoker, [ "visibility" ]) | 381 if (defined(invoker.visibility)) { |
| 382 visibility = invoker.visibility |
| 383 visibility += [ ":$_target_name+link" ] |
| 384 } |
| 355 } | 385 } |
| 356 } | 386 } |
| 357 | 387 |
| 358 if (defined(_public_headers)) { | 388 if (defined(_public_headers)) { |
| 359 group(_target_name) { | 389 group(_target_name) { |
| 360 forward_variables_from(invoker, | 390 forward_variables_from(invoker, |
| 361 [ | 391 [ |
| 362 "testonly", | 392 "testonly", |
| 363 "visibility", | |
| 364 "public_configs", | 393 "public_configs", |
| 365 ]) | 394 ]) |
| 366 | 395 |
| 396 if (defined(invoker.visibility)) { |
| 397 visibility = invoker.visibility |
| 398 visibility += [ ":$_target_name+link" ] |
| 399 } |
| 400 |
| 367 public_deps = [ | 401 public_deps = [ |
| 368 ":$_framework_target", | 402 ":$_framework_target", |
| 369 ] | 403 ] |
| 370 } | 404 } |
| 405 |
| 406 group(_target_name + "+link") { |
| 407 forward_variables_from(invoker, |
| 408 [ |
| 409 "testonly", |
| 410 "visibility", |
| 411 ]) |
| 412 public_deps = [ |
| 413 ":$_framework_target+link", |
| 414 ] |
| 415 } |
| 371 } | 416 } |
| 372 } | 417 } |
| OLD | NEW |