Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 1 | # 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 Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 15 | import("//gn/standalone/sanitizers/vars.gni") |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 16 | |
| 17 | declare_args() { |
Florian Mayer | 6bbffa4 | 2018-01-18 19:04:52 +0000 | [diff] [blame] | 18 | is_hermetic_clang = is_clang && is_linux_host |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | assert(!is_hermetic_clang || is_clang, "is_hermetic_clang requires is_clang") |
| 22 | |
| 23 | declare_args() { |
Primiano Tucci | fffb124 | 2017-11-27 09:41:36 +0000 | [diff] [blame] | 24 | if (is_linux_host) { |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 25 | 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 Tucci | fffb124 | 2017-11-27 09:41:36 +0000 | [diff] [blame] | 31 | } else if (is_clang) { |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 32 | # 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 Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 44 | } |