| 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 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
| 9 | 9 |
| 10 # Invokes lipo on multiple arch-specific binaries to create a fat binary. | 10 # Invokes lipo on multiple arch-specific binaries to create a fat binary. |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 template("ios_framework_bundle") { | 990 template("ios_framework_bundle") { |
| 991 _target_name = target_name | 991 _target_name = target_name |
| 992 _output_name = target_name | 992 _output_name = target_name |
| 993 if (defined(invoker.output_name)) { | 993 if (defined(invoker.output_name)) { |
| 994 _output_name = invoker.output_name | 994 _output_name = invoker.output_name |
| 995 } | 995 } |
| 996 | 996 |
| 997 _has_public_headers = | 997 _has_public_headers = |
| 998 defined(invoker.public_headers) && invoker.public_headers != [] | 998 defined(invoker.public_headers) && invoker.public_headers != [] |
| 999 | 999 |
| 1000 # Public configs are not propagated across toolchain (see crbug.com/675224) |
| 1001 # so some configs have to be defined for both default_toolchain and all others |
| 1002 # toolchains when performing a fat build. Use "get_label_info" to construct |
| 1003 # the path since they need to be relative to the default_toolchain. |
| 1004 |
| 1005 _default_toolchain_root_out_dir = |
| 1006 get_label_info("$_target_name($default_toolchain)", "root_out_dir") |
| 1007 _default_toolchain_target_gen_dir = |
| 1008 get_label_info("$_target_name($default_toolchain)", "target_gen_dir") |
| 1009 |
| 1000 if (_has_public_headers) { | 1010 if (_has_public_headers) { |
| 1001 _framework_headers_target = _target_name + "_framework_headers" | 1011 _framework_headers_target = _target_name + "_framework_headers" |
| 1002 _framework_headers_config = _target_name + "_framework_headers_config" | 1012 _framework_headers_config = _target_name + "_framework_headers_config" |
| 1013 config(_framework_headers_config) { |
| 1014 # The link settings are inherited from the framework_bundle config. |
| 1015 cflags = [ |
| 1016 "-F", |
| 1017 rebase_path("$_default_toolchain_root_out_dir/.", root_build_dir), |
| 1018 ] |
| 1019 } |
| 1020 |
| 1003 _headers_map_config = _target_name + "_headers_map" | 1021 _headers_map_config = _target_name + "_headers_map" |
| 1022 _header_map_filename = |
| 1023 "$_default_toolchain_target_gen_dir/$_output_name.headers.hmap" |
| 1024 config(_headers_map_config) { |
| 1025 visibility = [ ":$_target_name" ] |
| 1026 include_dirs = [ _header_map_filename ] |
| 1027 } |
| 1004 } | 1028 } |
| 1005 | 1029 |
| 1006 _arch_shared_library_source = _target_name + "_arch_shared_library_sources" | 1030 _arch_shared_library_source = _target_name + "_arch_shared_library_sources" |
| 1007 _arch_shared_library_target = _target_name + "_arch_shared_library" | 1031 _arch_shared_library_target = _target_name + "_arch_shared_library" |
| 1008 _lipo_shared_library_target = _target_name + "_shared_library" | 1032 _lipo_shared_library_target = _target_name + "_shared_library" |
| 1033 _link_target_name = _target_name + "+link" |
| 1034 |
| 1035 _framework_public_config = _target_name + "_public_config" |
| 1036 config(_framework_public_config) { |
| 1037 # TODO(sdefresne): should we have a framework_dirs similar to lib_dirs |
| 1038 # and include_dirs to avoid duplicate values on the command-line. |
| 1039 visibility = [ ":$_target_name" ] |
| 1040 ldflags = [ |
| 1041 "-F", |
| 1042 rebase_path("$_default_toolchain_root_out_dir/.", root_build_dir), |
| 1043 ] |
| 1044 lib_dirs = [ root_out_dir ] |
| 1045 libs = [ "$_output_name.framework" ] |
| 1046 } |
| 1009 | 1047 |
| 1010 source_set(_arch_shared_library_source) { | 1048 source_set(_arch_shared_library_source) { |
| 1011 forward_variables_from(invoker, | 1049 forward_variables_from(invoker, |
| 1012 "*", | 1050 "*", |
| 1013 [ | 1051 [ |
| 1014 "bundle_deps", | 1052 "bundle_deps", |
| 1015 "bundle_deps_filter", | 1053 "bundle_deps_filter", |
| 1016 "data_deps", | 1054 "data_deps", |
| 1017 "enable_code_signing", | 1055 "enable_code_signing", |
| 1018 "info_plist", | 1056 "info_plist", |
| 1019 "info_plist_target", | 1057 "info_plist_target", |
| 1020 "output_name", | 1058 "output_name", |
| 1021 "visibility", | 1059 "visibility", |
| 1022 ]) | 1060 ]) |
| 1023 | 1061 |
| 1024 visibility = [ ":$_arch_shared_library_target" ] | 1062 visibility = [ ":$_arch_shared_library_target" ] |
| 1025 | 1063 |
| 1026 if (_has_public_headers) { | 1064 if (_has_public_headers) { |
| 1027 configs += [ | 1065 configs += [ |
| 1028 ":$_framework_headers_config($default_toolchain)", | 1066 ":$_framework_headers_config", |
| 1029 ":$_headers_map_config($default_toolchain)", | 1067 ":$_headers_map_config", |
| 1030 ] | 1068 ] |
| 1031 | 1069 |
| 1032 if (!defined(deps)) { | 1070 if (!defined(deps)) { |
| 1033 deps = [] | 1071 deps = [] |
| 1034 } | 1072 } |
| 1035 deps += [ ":$_framework_headers_target($default_toolchain)" ] | 1073 deps += [ ":$_framework_headers_target($default_toolchain)" ] |
| 1036 } | 1074 } |
| 1037 } | 1075 } |
| 1038 | 1076 |
| 1039 shared_library(_arch_shared_library_target) { | 1077 shared_library(_arch_shared_library_target) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 forward_variables_from(invoker, | 1128 forward_variables_from(invoker, |
| 1091 [ | 1129 [ |
| 1092 "visibility", | 1130 "visibility", |
| 1093 "testonly", | 1131 "testonly", |
| 1094 ]) | 1132 ]) |
| 1095 public_deps = [ | 1133 public_deps = [ |
| 1096 ":$_arch_shared_library_target", | 1134 ":$_arch_shared_library_target", |
| 1097 ] | 1135 ] |
| 1098 } | 1136 } |
| 1099 | 1137 |
| 1100 group(_target_name + "+link") { | 1138 group(_link_target_name) { |
| 1101 forward_variables_from(invoker, | 1139 forward_variables_from(invoker, |
| 1102 [ | 1140 [ |
| 1141 "public_configs", |
| 1103 "visibility", | 1142 "visibility", |
| 1104 "testonly", | 1143 "testonly", |
| 1105 ]) | 1144 ]) |
| 1106 public_deps = [ | 1145 public_deps = [ |
| 1107 ":$_target_name+link($default_toolchain)", | 1146 ":$_link_target_name($default_toolchain)", |
| 1108 ] | 1147 ] |
| 1148 |
| 1149 if (!defined(public_configs)) { |
| 1150 public_configs = [] |
| 1151 } |
| 1152 public_configs += [ ":$_framework_public_config" ] |
| 1153 if (_has_public_headers) { |
| 1154 public_configs += [ ":$_framework_headers_config" ] |
| 1155 } |
| 1109 } | 1156 } |
| 1110 | 1157 |
| 1111 if (defined(invoker.bundle_deps)) { | 1158 if (defined(invoker.bundle_deps)) { |
| 1112 assert(invoker.bundle_deps != [], "mark bundle_deps as used") | 1159 assert(invoker.bundle_deps != [], "mark bundle_deps as used") |
| 1113 } | 1160 } |
| 1114 } else { | 1161 } else { |
| 1115 if (_has_public_headers) { | 1162 if (_has_public_headers) { |
| 1116 _public_headers = invoker.public_headers | 1163 _public_headers = invoker.public_headers |
| 1117 _framework_root = "$root_out_dir/$_output_name.framework" | 1164 _framework_root = "$root_out_dir/$_output_name.framework" |
| 1118 | 1165 |
| 1119 _header_map_filename = "$target_gen_dir/$_output_name.headers.hmap" | |
| 1120 | |
| 1121 _compile_headers_map_target = _target_name + "_compile_headers_map" | 1166 _compile_headers_map_target = _target_name + "_compile_headers_map" |
| 1122 action(_compile_headers_map_target) { | 1167 action(_compile_headers_map_target) { |
| 1123 visibility = [ ":$_framework_headers_target" ] | 1168 visibility = [ ":$_framework_headers_target" ] |
| 1124 script = "//build/config/ios/write_framework_hmap.py" | 1169 script = "//build/config/ios/write_framework_hmap.py" |
| 1125 outputs = [ | 1170 outputs = [ |
| 1126 _header_map_filename, | 1171 _header_map_filename, |
| 1127 ] | 1172 ] |
| 1128 | 1173 |
| 1129 # The header map generation only wants the list of headers, not all of | 1174 # The header map generation only wants the list of headers, not all of |
| 1130 # sources, so filter any non-header source files from "sources". It is | 1175 # sources, so filter any non-header source files from "sources". It is |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1158 | 1203 |
| 1159 _copy_public_headers_target = _target_name + "_copy_public_headers" | 1204 _copy_public_headers_target = _target_name + "_copy_public_headers" |
| 1160 copy(_copy_public_headers_target) { | 1205 copy(_copy_public_headers_target) { |
| 1161 visibility = [ ":$_framework_headers_target" ] | 1206 visibility = [ ":$_framework_headers_target" ] |
| 1162 sources = _public_headers | 1207 sources = _public_headers |
| 1163 outputs = [ | 1208 outputs = [ |
| 1164 "$_framework_root/Headers/{{source_file_part}}", | 1209 "$_framework_root/Headers/{{source_file_part}}", |
| 1165 ] | 1210 ] |
| 1166 } | 1211 } |
| 1167 | 1212 |
| 1168 config(_headers_map_config) { | |
| 1169 visibility = [ ":$_target_name" ] | |
| 1170 include_dirs = [ _header_map_filename ] | |
| 1171 } | |
| 1172 | |
| 1173 group(_framework_headers_target) { | 1213 group(_framework_headers_target) { |
| 1174 deps = [ | 1214 deps = [ |
| 1175 ":$_compile_headers_map_target", | 1215 ":$_compile_headers_map_target", |
| 1176 ":$_copy_public_headers_target", | 1216 ":$_copy_public_headers_target", |
| 1177 ":$_create_module_map_target", | 1217 ":$_create_module_map_target", |
| 1178 ] | 1218 ] |
| 1179 } | 1219 } |
| 1180 | |
| 1181 config(_framework_headers_config) { | |
| 1182 # The link settings are inherited from the framework_bundle config. | |
| 1183 cflags = [ | |
| 1184 "-F", | |
| 1185 rebase_path("$root_out_dir/.", root_build_dir), | |
| 1186 ] | |
| 1187 } | |
| 1188 } | 1220 } |
| 1189 | 1221 |
| 1190 lipo_binary(_lipo_shared_library_target) { | 1222 lipo_binary(_lipo_shared_library_target) { |
| 1191 forward_variables_from(invoker, | 1223 forward_variables_from(invoker, |
| 1192 [ | 1224 [ |
| 1193 "configs", | 1225 "configs", |
| 1194 "testonly", | 1226 "testonly", |
| 1195 ]) | 1227 ]) |
| 1196 | 1228 |
| 1197 visibility = [ ":$_target_name" ] | 1229 visibility = [ ":$_target_name" ] |
| 1198 output_name = _output_name | 1230 output_name = _output_name |
| 1199 arch_binary_target = ":$_arch_shared_library_target" | 1231 arch_binary_target = ":$_arch_shared_library_target" |
| 1200 arch_binary_output = _output_name | 1232 arch_binary_output = _output_name |
| 1201 } | 1233 } |
| 1202 | 1234 |
| 1203 _framework_public_config = _target_name + "_public_config" | |
| 1204 config(_framework_public_config) { | |
| 1205 # TODO(sdefresne): should we have a framework_dirs similar to lib_dirs | |
| 1206 # and include_dirs to avoid duplicate values on the command-line. | |
| 1207 visibility = [ ":$_target_name" ] | |
| 1208 ldflags = [ | |
| 1209 "-F", | |
| 1210 rebase_path("$root_out_dir/.", root_build_dir), | |
| 1211 ] | |
| 1212 lib_dirs = [ root_out_dir ] | |
| 1213 libs = [ "$_output_name.framework" ] | |
| 1214 } | |
| 1215 | |
| 1216 _info_plist_target = _target_name + "_info_plist" | 1235 _info_plist_target = _target_name + "_info_plist" |
| 1217 _info_plist_bundle = _target_name + "_info_plist_bundle" | 1236 _info_plist_bundle = _target_name + "_info_plist_bundle" |
| 1218 ios_info_plist(_info_plist_target) { | 1237 ios_info_plist(_info_plist_target) { |
| 1219 visibility = [ ":$_info_plist_bundle" ] | 1238 visibility = [ ":$_info_plist_bundle" ] |
| 1220 executable_name = _output_name | 1239 executable_name = _output_name |
| 1221 forward_variables_from(invoker, | 1240 forward_variables_from(invoker, |
| 1222 [ | 1241 [ |
| 1223 "extra_substitutions", | 1242 "extra_substitutions", |
| 1224 "info_plist", | 1243 "info_plist", |
| 1225 "info_plist_target", | 1244 "info_plist_target", |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 output_name = _output_name | 1277 output_name = _output_name |
| 1259 bundle_binary_target = ":$_lipo_shared_library_target" | 1278 bundle_binary_target = ":$_lipo_shared_library_target" |
| 1260 bundle_binary_output = _output_name | 1279 bundle_binary_output = _output_name |
| 1261 | 1280 |
| 1262 if (!defined(deps)) { | 1281 if (!defined(deps)) { |
| 1263 deps = [] | 1282 deps = [] |
| 1264 } | 1283 } |
| 1265 deps += [ ":$_info_plist_bundle" ] | 1284 deps += [ ":$_info_plist_bundle" ] |
| 1266 } | 1285 } |
| 1267 | 1286 |
| 1268 group(_target_name + "+link") { | 1287 group(_link_target_name) { |
| 1269 forward_variables_from(invoker, | 1288 forward_variables_from(invoker, |
| 1270 [ | 1289 [ |
| 1290 "public_configs", |
| 1271 "public_deps", | 1291 "public_deps", |
| 1272 "public_configs", | |
| 1273 "testonly", | 1292 "testonly", |
| 1274 "visibility", | 1293 "visibility", |
| 1275 ]) | 1294 ]) |
| 1276 if (!defined(public_deps)) { | 1295 if (!defined(public_deps)) { |
| 1277 public_deps = [] | 1296 public_deps = [] |
| 1278 } | 1297 } |
| 1279 public_deps += [ ":$_target_name" ] | 1298 public_deps += [ ":$_target_name" ] |
| 1299 |
| 1280 if (!defined(public_configs)) { | 1300 if (!defined(public_configs)) { |
| 1281 public_configs = [] | 1301 public_configs = [] |
| 1282 } | 1302 } |
| 1283 public_configs += [ ":$_framework_public_config" ] | 1303 public_configs += [ ":$_framework_public_config" ] |
| 1284 | |
| 1285 if (_has_public_headers) { | 1304 if (_has_public_headers) { |
| 1286 public_configs += [ ":$_framework_headers_config" ] | 1305 public_configs += [ ":$_framework_headers_config" ] |
| 1287 } | 1306 } |
| 1288 } | 1307 } |
| 1289 | 1308 |
| 1290 bundle_data(_target_name + "+bundle") { | 1309 bundle_data(_target_name + "+bundle") { |
| 1291 forward_variables_from(invoker, | 1310 forward_variables_from(invoker, |
| 1292 [ | 1311 [ |
| 1293 "testonly", | 1312 "testonly", |
| 1294 "visibility", | 1313 "visibility", |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 "-rpath", | 1483 "-rpath", |
| 1465 "-Xlinker", | 1484 "-Xlinker", |
| 1466 "@loader_path/Frameworks", | 1485 "@loader_path/Frameworks", |
| 1467 ] | 1486 ] |
| 1468 } | 1487 } |
| 1469 } | 1488 } |
| 1470 | 1489 |
| 1471 set_defaults("ios_xctest_test") { | 1490 set_defaults("ios_xctest_test") { |
| 1472 configs = default_executable_configs | 1491 configs = default_executable_configs |
| 1473 } | 1492 } |
| OLD | NEW |