xref: /aosp_15_r20/external/crosvm/docs/book/src/building_crosvm/windows.md (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1# Building Crosvm on Windows
2
3This page describes how to build and develop crosvm on windows. If you are targeting linux, please
4see [Building Crosvm on linux](./linux.md)
5
6NOTE: Following instruction assume that
7
8- [git](https://git-scm.com/download/win) is installed and `git` command exists in your `Env:PATH`
9- the commands are run in powershell
10
11## Create base directory - `C:\src`
12
13```ps1
14mkdir C:\src
15cd C:\src
16```
17
18## Checking out
19
20Obtain the source code via git clone.
21
22```ps1
23git clone https://chromium.googlesource.com/crosvm/crosvm
24```
25
26## Setting up the development environment
27
28Crosvm uses submodules to manage external dependencies. Initialize them via:
29
30```ps1
31cd crosvm
32git submodule update --init
33```
34
35It is recommended to enable automatic recursive operations to keep the submodules in sync with the
36main repository (But do not push them, as that can conflict with `repo`):
37
38```ps1
39git config submodule.recurse true
40git config push.recurseSubmodules no
41```
42
43`install-deps.ps1` install the necessary tools needed to build crosvm on windows. In addition to
44installing the scripts, the script also sets up environment variables.
45
46The below script may prompt you to install msvc toolchain via Visual Studio community edition.
47
48```ps1
49Set-ExecutionPolicy Unrestricted -Scope CurrentUser
50./tools/install-deps.ps1
51```
52
53NOTE: Above step sets up enviroment variables. You may need to either start a new powershell session
54or reload the environemnt variables,
55
56## Build crosvm
57
58```ps1
59cargo build --features all-msvc64,whpx
60```
61