| 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/base_rules.gni") | 6 import("//build/config/mac/base_rules.gni") |
| 7 import("//build/config/mac/symbols.gni") | 7 import("//build/config/mac/symbols.gni") |
| 8 | 8 |
| 9 # Control whether an intermediate source_set is used when building executables | |
| 10 # and shared_libraries for ios_app_bundle and ios_framework_bundle. This is a | |
| 11 # temporary flag that will be removed once scoped_nsobject_unittest{_arc}.mm | |
| 12 # tests are passing with this flag set to true (see crbug.com/637065) | |
| 13 _use_intermediate_source_set = false | |
| 14 | |
| 15 # Invokes lipo on multiple arch-specific binaries to create a fat binary. | 9 # Invokes lipo on multiple arch-specific binaries to create a fat binary. |
| 16 # | 10 # |
| 17 # Arguments | 11 # Arguments |
| 18 # | 12 # |
| 19 # arch_binary_target | 13 # arch_binary_target |
| 20 # name of the target generating the arch-specific binaries, they must | 14 # name of the target generating the arch-specific binaries, they must |
| 21 # be named $target_out_dir/$toolchain_cpu/$arch_binary_output. | 15 # be named $target_out_dir/$toolchain_cpu/$arch_binary_output. |
| 22 # | 16 # |
| 23 # arch_binary_output | 17 # arch_binary_output |
| 24 # (optional, defaults to the name of $arch_binary_target) base name of | 18 # (optional, defaults to the name of $arch_binary_target) base name of |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 _output_name = target_name | 362 _output_name = target_name |
| 369 _target_name = target_name | 363 _target_name = target_name |
| 370 if (defined(invoker.output_name)) { | 364 if (defined(invoker.output_name)) { |
| 371 _output_name = invoker.output_name | 365 _output_name = invoker.output_name |
| 372 } | 366 } |
| 373 | 367 |
| 374 _arch_executable_source = _target_name + "_arch_executable_sources" | 368 _arch_executable_source = _target_name + "_arch_executable_sources" |
| 375 _arch_executable_target = _target_name + "_arch_executable" | 369 _arch_executable_target = _target_name + "_arch_executable" |
| 376 _lipo_executable_target = _target_name + "_executable" | 370 _lipo_executable_target = _target_name + "_executable" |
| 377 | 371 |
| 378 if (_use_intermediate_source_set) { | 372 source_set(_arch_executable_source) { |
| 379 source_set(_arch_executable_source) { | 373 forward_variables_from(invoker, |
| 380 forward_variables_from(invoker, | 374 "*", |
| 381 "*", | 375 [ |
| 382 [ | 376 "bundle_deps", |
| 383 "bundle_deps", | 377 "bundle_deps_filter", |
| 384 "bundle_deps_filter", | 378 "bundle_extension", |
| 385 "bundle_extension", | 379 "enable_code_signing", |
| 386 "enable_code_signing", | 380 "entitlements_path", |
| 387 "entitlements_path", | 381 "extra_substitutions", |
| 388 "extra_substitutions", | 382 "extra_system_frameworks", |
| 389 "extra_system_frameworks", | 383 "info_plist", |
| 390 "info_plist", | 384 "info_plist_target", |
| 391 "info_plist_target", | 385 "output_name", |
| 392 "output_name", | 386 "product_type", |
| 393 "product_type", | 387 "visibility", |
| 394 "visibility", | 388 ]) |
| 395 ]) | |
| 396 | 389 |
| 397 visibility = [ ":$_arch_executable_target" ] | 390 visibility = [ ":$_arch_executable_target" ] |
| 398 } | |
| 399 } else { | |
| 400 assert(_arch_executable_source != "", | |
| 401 "mark _arch_executable_source as used") | |
| 402 } | 391 } |
| 403 | 392 |
| 404 if (use_ios_simulator) { | 393 if (use_ios_simulator) { |
| 405 _generate_entitlements_target = _target_name + "_gen_entitlements" | 394 _generate_entitlements_target = _target_name + "_gen_entitlements" |
| 406 _generate_entitlements_output = | 395 _generate_entitlements_output = |
| 407 get_label_info(":$_generate_entitlements_target($default_toolchain)", | 396 get_label_info(":$_generate_entitlements_target($default_toolchain)", |
| 408 "target_out_dir") + "/$_output_name.xcent" | 397 "target_out_dir") + "/$_output_name.xcent" |
| 409 } | 398 } |
| 410 | 399 |
| 411 executable(_arch_executable_target) { | 400 executable(_arch_executable_target) { |
| 412 forward_variables_from(invoker, | 401 forward_variables_from(invoker, |
| 413 "*", | 402 "*", |
| 414 [ | 403 [ |
| 415 "bundle_deps", | 404 "bundle_deps", |
| 416 "bundle_deps_filter", | 405 "bundle_deps_filter", |
| 417 "bundle_extension", | 406 "bundle_extension", |
| 418 "enable_code_signing", | 407 "enable_code_signing", |
| 419 "entitlements_path", | 408 "entitlements_path", |
| 420 "extra_substitutions", | 409 "extra_substitutions", |
| 421 "extra_system_frameworks", | 410 "extra_system_frameworks", |
| 422 "info_plist", | 411 "info_plist", |
| 423 "info_plist_target", | 412 "info_plist_target", |
| 424 "output_name", | 413 "output_name", |
| 425 "product_type", | 414 "product_type", |
| 426 "sources", | 415 "sources", |
| 427 "visibility", | 416 "visibility", |
| 428 ]) | 417 ]) |
| 429 if (!_use_intermediate_source_set) { | |
| 430 forward_variables_from(invoker, [ "sources" ]) | |
| 431 } | |
| 432 | 418 |
| 433 visibility = [ ":$_lipo_executable_target($default_toolchain)" ] | 419 visibility = [ ":$_lipo_executable_target($default_toolchain)" ] |
| 434 if (current_toolchain != default_toolchain) { | 420 if (current_toolchain != default_toolchain) { |
| 435 visibility += [ ":$_target_name" ] | 421 visibility += [ ":$_target_name" ] |
| 436 } | 422 } |
| 437 | 423 |
| 438 if (!defined(deps)) { | 424 if (!defined(deps)) { |
| 439 deps = [] | 425 deps = [] |
| 440 } | 426 } |
| 441 if (_use_intermediate_source_set) { | 427 deps += [ ":$_arch_executable_source" ] |
| 442 deps += [ ":$_arch_executable_source" ] | |
| 443 } | |
| 444 | 428 |
| 445 if (!defined(libs)) { | 429 if (!defined(libs)) { |
| 446 libs = [] | 430 libs = [] |
| 447 } | 431 } |
| 448 libs += [ "UIKit.framework" ] | 432 libs += [ "UIKit.framework" ] |
| 449 | 433 |
| 450 if (use_ios_simulator) { | 434 if (use_ios_simulator) { |
| 451 deps += [ ":$_generate_entitlements_target($default_toolchain)" ] | 435 deps += [ ":$_generate_entitlements_target($default_toolchain)" ] |
| 452 | 436 |
| 453 if (!defined(inputs)) { | 437 if (!defined(inputs)) { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 if (_has_public_headers) { | 855 if (_has_public_headers) { |
| 872 _framework_headers_target = _target_name + "_framework_headers" | 856 _framework_headers_target = _target_name + "_framework_headers" |
| 873 _framework_headers_config = _target_name + "_framework_headers_config" | 857 _framework_headers_config = _target_name + "_framework_headers_config" |
| 874 _headers_map_config = _target_name + "_headers_map" | 858 _headers_map_config = _target_name + "_headers_map" |
| 875 } | 859 } |
| 876 | 860 |
| 877 _arch_shared_library_source = _target_name + "_arch_shared_library_sources" | 861 _arch_shared_library_source = _target_name + "_arch_shared_library_sources" |
| 878 _arch_shared_library_target = _target_name + "_arch_shared_library" | 862 _arch_shared_library_target = _target_name + "_arch_shared_library" |
| 879 _lipo_shared_library_target = _target_name + "_shared_library" | 863 _lipo_shared_library_target = _target_name + "_shared_library" |
| 880 | 864 |
| 881 if (_use_intermediate_source_set) { | 865 source_set(_arch_shared_library_source) { |
| 882 source_set(_arch_shared_library_source) { | 866 forward_variables_from(invoker, |
| 883 forward_variables_from(invoker, | 867 "*", |
| 884 "*", | 868 [ |
| 885 [ | 869 "bundle_deps", |
| 886 "bundle_deps", | 870 "bundle_deps_filter", |
| 887 "bundle_deps_filter", | 871 "data_deps", |
| 888 "data_deps", | 872 "enable_code_signing", |
| 889 "enable_code_signing", | 873 "info_plist", |
| 890 "info_plist", | 874 "info_plist_target", |
| 891 "info_plist_target", | 875 "output_name", |
| 892 "output_name", | 876 "visibility", |
| 893 "visibility", | 877 ]) |
| 894 ]) | |
| 895 | 878 |
| 896 visibility = [ ":$_arch_shared_library_target" ] | 879 visibility = [ ":$_arch_shared_library_target" ] |
| 897 | 880 |
| 898 if (_has_public_headers) { | 881 if (_has_public_headers) { |
| 899 configs += [ | 882 configs += [ |
| 900 ":$_framework_headers_config($default_toolchain)", | 883 ":$_framework_headers_config($default_toolchain)", |
| 901 ":$_headers_map_config($default_toolchain)", | 884 ":$_headers_map_config($default_toolchain)", |
| 902 ] | 885 ] |
| 903 | 886 |
| 904 if (!defined(deps)) { | 887 if (!defined(deps)) { |
| 905 deps = [] | 888 deps = [] |
| 906 } | |
| 907 deps += [ ":$_framework_headers_target($default_toolchain)" ] | |
| 908 } | 889 } |
| 890 deps += [ ":$_framework_headers_target($default_toolchain)" ] |
| 909 } | 891 } |
| 910 } else { | |
| 911 assert(_arch_shared_library_source != "", | |
| 912 "mark _arch_shared_library_source as used") | |
| 913 } | 892 } |
| 914 | 893 |
| 915 shared_library(_arch_shared_library_target) { | 894 shared_library(_arch_shared_library_target) { |
| 916 forward_variables_from(invoker, | 895 forward_variables_from(invoker, |
| 917 "*", | 896 "*", |
| 918 [ | 897 [ |
| 919 "bundle_deps", | 898 "bundle_deps", |
| 920 "bundle_deps_filter", | 899 "bundle_deps_filter", |
| 921 "data_deps", | 900 "data_deps", |
| 922 "enable_code_signing", | 901 "enable_code_signing", |
| 923 "info_plist", | 902 "info_plist", |
| 924 "info_plist_target", | 903 "info_plist_target", |
| 925 "output_name", | 904 "output_name", |
| 926 "sources", | 905 "sources", |
| 927 "visibility", | 906 "visibility", |
| 928 ]) | 907 ]) |
| 929 if (!_use_intermediate_source_set) { | |
| 930 forward_variables_from(invoker, [ "sources" ]) | |
| 931 } | |
| 932 | 908 |
| 933 visibility = [ ":$_lipo_shared_library_target($default_toolchain)" ] | 909 visibility = [ ":$_lipo_shared_library_target($default_toolchain)" ] |
| 934 if (current_toolchain != default_toolchain) { | 910 if (current_toolchain != default_toolchain) { |
| 935 visibility += [ ":$_target_name" ] | 911 visibility += [ ":$_target_name" ] |
| 936 } | 912 } |
| 937 | 913 |
| 938 if (!defined(deps)) { | 914 if (!defined(deps)) { |
| 939 deps = [] | 915 deps = [] |
| 940 } | 916 } |
| 941 if (_use_intermediate_source_set) { | 917 deps += [ ":$_arch_shared_library_source" ] |
| 942 deps += [ ":$_arch_shared_library_source" ] | |
| 943 } else { | |
| 944 if (_has_public_headers) { | |
| 945 configs += [ | |
| 946 ":$_framework_headers_config($default_toolchain)", | |
| 947 ":$_headers_map_config($default_toolchain)", | |
| 948 ] | |
| 949 | |
| 950 if (!defined(deps)) { | |
| 951 deps = [] | |
| 952 } | |
| 953 deps += [ ":$_framework_headers_target($default_toolchain)" ] | |
| 954 } | |
| 955 } | |
| 956 | 918 |
| 957 output_extension = "" | 919 output_extension = "" |
| 958 output_name = _output_name | 920 output_name = _output_name |
| 959 output_prefix_override = true | 921 output_prefix_override = true |
| 960 output_dir = "$target_out_dir/$current_cpu" | 922 output_dir = "$target_out_dir/$current_cpu" |
| 961 } | 923 } |
| 962 | 924 |
| 963 if (current_toolchain != default_toolchain) { | 925 if (current_toolchain != default_toolchain) { |
| 964 # For fat builds, only the default toolchain will generate a framework | 926 # For fat builds, only the default toolchain will generate a framework |
| 965 # bundle. For the other toolchains, the template is only used for building | 927 # bundle. For the other toolchains, the template is only used for building |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 "-rpath", | 1307 "-rpath", |
| 1346 "-Xlinker", | 1308 "-Xlinker", |
| 1347 "@loader_path/Frameworks", | 1309 "@loader_path/Frameworks", |
| 1348 ] | 1310 ] |
| 1349 } | 1311 } |
| 1350 } | 1312 } |
| 1351 | 1313 |
| 1352 set_defaults("ios_xctest_test") { | 1314 set_defaults("ios_xctest_test") { |
| 1353 configs = default_executable_configs | 1315 configs = default_executable_configs |
| 1354 } | 1316 } |
| OLD | NEW |