xref: /aosp_15_r20/external/angle/build/config/chromeos/BUILD.gn (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2019 The Chromium Authors
2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file.
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/chromeos/ui_mode.gni")
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Workerassert(is_chromeos)
8*8975f5c5SAndroid Build Coastguard Worker
9*8975f5c5SAndroid Build Coastguard Workerconfig("compiler_cpu_abi") {
10*8975f5c5SAndroid Build Coastguard Worker  # These flags are added by the Chrome OS toolchain compiler wrapper,
11*8975f5c5SAndroid Build Coastguard Worker  # or are implicitly passed by Chome OS's toolchain's clang due to
12*8975f5c5SAndroid Build Coastguard Worker  # the cmake flags that clang was built with. Passing them redundantly
13*8975f5c5SAndroid Build Coastguard Worker  # is harmless and prepares for using Chromium's toolchain.
14*8975f5c5SAndroid Build Coastguard Worker  if (is_chromeos_device) {
15*8975f5c5SAndroid Build Coastguard Worker    if (current_cpu == "x64") {
16*8975f5c5SAndroid Build Coastguard Worker      asmflags = [ "--target=x86_64-cros-linux-gnu" ]
17*8975f5c5SAndroid Build Coastguard Worker      cflags = [
18*8975f5c5SAndroid Build Coastguard Worker        "--target=x86_64-cros-linux-gnu",
19*8975f5c5SAndroid Build Coastguard Worker        "-mno-movbe",
20*8975f5c5SAndroid Build Coastguard Worker      ]
21*8975f5c5SAndroid Build Coastguard Worker      ldflags = [
22*8975f5c5SAndroid Build Coastguard Worker        "--target=x86_64-cros-linux-gnu",
23*8975f5c5SAndroid Build Coastguard Worker        "-mno-movbe",
24*8975f5c5SAndroid Build Coastguard Worker      ]
25*8975f5c5SAndroid Build Coastguard Worker    } else if (current_cpu == "arm") {
26*8975f5c5SAndroid Build Coastguard Worker      asmflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
27*8975f5c5SAndroid Build Coastguard Worker      cflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
28*8975f5c5SAndroid Build Coastguard Worker      ldflags = [ "--target=armv7a-cros-linux-gnueabihf" ]
29*8975f5c5SAndroid Build Coastguard Worker    } else if (current_cpu == "arm64") {
30*8975f5c5SAndroid Build Coastguard Worker      asmflags = [ "--target=aarch64-cros-linux-gnu" ]
31*8975f5c5SAndroid Build Coastguard Worker      cflags = [ "--target=aarch64-cros-linux-gnu" ]
32*8975f5c5SAndroid Build Coastguard Worker      ldflags = [ "--target=aarch64-cros-linux-gnu" ]
33*8975f5c5SAndroid Build Coastguard Worker    } else {
34*8975f5c5SAndroid Build Coastguard Worker      assert(false, "add support for $current_cpu here")
35*8975f5c5SAndroid Build Coastguard Worker    }
36*8975f5c5SAndroid Build Coastguard Worker  }
37*8975f5c5SAndroid Build Coastguard Worker}
38*8975f5c5SAndroid Build Coastguard Worker
39*8975f5c5SAndroid Build Coastguard Workerconfig("runtime_library") {
40*8975f5c5SAndroid Build Coastguard Worker  # These flags are added by the Chrome OS toolchain compiler wrapper,
41*8975f5c5SAndroid Build Coastguard Worker  # or are implicitly passed by Chome OS's toolchain's clang due to
42*8975f5c5SAndroid Build Coastguard Worker  # the cmake flags that clang was built with. Passing them redundantly
43*8975f5c5SAndroid Build Coastguard Worker  # is harmless and prepares for using Chromium's toolchain.
44*8975f5c5SAndroid Build Coastguard Worker  if (is_chromeos_device) {
45*8975f5c5SAndroid Build Coastguard Worker    ldflags = [
46*8975f5c5SAndroid Build Coastguard Worker      "--rtlib=compiler-rt",
47*8975f5c5SAndroid Build Coastguard Worker      "--unwindlib=libunwind",
48*8975f5c5SAndroid Build Coastguard Worker    ]
49*8975f5c5SAndroid Build Coastguard Worker  }
50*8975f5c5SAndroid Build Coastguard Worker}
51