BUILD.gn 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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
  3. # found in the LICENSE file.
  4. import("//build/config/android/abi.gni")
  5. import("//build/config/sysroot.gni")
  6. import("//build/partitioned_shared_library.gni")
  7. import("//chromecast/chromecast.gni")
  8. import("//media/media_options.gni")
  9. # These targets shall only be referenced on Android builds.
  10. assert(is_android)
  11. # Deps shared by libcast_browser_android and libcast_shell_android.
  12. group("common_apk_deps") {
  13. public_deps = [
  14. "//base",
  15. "//chromecast:cast_shell_jni_registration",
  16. "//chromecast:chromecast_buildflags",
  17. "//chromecast/app",
  18. "//chromecast/app:cast_crash_client",
  19. "//chromecast/base",
  20. "//chromecast/base:android_create_sys_info",
  21. "//chromecast/base:jni_headers",
  22. "//chromecast/base/metrics",
  23. "//chromecast/browser",
  24. "//chromecast/media/cma/backend/android:cast_media_android",
  25. "//components/crash/android:crash_android",
  26. "//components/minidump_uploader",
  27. "//components/module_installer/android:native",
  28. "//content/public/app",
  29. "//content/public/browser",
  30. "//skia",
  31. ]
  32. # Explicit dependencies required for JNI registration to be able to find the
  33. # native side functions.
  34. if (is_component_build) {
  35. public_deps += [
  36. "//device/bluetooth",
  37. "//device/gamepad",
  38. "//media/midi",
  39. "//ui/android",
  40. "//ui/events/devices",
  41. "//ui/shell_dialogs",
  42. ]
  43. }
  44. }
  45. shared_library("libcast_shell_android") {
  46. # TODO: Remove the ldflags after migrating away from protobuf_lite to
  47. # protobuf_full.
  48. ldflags = [ "-Wl,-z,muldefs" ]
  49. sources = [ "//chromecast/app/android/cast_jni_loader.cc" ]
  50. configs += [ "//chromecast:cast_config" ]
  51. configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  52. deps = [
  53. ":common_apk_deps",
  54. "//chromecast:cast_shell_lib",
  55. ]
  56. }
  57. shared_library("libcast_browser_android") {
  58. # TODO: Remove the ldflags after migrating away from protobuf_lite to
  59. # protobuf_full.
  60. ldflags = [ "-Wl,-z,muldefs" ]
  61. sources = [ "//chromecast/app/android/cast_jni_loader.cc" ]
  62. configs += [ "//chromecast:cast_config" ]
  63. configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  64. deps = [
  65. ":common_apk_deps",
  66. "//chromecast:cast_shell_lib_simple",
  67. "//components/module_installer/android:native",
  68. ]
  69. }
  70. group("native") {
  71. deps = [ ":cast_browser" ]
  72. }
  73. component("cast_browser") {
  74. # TODO: Remove the ldflags after migrating away from protobuf_lite to
  75. # protobuf_full.
  76. ldflags = [ "-Wl,-z,muldefs" ]
  77. sources = [ "//chromecast/app/android/cast_browser_module_entrypoint.cc" ]
  78. deps = [
  79. ":common_apk_deps",
  80. "//chromecast:cast_shell_lib_simple",
  81. ]
  82. cflags = [ "-fsymbol-partition=cast_browser_partition" ]
  83. }
  84. # These are all known //third_party/android_deps targets that chromecast
  85. # internal code depends on. Reference these targets so if anyone wants to
  86. # remove these targets upstream, they need to at least add someone from
  87. # //chromecast OWNERS as a reviewer to make sure it's safe.
  88. #
  89. # This list was generated from chromecast/internal using:
  90. #
  91. # find | grep BUILD.gn | xargs grep -hi '//third_party/android_deps:' | \
  92. # grep -v "deps =" | sed 's/ *//g' | sort | uniq
  93. group("internal_android_deps") {
  94. testonly = true
  95. public_deps = [
  96. "//third_party/android_deps:com_android_support_design_java",
  97. "//third_party/android_deps:protobuf_lite_runtime_java",
  98. "//third_party/androidx:androidx_annotation_annotation_java",
  99. "//third_party/androidx:androidx_core_core_java",
  100. "//third_party/androidx:androidx_fragment_fragment_java",
  101. "//third_party/androidx:androidx_leanback_leanback_preference_java",
  102. "//third_party/androidx:androidx_legacy_legacy_support_v4_java",
  103. "//third_party/androidx:androidx_lifecycle_lifecycle_common_java",
  104. "//third_party/androidx:androidx_lifecycle_lifecycle_viewmodel_java",
  105. "//third_party/androidx:androidx_localbroadcastmanager_localbroadcastmanager_java",
  106. "//third_party/androidx:androidx_media_media_java",
  107. "//third_party/androidx:androidx_mediarouter_mediarouter_java",
  108. "//third_party/androidx:androidx_preference_preference_java",
  109. "//third_party/androidx:androidx_recyclerview_recyclerview_java",
  110. "//third_party/androidx:androidx_slice_slice_builders_java",
  111. "//third_party/androidx:androidx_slice_slice_core_java",
  112. "//third_party/androidx:androidx_test_core_java",
  113. "//third_party/androidx:androidx_tvprovider_tvprovider_java",
  114. ]
  115. }
  116. # Util to copy libc++_shared.so to APK.
  117. copy("copy_libcxx_shared") {
  118. sources = [ "${sysroot}/usr/lib/${android_abi_target}/libc++_shared.so" ]
  119. outputs = [ "${root_out_dir}/libc++_shared.so" ]
  120. metadata = {
  121. shared_libraries = [ "${root_out_dir}/libc++_shared.so" ]
  122. }
  123. }