Skip to content

Architecture Support

msvc-kit supports multiple CPU architectures for both host (build machine) and target (output binaries).

Supported Architectures

ArchitectureAs HostAs TargetDescription
x6464-bit x86 (AMD64)
x8632-bit x86
arm64ARM 64-bit
armARM 32-bit (target only)

Host vs Target Architecture

  • Host Architecture: The CPU architecture of your build machine
  • Target Architecture: The CPU architecture of the compiled binaries

Native Compilation

Build machine and output have the same architecture:

bash
# On x64 machine, build x64 binaries
msvc-kit download --host-arch x64 --arch x64

Cross Compilation

Build on one architecture for another:

bash
# On x64 machine, build ARM64 binaries
msvc-kit download --host-arch x64 --arch arm64

# On x64 machine, build x86 (32-bit) binaries
msvc-kit download --host-arch x64 --arch x86

Architecture Filtering

msvc-kit intelligently filters downloaded packages based on your specified architecture, significantly reducing download size and installation time.

What Gets Downloaded

When you specify an architecture (e.g., --arch x64), msvc-kit downloads only:

Package TypeFiltering Behavior
ToolsOnly matching host/target combination (e.g., HostX64.TargetX64)
CRT LibrariesOnly matching architecture (e.g., CRT.x64.Desktop)
MFC/ATLOnly matching architecture (e.g., MFC.x64, ATL.x64)
HeadersAlways included (architecture-neutral)
Spectre LibrariesExcluded by default (rarely needed)

What Gets Excluded

The following are automatically excluded to minimize download size:

  • Other architectures: ARM64, x86, ARM packages when targeting x64
  • Spectre-mitigated libraries: .Spectre suffix packages
  • Redundant packages: Duplicate architecture variants

Download Size Comparison

ConfigurationApproximate Size
All architectures (old behavior)~2.5 GB
Single architecture (x64)~300-500 MB
Minimal (tools only)~150-250 MB

Available Tools

MSVC Compiler Tools

After downloading and setting up the environment, the following MSVC tools are available:

ToolDescription
cl.exeC/C++ compiler
link.exeLinker
lib.exeStatic library manager
ml64.exeMASM assembler (x64)
ml.exeMASM assembler (x86)
nmake.exeMicrosoft make utility

Windows SDK Tools

The Windows SDK includes additional tools for development and deployment:

ToolDescription
rc.exeResource compiler
signtool.exeCode signing tool
mt.exeManifest tool
makecat.exeCatalog creation tool
makecert.exeCertificate creation tool
certutil.exeCertificate utility
mc.exeMessage compiler
midl.exeMIDL compiler

Using SDK Tools

After activating the environment, SDK tools are available in PATH:

bash
# Activate environment
msvc-kit setup --script --shell powershell | Invoke-Expression

# Sign an executable
signtool sign /a /t http://timestamp.digicert.com myapp.exe

# Compile resources
rc /fo resources.res resources.rc

# Create manifest
mt -manifest app.manifest -outputresource:myapp.exe;1

Tool Paths

The tools are located in:

# MSVC tools
{install_dir}/VC/Tools/MSVC/{version}/bin/Host{host_arch}/{target_arch}/

# SDK tools
{install_dir}/Windows Kits/10/bin/{sdk_version}/{arch}/

Directory Structure

MSVC uses a specific directory structure for cross-compilation:

VC/Tools/MSVC/14.xx/bin/
├── Hostx64/
│   ├── x64/      # x64 host → x64 target (native)
│   ├── x86/      # x64 host → x86 target (cross)
│   └── arm64/    # x64 host → ARM64 target (cross)
├── Hostx86/
│   ├── x86/      # x86 host → x86 target (native)
│   └── x64/      # x86 host → x64 target (cross)
└── Hostarm64/
    ├── arm64/    # ARM64 host → ARM64 target (native)
    ├── x64/      # ARM64 host → x64 target (cross)
    └── x86/      # ARM64 host → x86 target (cross)

Auto-Detection

By default, msvc-kit auto-detects your host architecture:

bash
# Auto-detect host, target x64
msvc-kit download --arch x64

Common Scenarios

Build 32-bit on 64-bit Windows

bash
msvc-kit download --host-arch x64 --arch x86
msvc-kit setup --script --shell powershell | Invoke-Expression

# cl.exe now targets x86
cl /c myfile.cpp  # Produces x86 object file

Build ARM64 for Windows on ARM

bash
# On x64 machine
msvc-kit download --host-arch x64 --arch arm64
msvc-kit setup --script --shell powershell | Invoke-Expression

# cl.exe now targets ARM64
cl /c myfile.cpp  # Produces ARM64 object file

Multi-Architecture Setup

Download multiple architectures:

bash
# Download for multiple targets
msvc-kit download --arch x64
msvc-kit download --arch x86
msvc-kit download --arch arm64

Library API

rust
use msvc_kit::{DownloadOptions, Architecture};

let options = DownloadOptions::builder()
    .arch(Architecture::X64)
    .host_arch(Architecture::X64)
    .target_dir("C:/msvc-kit")
    .build();

// Only x64 packages will be downloaded
let info = msvc_kit::download_msvc(&options).await?;

Cross-Compilation Example

rust
use msvc_kit::{DownloadOptions, Architecture};

// Build ARM64 binaries on x64 host
let options = DownloadOptions::builder()
    .arch(Architecture::Arm64)
    .host_arch(Architecture::X64)
    .target_dir("C:/msvc-kit")
    .build();

// Downloads: HostX64.TargetARM64 tools + ARM64 CRT/MFC/ATL
let info = msvc_kit::download_msvc(&options).await?;

Released under the MIT License.