Primiano Tucci | 2f81155 | 2020-12-07 16:48:22 +0100 | [diff] [blame] | 1 | # Copyright (C) 2020 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 | |
| 15 | # We should never get in here by accident from the Chromium tree. |
| 16 | assert(!defined(build_with_chromium) || !build_with_chromium) |
| 17 | |
| 18 | if (is_win_host) { |
| 19 | _find_msvc_out = exec_script("win_find_msvc.py", [], "list lines") |
| 20 | |
| 21 | # The output looks like this (without the line number "N:" part): |
| 22 | # 1: C:\Program Files (x86)\Windows Kits\10 |
| 23 | # 2: 10.0.19041.0 |
| 24 | # 3: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333 |
| 25 | _win_sdk_base = _find_msvc_out[0] |
| 26 | _win_sdk_ver = _find_msvc_out[1] |
| 27 | _win_msvc_base = _find_msvc_out[2] |
| 28 | |
| 29 | # TODO(primiano): look into how to integrate this with the toolchain pulled by |
| 30 | # depot tools. Also improve error reporting telling the user what to do. |
| 31 | # For now this requires both: |
| 32 | # 1. Build Tools for Visual Studio 2019 |
| 33 | # https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019 |
| 34 | # 2. Windows 10 SDK: |
| 35 | # https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk/ |
| 36 | |
| 37 | # These variables are required both for clang-cl.exe and MSVC (cl.exe). |
| 38 | win_sdk_lib_dir = _win_sdk_base + "\\Lib\\" + _win_sdk_ver |
Primiano Tucci | 497c3ed | 2021-05-24 12:24:39 +0100 | [diff] [blame] | 39 | win_msvc_lib_dir = _win_msvc_base + "\\lib\\${target_cpu}" |
Primiano Tucci | 2f81155 | 2020-12-07 16:48:22 +0100 | [diff] [blame] | 40 | |
| 41 | # These variables are only required when building with MSVC. |
| 42 | # Clang is clever enough to figure out the right include path by querying the |
| 43 | # registry and detect the Windows SDK path (it still needs the /LIBPATH |
| 44 | # though, hence the _lib_dir above). |
Primiano Tucci | 497c3ed | 2021-05-24 12:24:39 +0100 | [diff] [blame] | 45 | win_msvc_bin_dir = _win_msvc_base + "\\bin\\Host${host_cpu}\\${target_cpu}" |
Primiano Tucci | 2f81155 | 2020-12-07 16:48:22 +0100 | [diff] [blame] | 46 | win_msvc_inc_dirs = [ |
| 47 | _win_msvc_base + "\\include", |
| 48 | _win_sdk_base + "\\Include\\" + _win_sdk_ver + "\\ucrt", |
| 49 | _win_sdk_base + "\\Include\\" + _win_sdk_ver + "\\um", |
| 50 | _win_sdk_base + "\\Include\\" + _win_sdk_ver + "\\shared", |
| 51 | ] |
Primiano Tucci | 497c3ed | 2021-05-24 12:24:39 +0100 | [diff] [blame] | 52 | win_msvc_sys_lib_flags = [ |
| 53 | "/LIBPATH:\"${win_sdk_lib_dir}\\ucrt\\${target_cpu}\"", |
| 54 | "/LIBPATH:\"${win_sdk_lib_dir}\\um\\${target_cpu}\"", |
| 55 | "/LIBPATH:\"${win_msvc_lib_dir}\"", |
| 56 | ] |
Primiano Tucci | 2f81155 | 2020-12-07 16:48:22 +0100 | [diff] [blame] | 57 | } else { |
| 58 | win_sdk_lib_dir = "" |
| 59 | win_msvc_lib_dir = "" |
| 60 | win_msvc_bin_dir = "" |
| 61 | win_msvc_inc_dirs = [] |
Primiano Tucci | 497c3ed | 2021-05-24 12:24:39 +0100 | [diff] [blame] | 62 | win_msvc_sys_lib_flags = [] |
Primiano Tucci | 2f81155 | 2020-12-07 16:48:22 +0100 | [diff] [blame] | 63 | } |