1#!/usr/bin/env python 2# 3# Copyright 2016 Google Inc. 4# 5# Use of this source code is governed by a BSD-style license that can be 6# found in the LICENSE file. 7 8# Generate Android.bp for Skia from GN configuration. 9 10from __future__ import print_function 11 12import os 13import pprint 14import string 15import subprocess 16import tempfile 17 18import skqp_gn_args 19import gn_to_bp_utils 20 21# First we start off with a template for Android.bp, 22# with holes for source lists and include directories. 23bp = string.Template('''// This file is autogenerated by gn_to_bp.py. 24// To make changes to this file, follow the instructions on skia.org for 25// downloading Skia and submitting changes. Modify gn_to_bp.py (or the build 26// files it uses) and submit. The autoroller will then create the updated 27// Android.bp. Or ask a Skia engineer for help. 28 29package { 30 default_applicable_licenses: ["external_skia_license"], 31} 32 33// Added automatically by a large-scale-change that took the approach of 34// 'apply every license found to every target'. While this makes sure we respect 35// every license restriction, it may not be entirely correct. 36// 37// e.g. GPL in an MIT project might only apply to the contrib/ directory. 38// 39// Please consider splitting the single license below into multiple licenses, 40// taking care not to lose any license_kind information, and overriding the 41// default license using the 'licenses: [...]' property on targets as needed. 42// 43// For unused files, consider creating a 'fileGroup' with "//visibility:private" 44// to attach the license to, and including a comment whether the files may be 45// used in the current project. 46// 47// large-scale-change included anything that looked like it might be a license 48// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. 49// 50// Please consider removing redundant or irrelevant files from 'license_text:'. 51// 52// large-scale-change filtered out the below license kinds as false-positives: 53// SPDX-license-identifier-CC-BY-NC 54// SPDX-license-identifier-GPL-2.0 55// SPDX-license-identifier-LGPL-2.1 56// SPDX-license-identifier-OFL:by_exception_only 57// See: http://go/android-license-faq 58license { 59 name: "external_skia_license", 60 visibility: [":__subpackages__"], 61 license_kinds: [ 62 "SPDX-license-identifier-Apache-2.0", 63 "SPDX-license-identifier-BSD", 64 "SPDX-license-identifier-CC0-1.0", 65 "SPDX-license-identifier-FTL", 66 "SPDX-license-identifier-MIT", 67 "legacy_unencumbered", 68 ], 69 license_text: [ 70 "LICENSE", 71 "NOTICE", 72 ], 73} 74 75cc_defaults { 76 name: "skia_arch_defaults", 77 arch: { 78 arm: { 79 srcs: [ 80 $arm_srcs 81 ], 82 83 neon: { 84 srcs: [ 85 $arm_neon_srcs 86 ], 87 }, 88 }, 89 90 arm64: { 91 srcs: [ 92 $arm64_srcs 93 ], 94 }, 95 96 x86: { 97 srcs: [ 98 $x86_srcs 99 ], 100 }, 101 102 x86_64: { 103 srcs: [ 104 $x86_srcs 105 ], 106 }, 107 }, 108 109 target: { 110 android: { 111 srcs: [ 112 "third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator.cpp", 113 ], 114 local_include_dirs: [ 115 "third_party/vulkanmemoryallocator/", 116 ], 117 }, 118 }, 119} 120 121cc_defaults { 122 name: "skia_defaults", 123 defaults: ["skia_arch_defaults"], 124 cflags: [ 125 $cflags 126 ], 127 128 cppflags:[ 129 $cflags_cc 130 ], 131 132 export_include_dirs: [ 133 $export_includes 134 ], 135 136 local_include_dirs: [ 137 $local_includes 138 ] 139} 140 141cc_library_static { 142 // Smaller version of Skia, without e.g. codecs, intended for use by RenderEngine. 143 name: "libskia_renderengine", 144 defaults: ["skia_defaults", 145 "skia_renderengine_deps"], 146 srcs: [ 147 $renderengine_srcs 148 ], 149 local_include_dirs: [ 150 "renderengine", 151 ], 152 export_include_dirs: [ 153 "renderengine", 154 ], 155} 156 157cc_library_static { 158 name: "libskia", 159 host_supported: true, 160 cppflags:[ 161 // Exceptions are necessary for SkRawCodec. 162 // FIXME: Should we split SkRawCodec into a separate target so the rest 163 // of Skia need not be compiled with exceptions? 164 "-fexceptions", 165 ], 166 167 srcs: [ 168 $srcs 169 ], 170 171 target: { 172 android: { 173 srcs: [ 174 $android_srcs 175 ], 176 local_include_dirs: [ 177 "android", 178 ], 179 export_include_dirs: [ 180 "android", 181 ], 182 }, 183 host_linux: { 184 srcs: [ 185 $linux_srcs 186 ], 187 local_include_dirs: [ 188 "linux", 189 ], 190 export_include_dirs: [ 191 "linux", 192 ], 193 }, 194 darwin: { 195 srcs: [ 196 $mac_srcs 197 ], 198 local_include_dirs: [ 199 "mac", 200 ], 201 export_include_dirs: [ 202 "mac", 203 ], 204 }, 205 windows: { 206 enabled: true, 207 cflags: [ 208 "-Wno-unknown-pragmas", 209 ], 210 srcs: [ 211 $win_srcs 212 ], 213 local_include_dirs: [ 214 "win", 215 ], 216 export_include_dirs: [ 217 "win", 218 ], 219 }, 220 }, 221 222 defaults: ["skia_deps", 223 "skia_defaults", 224 ], 225} 226 227cc_defaults { 228 // Subset of the larger "skia_deps", which includes only the dependencies 229 // needed for libskia_renderengine. Note that it includes libpng and libz 230 // for the purposes of MSKP captures, but we could instead leave it up to 231 // RenderEngine to provide its own SkSerializerProcs if another client 232 // wants an even smaller version of libskia. 233 name: "skia_renderengine_deps", 234 shared_libs: [ 235 "libcutils", 236 "liblog", 237 "libpng", 238 "libz", 239 ], 240 static_libs: [ 241 "libarect", 242 ], 243 target: { 244 android: { 245 shared_libs: [ 246 "libEGL", 247 "libGLESv2", 248 "libvulkan", 249 "libnativewindow", 250 ], 251 export_shared_lib_headers: [ 252 "libvulkan", 253 ], 254 }, 255 }, 256} 257 258cc_defaults { 259 name: "skia_deps", 260 defaults: ["skia_renderengine_deps"], 261 shared_libs: [ 262 "libdng_sdk", 263 "libjpeg", 264 "libpiex", 265 "libexpat", 266 "libft2", 267 ], 268 static_libs: [ 269 "libwebp-decode", 270 "libwebp-encode", 271 "libsfntly", 272 "libwuffs_mirror_release_c", 273 ], 274 target: { 275 android: { 276 shared_libs: [ 277 "libheif", 278 ], 279 }, 280 darwin: { 281 host_ldlibs: [ 282 "-framework AppKit", 283 ], 284 }, 285 windows: { 286 host_ldlibs: [ 287 "-lgdi32", 288 "-loleaut32", 289 "-lole32", 290 "-lopengl32", 291 "-luuid", 292 "-lwindowscodecs", 293 ], 294 }, 295 }, 296} 297 298cc_defaults { 299 name: "skia_tool_deps", 300 defaults: [ 301 "skia_deps", 302 ], 303 shared_libs: [ 304 "libicu", 305 "libharfbuzz_ng", 306 ], 307 static_libs: [ 308 "libskia", 309 ], 310 cflags: [ 311 "-DSK_SHAPER_HARFBUZZ_AVAILABLE", 312 "-DSK_UNICODE_AVAILABLE", 313 "-Wno-implicit-fallthrough", 314 "-Wno-unused-parameter", 315 "-Wno-unused-variable", 316 ], 317 target: { 318 windows: { 319 enabled: true, 320 }, 321 }, 322 323 data: [ 324 "resources/**/*", 325 ], 326} 327 328cc_defaults { 329 name: "skia_gm_srcs", 330 local_include_dirs: [ 331 $gm_includes 332 ], 333 334 srcs: [ 335 $gm_srcs 336 ], 337} 338 339cc_defaults { 340 name: "skia_test_minus_gm_srcs", 341 local_include_dirs: [ 342 $test_minus_gm_includes 343 ], 344 345 srcs: [ 346 $test_minus_gm_srcs 347 ], 348} 349 350cc_test { 351 name: "skia_dm", 352 353 defaults: [ 354 "skia_gm_srcs", 355 "skia_test_minus_gm_srcs", 356 "skia_tool_deps", 357 ], 358 359 local_include_dirs: [ 360 $dm_includes 361 ], 362 363 srcs: [ 364 $dm_srcs 365 ], 366 367 shared_libs: [ 368 "libbinder", 369 "libutils", 370 ], 371} 372 373cc_test { 374 name: "skia_nanobench", 375 376 defaults: [ 377 "skia_gm_srcs", 378 "skia_tool_deps" 379 ], 380 381 local_include_dirs: [ 382 $nanobench_includes 383 ], 384 385 srcs: [ 386 $nanobench_srcs 387 ], 388 389 lto: { 390 never: true, 391 }, 392} 393 394cc_library_shared { 395 name: "libskqp_jni", 396 sdk_version: "$skqp_sdk_version", 397 stl: "libc++_static", 398 compile_multilib: "both", 399 400 defaults: [ 401 "skia_arch_defaults", 402 ], 403 404 cflags: [ 405 $skqp_cflags 406 "-Wno-unused-parameter", 407 "-Wno-unused-variable", 408 ], 409 410 cppflags:[ 411 $skqp_cflags_cc 412 ], 413 414 local_include_dirs: [ 415 "skqp", 416 $skqp_includes 417 ], 418 419 export_include_dirs: [ 420 "skqp", 421 ], 422 423 srcs: [ 424 $skqp_srcs 425 ], 426 427 header_libs: ["jni_headers"], 428 429 shared_libs: [ 430 "libandroid", 431 "libEGL", 432 "libGLESv2", 433 "liblog", 434 "libvulkan", 435 "libz", 436 ], 437 static_libs: [ 438 "libexpat", 439 "libjpeg_static_ndk", 440 "libpng_ndk", 441 "libwebp-decode", 442 "libwebp-encode", 443 "libwuffs_mirror_release_c", 444 ] 445} 446 447android_test { 448 name: "CtsSkQPTestCases", 449 defaults: ["cts_defaults"], 450 test_suites: ["cts"], 451 452 libs: ["android.test.runner.stubs"], 453 jni_libs: ["libskqp_jni"], 454 compile_multilib: "both", 455 456 static_libs: [ 457 "android-support-design", 458 "ctstestrunner-axt", 459 ], 460 manifest: "platform_tools/android/apps/skqp/src/main/AndroidManifest.xml", 461 test_config: "platform_tools/android/apps/skqp/src/main/AndroidTest.xml", 462 463 asset_dirs: ["platform_tools/android/apps/skqp/src/main/assets", "resources"], 464 resource_dirs: ["platform_tools/android/apps/skqp/src/main/res"], 465 srcs: ["platform_tools/android/apps/skqp/src/main/java/**/*.java"], 466 467 sdk_version: "test_current", 468 469} 470''') 471 472# We'll run GN to get the main source lists and include directories for Skia. 473def generate_args(target_os, enable_gpu, renderengine = False): 474 d = { 475 'is_official_build': 'true', 476 477 # gn_to_bp_utils' GetArchSources will take care of architecture-specific 478 # files. 479 'target_cpu': '"none"', 480 481 # Use the custom FontMgr, as the framework will handle fonts. 482 'skia_enable_fontmgr_custom_directory': 'false', 483 'skia_enable_fontmgr_custom_embedded': 'false', 484 'skia_enable_fontmgr_android': 'false', 485 'skia_enable_fontmgr_win': 'false', 486 'skia_enable_fontmgr_win_gdi': 'false', 487 'skia_use_fonthost_mac': 'false', 488 489 # enable features used in skia_nanobench 490 'skia_tools_require_resources': 'true', 491 492 'skia_use_fontconfig': 'false', 493 'skia_include_multiframe_procs': 'false', 494 } 495 d['target_os'] = target_os 496 if target_os == '"android"': 497 d['skia_enable_tools'] = 'true' 498 d['skia_include_multiframe_procs'] = 'true' 499 500 if enable_gpu: 501 d['skia_use_vulkan'] = 'true' 502 else: 503 d['skia_use_vulkan'] = 'false' 504 d['skia_enable_gpu'] = 'false' 505 506 if target_os == '"win"': 507 # The Android Windows build system does not provide FontSub.h 508 d['skia_use_xps'] = 'false' 509 510 # BUILDCONFIG.gn expects these to be set when building for Windows, but 511 # we're just creating Android.bp, so we don't need them. Populate with 512 # some placeholder values. 513 d['win_vc'] = '"placeholder_version"' 514 d['win_sdk_version'] = '"placeholder_version"' 515 d['win_toolchain_version'] = '"placeholder_version"' 516 517 if target_os == '"android"' and not renderengine: 518 d['skia_use_libheif'] = 'true' 519 else: 520 d['skia_use_libheif'] = 'false' 521 522 if renderengine: 523 d['skia_use_libpng_decode'] = 'false' 524 d['skia_use_libjpeg_turbo_decode'] = 'false' 525 d['skia_use_libjpeg_turbo_encode'] = 'false' 526 d['skia_use_libwebp_decode'] = 'false' 527 d['skia_use_libwebp_encode'] = 'false' 528 d['skia_use_libgifcodec'] = 'false' 529 d['skia_enable_pdf'] = 'false' 530 d['skia_use_freetype'] = 'false' 531 d['skia_use_fixed_gamma_text'] = 'false' 532 d['skia_use_expat'] = 'false' 533 d['skia_enable_fontmgr_custom_empty'] = 'false' 534 else: 535 d['skia_enable_android_utils'] = 'true' 536 d['skia_use_freetype'] = 'true' 537 d['skia_use_fixed_gamma_text'] = 'true' 538 d['skia_enable_fontmgr_custom_empty'] = 'true' 539 d['skia_use_wuffs'] = 'true' 540 541 return d 542 543gn_args = generate_args('"android"', True) 544gn_args_linux = generate_args('"linux"', False) 545gn_args_mac = generate_args('"mac"', False) 546gn_args_win = generate_args('"win"', False) 547gn_args_renderengine = generate_args('"android"', True, True) 548 549js = gn_to_bp_utils.GenerateJSONFromGN(gn_args) 550 551def strip_slashes(lst): 552 return {str(p.lstrip('/')) for p in lst} 553 554android_srcs = strip_slashes(js['targets']['//:skia']['sources']) 555cflags = strip_slashes(js['targets']['//:skia']['cflags']) 556cflags_cc = strip_slashes(js['targets']['//:skia']['cflags_cc']) 557local_includes = strip_slashes(js['targets']['//:skia']['include_dirs']) 558export_includes = strip_slashes(js['targets']['//:public']['include_dirs']) 559 560gm_srcs = strip_slashes(js['targets']['//:gm']['sources']) 561gm_includes = strip_slashes(js['targets']['//:gm']['include_dirs']) 562 563test_srcs = strip_slashes(js['targets']['//:tests']['sources']) 564test_includes = strip_slashes(js['targets']['//:tests']['include_dirs']) 565 566dm_srcs = strip_slashes(js['targets']['//:dm']['sources']) 567dm_includes = strip_slashes(js['targets']['//:dm']['include_dirs']) 568 569nanobench_target = js['targets']['//:nanobench'] 570nanobench_srcs = strip_slashes(nanobench_target['sources']) 571nanobench_includes = strip_slashes(nanobench_target['include_dirs']) 572 573 574gn_to_bp_utils.GrabDependentValues(js, '//:gm', 'sources', gm_srcs, '//:skia') 575gn_to_bp_utils.GrabDependentValues(js, '//:tests', 'sources', test_srcs, '//:skia') 576gn_to_bp_utils.GrabDependentValues(js, '//:dm', 'sources', 577 dm_srcs, ['//:skia', '//:gm', '//:tests']) 578gn_to_bp_utils.GrabDependentValues(js, '//:nanobench', 'sources', 579 nanobench_srcs, ['//:skia', '//:gm']) 580 581# skcms is a little special, kind of a second-party library. 582local_includes.add("include/third_party/skcms") 583gm_includes .add("include/third_party/skcms") 584 585# Android's build will choke if we list headers. 586def strip_headers(sources): 587 return {s for s in sources if not s.endswith('.h')} 588 589gn_to_bp_utils.GrabDependentValues(js, '//:skia', 'sources', android_srcs, None) 590android_srcs = strip_headers(android_srcs) 591 592js_linux = gn_to_bp_utils.GenerateJSONFromGN(gn_args_linux) 593linux_srcs = strip_slashes(js_linux['targets']['//:skia']['sources']) 594gn_to_bp_utils.GrabDependentValues(js_linux, '//:skia', 'sources', linux_srcs, 595 None) 596linux_srcs = strip_headers(linux_srcs) 597 598js_mac = gn_to_bp_utils.GenerateJSONFromGN(gn_args_mac) 599mac_srcs = strip_slashes(js_mac['targets']['//:skia']['sources']) 600gn_to_bp_utils.GrabDependentValues(js_mac, '//:skia', 'sources', mac_srcs, 601 None) 602mac_srcs = strip_headers(mac_srcs) 603 604js_win = gn_to_bp_utils.GenerateJSONFromGN(gn_args_win) 605win_srcs = strip_slashes(js_win['targets']['//:skia']['sources']) 606gn_to_bp_utils.GrabDependentValues(js_win, '//:skia', 'sources', win_srcs, 607 None) 608win_srcs = strip_headers(win_srcs) 609 610srcs = android_srcs.intersection(linux_srcs).intersection(mac_srcs) 611srcs = srcs.intersection(win_srcs) 612android_srcs = android_srcs.difference(srcs) 613linux_srcs = linux_srcs.difference(srcs) 614mac_srcs = mac_srcs.difference(srcs) 615win_srcs = win_srcs.difference(srcs) 616 617gm_srcs = strip_headers(gm_srcs) 618test_srcs = strip_headers(test_srcs) 619dm_srcs = strip_headers(dm_srcs).difference(gm_srcs).difference(test_srcs) 620nanobench_srcs = strip_headers(nanobench_srcs).difference(gm_srcs) 621 622test_minus_gm_includes = test_includes.difference(gm_includes) 623test_minus_gm_srcs = test_srcs.difference(gm_srcs) 624 625cflags = gn_to_bp_utils.CleanupCFlags(cflags) 626cflags_cc = gn_to_bp_utils.CleanupCCFlags(cflags_cc) 627 628# Execute GN for specialized RenderEngine target 629js_renderengine = gn_to_bp_utils.GenerateJSONFromGN(gn_args_renderengine) 630renderengine_srcs = strip_slashes( 631 js_renderengine['targets']['//:skia']['sources']) 632gn_to_bp_utils.GrabDependentValues(js_renderengine, '//:skia', 'sources', 633 renderengine_srcs, None) 634renderengine_srcs = strip_headers(renderengine_srcs) 635 636# Execute GN for specialized SkQP target 637skqp_sdk_version = 26 638js_skqp = gn_to_bp_utils.GenerateJSONFromGN(skqp_gn_args.GetGNArgs(api_level=skqp_sdk_version, 639 debug=False, 640 is_android_bp=True)) 641skqp_srcs = strip_slashes(js_skqp['targets']['//:libskqp_app']['sources']) 642skqp_includes = strip_slashes(js_skqp['targets']['//:libskqp_app']['include_dirs']) 643skqp_cflags = strip_slashes(js_skqp['targets']['//:libskqp_app']['cflags']) 644skqp_cflags_cc = strip_slashes(js_skqp['targets']['//:libskqp_app']['cflags_cc']) 645skqp_defines = strip_slashes(js_skqp['targets']['//:libskqp_app']['defines']) 646 647skqp_includes.update(strip_slashes(js_skqp['targets']['//:public']['include_dirs'])) 648 649gn_to_bp_utils.GrabDependentValues(js_skqp, '//:libskqp_app', 'sources', 650 skqp_srcs, None) 651gn_to_bp_utils.GrabDependentValues(js_skqp, '//:libskqp_app', 'include_dirs', 652 skqp_includes, ['//:gif']) 653gn_to_bp_utils.GrabDependentValues(js_skqp, '//:libskqp_app', 'cflags', 654 skqp_cflags, None) 655gn_to_bp_utils.GrabDependentValues(js_skqp, '//:libskqp_app', 'cflags_cc', 656 skqp_cflags_cc, None) 657gn_to_bp_utils.GrabDependentValues(js_skqp, '//:libskqp_app', 'defines', 658 skqp_defines, None) 659 660skqp_defines.add("SK_ENABLE_DUMP_GPU") 661skqp_defines.add("SK_BUILD_FOR_SKQP") 662skqp_defines.add("SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1") 663 664skqp_srcs = strip_headers(skqp_srcs) 665skqp_cflags = gn_to_bp_utils.CleanupCFlags(skqp_cflags) 666skqp_cflags_cc = gn_to_bp_utils.CleanupCCFlags(skqp_cflags_cc) 667 668here = os.path.dirname(__file__) 669defs = gn_to_bp_utils.GetArchSources(os.path.join(here, 'opts.gni')) 670 671def get_defines(json): 672 return {str(d) for d in json['targets']['//:skia']['defines']} 673android_defines = get_defines(js) 674linux_defines = get_defines(js_linux) 675mac_defines = get_defines(js_mac) 676win_defines = get_defines(js_win) 677renderengine_defines = get_defines(js_renderengine) 678renderengine_defines.add('SK_IN_RENDERENGINE') 679 680def mkdir_if_not_exists(path): 681 if not os.path.exists(path): 682 os.makedirs(path) 683mkdir_if_not_exists('android/include/config/') 684mkdir_if_not_exists('linux/include/config/') 685mkdir_if_not_exists('mac/include/config/') 686mkdir_if_not_exists('win/include/config/') 687mkdir_if_not_exists('renderengine/include/config/') 688mkdir_if_not_exists('skqp/include/config/') 689 690platforms = { 'IOS', 'MAC', 'WIN', 'ANDROID', 'UNIX' } 691 692def disallow_platforms(config, desired): 693 with open(config, 'a') as f: 694 p = sorted(platforms.difference({ desired })) 695 s = '#if ' 696 for i in range(len(p)): 697 s = s + 'defined(SK_BUILD_FOR_%s)' % p[i] 698 if i < len(p) - 1: 699 s += ' || ' 700 if i % 2 == 1: 701 s += '\\\n ' 702 print(s, file=f) 703 print(' #error "Only SK_BUILD_FOR_%s should be defined!"' % desired, file=f) 704 print('#endif', file=f) 705 706def append_to_file(config, s): 707 with open(config, 'a') as f: 708 print(s, file=f) 709 710def write_android_config(config_path, defines, isNDKConfig = False): 711 gn_to_bp_utils.WriteUserConfig(config_path, defines) 712 append_to_file(config_path, ''' 713#ifndef SK_BUILD_FOR_ANDROID 714 #error "SK_BUILD_FOR_ANDROID must be defined!" 715#endif''') 716 disallow_platforms(config_path, 'ANDROID') 717 718 if isNDKConfig: 719 append_to_file(config_path, ''' 720#undef SK_BUILD_FOR_ANDROID_FRAMEWORK''') 721 722write_android_config('android/include/config/SkUserConfig.h', android_defines) 723write_android_config('renderengine/include/config/SkUserConfig.h', renderengine_defines) 724write_android_config('skqp/include/config/SkUserConfig.h', skqp_defines, True) 725 726def write_config(config_path, defines, platform): 727 gn_to_bp_utils.WriteUserConfig(config_path, defines) 728 append_to_file(config_path, ''' 729// Correct SK_BUILD_FOR flags that may have been set by 730// SkTypes.h/Android.bp 731#ifndef SK_BUILD_FOR_%s 732 #define SK_BUILD_FOR_%s 733#endif 734#ifdef SK_BUILD_FOR_ANDROID 735 #undef SK_BUILD_FOR_ANDROID 736#endif''' % (platform, platform)) 737 disallow_platforms(config_path, platform) 738 739write_config('linux/include/config/SkUserConfig.h', linux_defines, 'UNIX') 740write_config('mac/include/config/SkUserConfig.h', mac_defines, 'MAC') 741write_config('win/include/config/SkUserConfig.h', win_defines, 'WIN') 742 743# Turn a list of strings into the style bpfmt outputs. 744def bpfmt(indent, lst, sort=True): 745 if sort: 746 lst = sorted(lst) 747 return ('\n' + ' '*indent).join('"%s",' % v for v in lst) 748 749# OK! We have everything to fill in Android.bp... 750with open('Android.bp', 'w') as Android_bp: 751 print(bp.substitute({ 752 'export_includes': bpfmt(8, export_includes), 753 'local_includes': bpfmt(8, local_includes), 754 'srcs': bpfmt(8, srcs), 755 'cflags': bpfmt(8, cflags, False), 756 'cflags_cc': bpfmt(8, cflags_cc), 757 758 'arm_srcs': bpfmt(16, strip_headers(defs['armv7'])), 759 'arm_neon_srcs': bpfmt(20, strip_headers(defs['neon'])), 760 'arm64_srcs': bpfmt(16, strip_headers(defs['arm64'] + 761 defs['crc32'])), 762 'x86_srcs': bpfmt(16, strip_headers(defs['sse2'] + 763 defs['ssse3'] + 764 defs['sse41'] + 765 defs['sse42'] + 766 defs['avx' ] + 767 defs['hsw' ] + 768 defs['skx' ])), 769 770 'gm_includes' : bpfmt(8, gm_includes), 771 'gm_srcs' : bpfmt(8, gm_srcs), 772 773 'test_minus_gm_includes' : bpfmt(8, test_minus_gm_includes), 774 'test_minus_gm_srcs' : bpfmt(8, test_minus_gm_srcs), 775 776 'dm_includes' : bpfmt(8, dm_includes), 777 'dm_srcs' : bpfmt(8, dm_srcs), 778 779 'nanobench_includes' : bpfmt(8, nanobench_includes), 780 'nanobench_srcs' : bpfmt(8, nanobench_srcs), 781 782 'skqp_sdk_version': skqp_sdk_version, 783 'skqp_includes': bpfmt(8, skqp_includes), 784 'skqp_srcs': bpfmt(8, skqp_srcs), 785 'skqp_cflags': bpfmt(8, skqp_cflags, False), 786 'skqp_cflags_cc': bpfmt(8, skqp_cflags_cc), 787 788 'android_srcs': bpfmt(10, android_srcs), 789 'linux_srcs': bpfmt(10, linux_srcs), 790 'mac_srcs': bpfmt(10, mac_srcs), 791 'win_srcs': bpfmt(10, win_srcs), 792 793 'renderengine_srcs': bpfmt(8, renderengine_srcs), 794 }), file=Android_bp) 795