| 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 = true | |
| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 _output_name = target_name | 370 _output_name = target_name |
| 377 _target_name = target_name | 371 _target_name = target_name |
| 378 if (defined(invoker.output_name)) { | 372 if (defined(invoker.output_name)) { |
| 379 _output_name = invoker.output_name | 373 _output_name = invoker.output_name |
| 380 } | 374 } |
| 381 | 375 |
| 382 _arch_executable_source = _target_name + "_arch_executable_sources" | 376 _arch_executable_source = _target_name + "_arch_executable_sources" |
| 383 _arch_executable_target = _target_name + "_arch_executable" | 377 _arch_executable_target = _target_name + "_arch_executable" |
| 384 _lipo_executable_target = _target_name + "_executable" | 378 _lipo_executable_target = _target_name + "_executable" |
| 385 | 379 |
| 386 if (_use_intermediate_source_set) { | 380 source_set(_arch_executable_source) { |
| 387 source_set(_arch_executable_source) { | 381 forward_variables_from(invoker, |
| 388 forward_variables_from(invoker, | 382 "*", |
| 389 "*", | 383 [ |
| 390 [ | 384 "bundle_deps", |
| 391 "bundle_deps", | 385 "bundle_deps_filter", |
| 392 "bundle_deps_filter", | 386 "bundle_extension", |
| 393 "bundle_extension", | 387 "enable_code_signing", |
| 394 "enable_code_signing", | 388 "entitlements_path", |
| 395 "entitlements_path", | 389 "extra_substitutions", |
| 396 "extra_substitutions", | 390 "extra_system_frameworks", |
| 397 "extra_system_frameworks", | 391 "info_plist", |
| 398 "info_plist", | 392 "info_plist_target", |
| 399 "info_plist_target", | 393 "output_name", |
| 400 "output_name", | 394 "product_type", |
| 401 "product_type", | 395 "visibility", |
| 402 "visibility", | 396 ]) |
| 403 ]) | |
| 404 | 397 |
| 405 visibility = [ ":$_arch_executable_target" ] | 398 visibility = [ ":$_arch_executable_target" ] |
| 406 } | |
| 407 } else { | |
| 408 assert(_arch_executable_source != "", | |
| 409 "mark _arch_executable_source as used") | |
| 410 } | 399 } |
| 411 | 400 |
| 412 if (use_ios_simulator) { | 401 if (use_ios_simulator) { |
| 413 _generate_entitlements_target = _target_name + "_gen_entitlements" | 402 _generate_entitlements_target = _target_name + "_gen_entitlements" |
| 414 _generate_entitlements_output = | 403 _generate_entitlements_output = |
| 415 get_label_info(":$_generate_entitlements_target($default_toolchain)", | 404 get_label_info(":$_generate_entitlements_target($default_toolchain)", |
| 416 "target_out_dir") + "/$_output_name.xcent" | 405 "target_out_dir") + "/$_output_name.xcent" |
| 417 } | 406 } |
| 418 | 407 |
| 419 executable(_arch_executable_target) { | 408 executable(_arch_executable_target) { |
| 420 forward_variables_from(invoker, | 409 forward_variables_from(invoker, |
| 421 "*", | 410 "*", |
| 422 [ | 411 [ |
| 423 "bundle_deps", | 412 "bundle_deps", |
| 424 "bundle_deps_filter", | 413 "bundle_deps_filter", |
| 425 "bundle_extension", | 414 "bundle_extension", |
| 426 "enable_code_signing", | 415 "enable_code_signing", |
| 427 "entitlements_path", | 416 "entitlements_path", |
| 428 "extra_substitutions", | 417 "extra_substitutions", |
| 429 "extra_system_frameworks", | 418 "extra_system_frameworks", |
| 430 "info_plist", | 419 "info_plist", |
| 431 "info_plist_target", | 420 "info_plist_target", |
| 432 "output_name", | 421 "output_name", |
| 433 "product_type", | 422 "product_type", |
| 434 "sources", | 423 "sources", |
| 435 "visibility", | 424 "visibility", |
| 436 ]) | 425 ]) |
| 437 if (!_use_intermediate_source_set) { | |
| 438 forward_variables_from(invoker, [ "sources" ]) | |
| 439 } | |
| 440 | 426 |
| 441 visibility = [ ":$_lipo_executable_target($default_toolchain)" ] | 427 visibility = [ ":$_lipo_executable_target($default_toolchain)" ] |
| 442 if (current_toolchain != default_toolchain) { | 428 if (current_toolchain != default_toolchain) { |
| 443 visibility += [ ":$_target_name" ] | 429 visibility += [ ":$_target_name" ] |
| 444 } | 430 } |
| 445 | 431 |
| 446 if (!defined(deps)) { | 432 if (!defined(deps)) { |
| 447 deps = [] | 433 deps = [] |
| 448 } | 434 } |
| 449 if (_use_intermediate_source_set) { | 435 deps += [ ":$_arch_executable_source" ] |
| 450 deps += [ ":$_arch_executable_source" ] | |
| 451 } | |
| 452 | 436 |
| 453 if (!defined(libs)) { | 437 if (!defined(libs)) { |
| 454 libs = [] | 438 libs = [] |
| 455 } | 439 } |
| 456 libs += [ "UIKit.framework" ] | 440 libs += [ "UIKit.framework" ] |
| 457 | 441 |
| 458 if (use_ios_simulator) { | 442 if (use_ios_simulator) { |
| 459 deps += [ ":$_generate_entitlements_target($default_toolchain)" ] | 443 deps += [ ":$_generate_entitlements_target($default_toolchain)" ] |
| 460 | 444 |
| 461 if (!defined(inputs)) { | 445 if (!defined(inputs)) { |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 _framework_headers_target = _target_name + "_framework_headers" | 865 _framework_headers_target = _target_name + "_framework_headers" |
| 882 _framework_headers_config = _target_name + "_framework_headers_config" | 866 _framework_headers_config = _target_name + "_framework_headers_config" |
| 883 _headers_map_config = _target_name + "_headers_map" | 867 _headers_map_config = _target_name + "_headers_map" |
| 884 _install_name_config = _target_name + "_install_name" | 868 _install_name_config = _target_name + "_install_name" |
| 885 } | 869 } |
| 886 | 870 |
| 887 _arch_shared_library_source = _target_name + "_arch_shared_library_sources" | 871 _arch_shared_library_source = _target_name + "_arch_shared_library_sources" |
| 888 _arch_shared_library_target = _target_name + "_arch_shared_library" | 872 _arch_shared_library_target = _target_name + "_arch_shared_library" |
| 889 _lipo_shared_library_target = _target_name + "_shared_library" | 873 _lipo_shared_library_target = _target_name + "_shared_library" |
| 890 | 874 |
| 891 if (_use_intermediate_source_set) { | 875 source_set(_arch_shared_library_source) { |
| 892 source_set(_arch_shared_library_source) { | 876 forward_variables_from(invoker, |
| 893 forward_variables_from(invoker, | 877 "*", |
| 894 "*", | 878 [ |
| 895 [ | 879 "bundle_deps", |
| 896 "bundle_deps", | 880 "bundle_deps_filter", |
| 897 "bundle_deps_filter", | 881 "data_deps", |
| 898 "data_deps", | 882 "enable_code_signing", |
| 899 "enable_code_signing", | 883 "info_plist", |
| 900 "info_plist", | 884 "info_plist_target", |
| 901 "info_plist_target", | 885 "output_name", |
| 902 "output_name", | 886 "visibility", |
| 903 "visibility", | 887 ]) |
| 904 ]) | |
| 905 | 888 |
| 906 visibility = [ ":$_arch_shared_library_target" ] | 889 visibility = [ ":$_arch_shared_library_target" ] |
| 907 | 890 |
| 908 if (_has_public_headers) { | 891 if (_has_public_headers) { |
| 909 configs += [ | 892 configs += [ |
| 910 ":$_framework_headers_config($default_toolchain)", | 893 ":$_framework_headers_config($default_toolchain)", |
| 911 ":$_headers_map_config($default_toolchain)", | 894 ":$_headers_map_config($default_toolchain)", |
| 912 ] | 895 ] |
| 913 | 896 |
| 914 if (!defined(deps)) { | 897 if (!defined(deps)) { |
| 915 deps = [] | 898 deps = [] |
| 916 } | |
| 917 deps += [ ":$_framework_headers_target($default_toolchain)" ] | |
| 918 } | 899 } |
| 900 deps += [ ":$_framework_headers_target($default_toolchain)" ] |
| 919 } | 901 } |
| 920 } else { | |
| 921 assert(_arch_shared_library_source != "", | |
| 922 "mark _arch_shared_library_source as used") | |
| 923 } | 902 } |
| 924 | 903 |
| 925 shared_library(_arch_shared_library_target) { | 904 shared_library(_arch_shared_library_target) { |
| 926 forward_variables_from(invoker, | 905 forward_variables_from(invoker, |
| 927 "*", | 906 "*", |
| 928 [ | 907 [ |
| 929 "bundle_deps", | 908 "bundle_deps", |
| 930 "bundle_deps_filter", | 909 "bundle_deps_filter", |
| 931 "data_deps", | 910 "data_deps", |
| 932 "enable_code_signing", | 911 "enable_code_signing", |
| 933 "info_plist", | 912 "info_plist", |
| 934 "info_plist_target", | 913 "info_plist_target", |
| 935 "output_name", | 914 "output_name", |
| 936 "sources", | 915 "sources", |
| 937 "visibility", | 916 "visibility", |
| 938 ]) | 917 ]) |
| 939 if (!_use_intermediate_source_set) { | |
| 940 forward_variables_from(invoker, [ "sources" ]) | |
| 941 } | |
| 942 | 918 |
| 943 visibility = [ ":$_lipo_shared_library_target($default_toolchain)" ] | 919 visibility = [ ":$_lipo_shared_library_target($default_toolchain)" ] |
| 944 if (current_toolchain != default_toolchain) { | 920 if (current_toolchain != default_toolchain) { |
| 945 visibility += [ ":$_target_name" ] | 921 visibility += [ ":$_target_name" ] |
| 946 } | 922 } |
| 947 | 923 |
| 948 if (!defined(deps)) { | 924 if (!defined(deps)) { |
| 949 deps = [] | 925 deps = [] |
| 950 } | 926 } |
| 951 if (_use_intermediate_source_set) { | 927 deps += [ ":$_arch_shared_library_source" ] |
| 952 deps += [ ":$_arch_shared_library_source" ] | |
| 953 } else { | |
| 954 if (_has_public_headers) { | |
| 955 configs += [ | |
| 956 ":$_framework_headers_config($default_toolchain)", | |
| 957 ":$_headers_map_config($default_toolchain)", | |
| 958 ] | |
| 959 | |
| 960 if (!defined(deps)) { | |
| 961 deps = [] | |
| 962 } | |
| 963 deps += [ ":$_framework_headers_target($default_toolchain)" ] | |
| 964 } | |
| 965 } | |
| 966 configs += [ ":$_install_name_config($default_toolchain)" ] | 928 configs += [ ":$_install_name_config($default_toolchain)" ] |
| 967 | 929 |
| 968 output_extension = "" | 930 output_extension = "" |
| 969 output_name = _output_name | 931 output_name = _output_name |
| 970 output_prefix_override = true | 932 output_prefix_override = true |
| 971 output_dir = "$target_out_dir/$current_cpu" | 933 output_dir = "$target_out_dir/$current_cpu" |
| 972 } | 934 } |
| 973 | 935 |
| 974 if (current_toolchain != default_toolchain) { | 936 if (current_toolchain != default_toolchain) { |
| 975 # For fat builds, only the default toolchain will generate a framework | 937 # For fat builds, only the default toolchain will generate a framework |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 "-rpath", | 1323 "-rpath", |
| 1362 "-Xlinker", | 1324 "-Xlinker", |
| 1363 "@loader_path/Frameworks", | 1325 "@loader_path/Frameworks", |
| 1364 ] | 1326 ] |
| 1365 } | 1327 } |
| 1366 } | 1328 } |
| 1367 | 1329 |
| 1368 set_defaults("ios_xctest_test") { | 1330 set_defaults("ios_xctest_test") { |
| 1369 configs = default_executable_configs | 1331 configs = default_executable_configs |
| 1370 } | 1332 } |
| OLD | NEW |