| # Copyright 2013 The Chromium Authors |
| # 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) { |
| 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") |
| |
| # Note that //build/toolchain/win/win_toolchain_data.gni collects the output |
| # of setup_toolchain.py, however it's not compatible with the UWP toolchain, |
| # as the UWP toolchain requires the `environment.store_$CPU` variable, instead |
| # of the usual `environment.$CPU`. |
| 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 |
| } |
| } |
| } |