summaryrefslogtreecommitdiff
path: root/chromium/build/toolchain/win/BUILD.gn
blob: 0f33833133cd62a093e18a16db4f321045584bb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/win/visual_studio_version.gni")
import("//build/toolchain/win/toolchain.gni")

assert(is_win, "Should only be running on Windows")

# Setup the Visual Studio state.
#
# Its arguments are the VS path and the compiler wrapper tool. It will write
# "environment.x86" and "environment.x64" to the build directory and return a
# list to us.

# Copy the VS runtime DLL for the default toolchain to the root build directory
# so things will run.
if (current_toolchain == default_toolchain && ninja_use_custom_environment_files) {
  if (is_debug) {
    configuration_name = "Debug"
  } else {
    configuration_name = "Release"
  }
  exec_script("../../vs_toolchain.py",
              [
                "copy_dlls",
                rebase_path(root_build_dir),
                configuration_name,
                target_cpu,
              ])
}

if (target_cpu == "x86" || target_cpu == "x64") {
  win_toolchains("x86") {
    toolchain_arch = "x86"
  }
  win_toolchains("x64") {
    toolchain_arch = "x64"
  }
}

if (target_cpu == "arm64") {
  win_toolchains("arm64") {
    toolchain_arch = "arm64"
  }
  win_toolchains(host_cpu) {
    toolchain_arch = host_cpu
  }
}

# The nacl_win64 toolchain is nearly identical to the plain x64 toolchain.
# It's used solely for building nacl64.exe (//components/nacl/broker:nacl64).
# The only reason it's a separate toolchain is so that it can force
# is_component_build to false in the toolchain_args() block, because
# building nacl64.exe in component style does not work.
win_toolchains("nacl_win64") {
  toolchain_arch = "x64"
  toolchain_args = {
    is_component_build = false
  }
}

# WinUWP toolchains. Only define these when targeting them.

if (target_os == "winuwp") {
  assert(target_cpu == "x64" || target_cpu == "x86" || target_cpu == "arm" ||
         target_cpu == "arm64")
  store_cpu_toolchain_data =
      exec_script("//build/toolchain/win/setup_toolchain.py",
                  [
                    visual_studio_path,
                    windows_sdk_path,
                    visual_studio_runtime_dirs,
                    target_os,
                    target_cpu,
                    "environment.store_" + target_cpu,
                  ],
                  "scope")

  msvc_toolchain("uwp_" + target_cpu) {
    environment = "environment.store_" + target_cpu
    cl = "\"${store_cpu_toolchain_data.vc_bin_dir}/cl.exe\""
    toolchain_args = {
      current_os = "winuwp"
      current_cpu = target_cpu
      is_clang = false
    }
  }
}