1# Copyright 2019 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build/config/chromeos/ui_mode.gni") 6 7assert(is_chromeos) 8 9config("compiler_cpu_abi") { 10 # Lacros currently uses the *-generic-crosstoolchain.gni files generated 11 # by the simplechrome sdk in build/args/chromeos. These target triples 12 # match the target toolchain defaults in these directories. Passing them 13 # redundantly is harmless and prepares for using Chromium's toolchain. 14 # Non-Lacros Chrome OS builds use per-board toolchains, which might use 15 # different triples. So don't do this there. 16 if (is_chromeos_device && is_chromeos_lacros) { 17 if (current_cpu == "x64") { 18 asmflags = [ "--target=x86_64-cros-linux-gnu" ] 19 cflags = [ "--target=x86_64-cros-linux-gnu" ] 20 ldflags = [ "--target=x86_64-cros-linux-gnu" ] 21 } else if (current_cpu == "arm") { 22 asmflags = [ "--target=armv7a-cros-linux-gnueabihf" ] 23 cflags = [ "--target=armv7a-cros-linux-gnueabihf" ] 24 ldflags = [ "--target=armv7a-cros-linux-gnueabihf" ] 25 } else if (current_cpu == "arm64") { 26 asmflags = [ "--target=aarch64-cros-linux-gnu" ] 27 cflags = [ "--target=aarch64-cros-linux-gnu" ] 28 ldflags = [ "--target=aarch64-cros-linux-gnu" ] 29 } else { 30 assert(false, "add support for $current_cpu here") 31 } 32 } 33} 34 35config("runtime_library") { 36 # These flags are added by the Chrome OS toolchain compiler wrapper, 37 # or are implicitly passed by Chome OS's toolchain's clang due to the cmake 38 # flags that clang was built with. 39 # Passing them redundantly is harmless and prepares for using Chromium's 40 # toolchain for Lacros. 41 if (is_chromeos_device) { 42 ldflags = [ 43 "--rtlib=compiler-rt", 44 "--unwindlib=libunwind", 45 ] 46 } 47} 48