BUILD.gn 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright 2019 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/chromeos/ui_mode.gni")
  5. assert(is_chromeos)
  6. declare_args() {
  7. # The location to a file used to dump symbols ordered by Call-Chain Clustering (C3)
  8. # https://research.fb.com/wp-content/uploads/2017/01/cgo2017-hfsort-final1.pdf?
  9. # to a file, used for generating orderfiles in Chrome OS
  10. dump_call_chain_clustering_order = ""
  11. }
  12. config("print_orderfile") {
  13. if (dump_call_chain_clustering_order != "") {
  14. _output_orderfile =
  15. rebase_path(dump_call_chain_clustering_order, root_build_dir)
  16. ldflags = [ "-Wl,--print-symbol-order=$_output_orderfile" ]
  17. }
  18. }
  19. config("compiler_cpu_abi") {
  20. # Lacros currently uses the *-generic-crosstoolchain.gni files generated
  21. # by the simplechrome sdk in build/args/chromeos. These target triples
  22. # match the target toolchain defaults in these directories. Passing them
  23. # redundantly is harmless and prepares for using Chromium's toolchain.
  24. # Non-Lacros Chrome OS builds use per-board toolchains, which might use
  25. # different triples. So don't do this there.
  26. if (is_chromeos_device && is_chromeos_lacros) {
  27. if (current_cpu == "x64") {
  28. asmflags = [ "--target=x86_64-cros-linux-gnu" ]
  29. cflags = [ "--target=x86_64-cros-linux-gnu" ]
  30. ldflags = [ "--target=x86_64-cros-linux-gnu" ]
  31. } else if (current_cpu == "arm") {
  32. asmflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
  33. cflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
  34. ldflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
  35. } else if (current_cpu == "arm64") {
  36. asmflags = [ "--target=aarch64-cros-linux-gnu" ]
  37. cflags = [ "--target=aarch64-cros-linux-gnu" ]
  38. ldflags = [ "--target=aarch64-cros-linux-gnu" ]
  39. } else {
  40. assert(false, "add support for $current_cpu here")
  41. }
  42. }
  43. }
  44. config("runtime_library") {
  45. # These flags are added by the Chrome OS toolchain compiler wrapper,
  46. # or are implicitly passed by Chome OS's toolchain's clang due to the cmake
  47. # flags that clang was built with.
  48. # Passing them redundantly is harmless and prepares for using Chromium's
  49. # toolchain for Lacros.
  50. if (is_chromeos_device) {
  51. ldflags = [
  52. "--rtlib=compiler-rt",
  53. "--unwindlib=libunwind",
  54. ]
  55. }
  56. }