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