blob: 357a4ab6c113a8333e3c51bbd64fb86efb95daa0 [file] [log] [blame] [view]
tfarina502f3882016-03-23 12:48:101# Windows Build Instructions
2
brettwc25693b32016-05-26 01:11:523## Common checkout instructions
4
5This page covers Windows-specific setup and configuration. The
6[general checkout
7instructions](http://dev.chromium.org/developers/how-tos/get-the-code) cover
8installing depot tools and checking out the code via git.
9
tfarina502f3882016-03-23 12:48:1010## Setting up Windows
11
12You must set your Windows system locale to English, or else you may get
13build errors about "The file contains a character that cannot be
14represented in the current code page."
15
16### Setting up the environment for Visual Studio
17
brucedawsonc2186342016-04-15 18:27:3418You must build with Visual Studio 2015 Update 2; no other version is
19supported.
tfarina502f3882016-03-23 12:48:1020
21You must have Windows 7 x64 or later. x86 OSs are unsupported.
22
brettwc25693b32016-05-26 01:11:5223## Getting the compiler toolchain
brucedawsonc2186342016-04-15 18:27:3424
25Follow the appropriate path below:
tfarina502f3882016-03-23 12:48:1026
27### Open source contributors
28
brucedawsonc2186342016-04-15 18:27:3429As of March 11, 2016 Chromium requires Visual Studio 2015 to build.
tfarina502f3882016-03-23 12:48:1030
brucedawsonc2186342016-04-15 18:27:3431Install Visual Studio 2015 Update 2 or later - Community Edition
32should work if its license is appropriate for you. Use the Custom Install option
33and select:
tfarina502f3882016-03-23 12:48:1034
brucedawsonc2186342016-04-15 18:27:3435- Visual C++, which will select three sub-categories including MFC
36- Universal Windows Apps Development Tools > Tools
37- Universal Windows Apps Development Tools > Windows 10 SDK (10.0.10586)
tfarina502f3882016-03-23 12:48:1038
brucedawsonc2186342016-04-15 18:27:3439You must have the 10586 SDK installed or else you will hit compile errors such
40as redefined macros.
Daniel Cheng8f817e342016-04-01 17:28:4841
pwnall43b43ba2016-08-22 19:29:2942Install Windows Driver Kit (WDK) 10, or use some other method to get the
43Debugging Tools for Windows.
44
Daniel Cheng8f817e342016-04-01 17:28:4845Run `set DEPOT_TOOLS_WIN_TOOLCHAIN=0`, or set that variable in your
tfarina502f3882016-03-23 12:48:1046global environment.
47
tfarina502f3882016-03-23 12:48:1048Compilation is done through ninja, **not** Visual Studio.
49
50### Google employees
51
Daniel Cheng8f817e342016-04-01 17:28:4852Run: `download_from_google_storage --config` and follow the
53authentication instructions. **Note that you must authenticate with your
tfarina502f3882016-03-23 12:48:1054@google.com credentials**, not @chromium.org. Enter "0" if asked for a
55project-id.
56
brettwc25693b32016-05-26 01:11:5257Run: `gclient sync` again to download and install the toolchain automatically.
tfarina502f3882016-03-23 12:48:1058
brucedawsonc2186342016-04-15 18:27:3459The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg
60can be found in `depot_tools\win_toolchain\vs_files\<hash>\win_sdk\Debuggers`.
tfarina502f3882016-03-23 12:48:1061
62If you want the IDE for debugging and editing, you will need to install
63it separately, but this is optional and not needed to build Chromium.
64
brettwc25693b32016-05-26 01:11:5265## Using the Visual Studio IDE
tfarina502f3882016-03-23 12:48:1066
brettwc25693b32016-05-26 01:11:5267If you want to use the Visual Studio IDE, use the `--ide` command line
68argument to `gn gen` when you generate your output directory (as described on
69the [get the code](http://dev.chromium.org/developers/how-tos/get-the-code)
70page):
tfarina502f3882016-03-23 12:48:1071
brettwc25693b32016-05-26 01:11:5272```gn gen --ide=vs out\Default
73devenv out\Default\all.sln
tfarina502f3882016-03-23 12:48:1074```
75
brettwc25693b32016-05-26 01:11:5276GN will produce a file `all.sln` in your build directory. It will internally
77use Ninja to compile while still allowing most IDE functions to work (there is
78no native Visual Studio compilation mode). If you manually run "gen" again you
79will need to resupply this argument, but normally GN will keep the build and
thakis3e861de2016-06-14 14:24:0180IDE files up to date automatically when you build.
tfarina502f3882016-03-23 12:48:1081
brettwc25693b32016-05-26 01:11:5282The generated solution will contain several thousand projects and will be very
83slow to load. Use the `--filters` argument to restrict generating project files
84for only the code you're interested in, although this will also limit what
85files appear in the project explorer. A minimal solution that will let you
86compile and run Chrome in the IDE but will not show any source files is:
87
88```gn gen --ide=vs --filters=//chrome out\Default```
89
90There are other options for controlling how the solution is generated, run `gn
91help gen` for the current documentation.
92
93## Performance tips
tfarina502f3882016-03-23 12:48:1094
Daniel Cheng8f817e342016-04-01 17:28:48951. Have a lot of fast CPU cores and enough RAM to keep them all busy.
tfarina502f3882016-03-23 12:48:1096 (Minimum recommended is 4-8 fast cores and 16-32 GB of RAM)
972. Reduce file system overhead by excluding build directories from
98 antivirus and indexing software.
993. Store the build tree on a fast disk (preferably SSD).
1004. If you are primarily going to be doing debug development builds, you
brettwc25693b32016-05-26 01:11:52101 should use the component build. Set the [build
102 arg](https://www.chromium.org/developers/gn-build-configuration)
103 `is_component_build = true`.
Daniel Cheng8f817e342016-04-01 17:28:48104 This will generate many DLLs and enable incremental linking, which makes
105 linking **much** faster in Debug.
tfarina502f3882016-03-23 12:48:10106
Daniel Cheng8f817e342016-04-01 17:28:48107Still, expect build times of 30 minutes to 2 hours when everything has to
tfarina502f3882016-03-23 12:48:10108be recompiled.