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