blob: f6bd0388c58d8d499748092e3c6f8108d782b02b [file] [log] [blame]
Primiano Tucci0825bc82017-09-28 18:50:23 +01001# Copyright (C) 2017 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000015import("//gn/standalone/sanitizers/vars.gni")
Primiano Tuccib60d4b02017-11-10 11:03:00 +000016
17declare_args() {
Florian Mayer6bbffa42018-01-18 19:04:52 +000018 is_hermetic_clang = is_clang && is_linux_host
Primiano Tuccib60d4b02017-11-10 11:03:00 +000019}
20
21assert(!is_hermetic_clang || is_clang, "is_hermetic_clang requires is_clang")
22
23declare_args() {
Primiano Tuccifffb1242017-11-27 09:41:36 +000024 if (is_linux_host) {
Primiano Tuccib60d4b02017-11-10 11:03:00 +000025 if (is_hermetic_clang) {
26 _hermetic_llvm_dir = rebase_path("//buildtools/clang", root_build_dir)
27 linux_llvm_dir = "$_hermetic_llvm_dir/lib/clang/6.0.0/"
28 linux_clang_bin = "$_hermetic_llvm_dir/bin/clang"
29 linux_clangxx_bin = "$_hermetic_llvm_dir/bin/clang++"
30 linux_clangrt_dir = "$_hermetic_llvm_dir/lib/clang/6.0.0/lib/linux"
Primiano Tuccifffb1242017-11-27 09:41:36 +000031 } else if (is_clang) {
Primiano Tuccib60d4b02017-11-10 11:03:00 +000032 # Guess the path for the system clang.
33 find_llvm_out = exec_script("linux_find_llvm.py", [], "list lines")
34 linux_llvm_dir = find_llvm_out[0]
35 linux_clang_bin = find_llvm_out[1]
36 linux_clangxx_bin = find_llvm_out[2]
37 linux_clangrt_dir = "$linux_llvm_dir/lib/linux"
38 }
39 } else if (is_mac) {
40 mac_toolchain_dirs_ = exec_script("mac_find_llvm.py", [], "list lines")
41 mac_toolchain_dir = mac_toolchain_dirs_[0]
42 mac_clangrt_dir = mac_toolchain_dirs_[1]
43 }
Primiano Tucci0825bc82017-09-28 18:50:23 +010044}