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.
16assert(!defined(build_with_chromium) || !build_with_chromium)
17
18if (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
39  win_msvc_lib_dir = _win_msvc_base + "\\lib\\x64"
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).
45  win_msvc_bin_dir = _win_msvc_base + "\\bin\\Hostx64\\x64"
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  ]
52} else {
53  win_sdk_lib_dir = ""
54  win_msvc_lib_dir = ""
55  win_msvc_bin_dir = ""
56  win_msvc_inc_dirs = []
57}
58