tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 1 | # Windows Build Instructions |
| 2 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 3 | ## Common checkout instructions |
| 4 | |
| 5 | This page covers Windows-specific setup and configuration. The |
| 6 | [general checkout |
| 7 | instructions](http://dev.chromium.org/developers/how-tos/get-the-code) cover |
| 8 | installing depot tools and checking out the code via git. |
| 9 | |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 10 | ## Setting up Windows |
| 11 | |
| 12 | You must set your Windows system locale to English, or else you may get |
| 13 | build errors about "The file contains a character that cannot be |
| 14 | represented in the current code page." |
| 15 | |
| 16 | ### Setting up the environment for Visual Studio |
| 17 | |
brucedawson | c218634 | 2016-04-15 18:27:34 | [diff] [blame] | 18 | You must build with Visual Studio 2015 Update 2; no other version is |
| 19 | supported. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 20 | |
| 21 | You must have Windows 7 x64 or later. x86 OSs are unsupported. |
| 22 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 23 | ## Getting the compiler toolchain |
brucedawson | c218634 | 2016-04-15 18:27:34 | [diff] [blame] | 24 | |
| 25 | Follow the appropriate path below: |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 26 | |
| 27 | ### Open source contributors |
| 28 | |
brucedawson | c218634 | 2016-04-15 18:27:34 | [diff] [blame] | 29 | As of March 11, 2016 Chromium requires Visual Studio 2015 to build. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 30 | |
brucedawson | c218634 | 2016-04-15 18:27:34 | [diff] [blame] | 31 | Install Visual Studio 2015 Update 2 or later - Community Edition |
| 32 | should work if its license is appropriate for you. Use the Custom Install option |
| 33 | and select: |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 34 | |
brucedawson | c218634 | 2016-04-15 18:27:34 | [diff] [blame] | 35 | - 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) |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 38 | |
brucedawson | c218634 | 2016-04-15 18:27:34 | [diff] [blame] | 39 | You must have the 10586 SDK installed or else you will hit compile errors such |
| 40 | as redefined macros. |
Daniel Cheng | 8f817e34 | 2016-04-01 17:28:48 | [diff] [blame] | 41 | |
pwnall | 43b43ba | 2016-08-22 19:29:29 | [diff] [blame^] | 42 | Install Windows Driver Kit (WDK) 10, or use some other method to get the |
| 43 | Debugging Tools for Windows. |
| 44 | |
Daniel Cheng | 8f817e34 | 2016-04-01 17:28:48 | [diff] [blame] | 45 | Run `set DEPOT_TOOLS_WIN_TOOLCHAIN=0`, or set that variable in your |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 46 | global environment. |
| 47 | |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 48 | Compilation is done through ninja, **not** Visual Studio. |
| 49 | |
| 50 | ### Google employees |
| 51 | |
Daniel Cheng | 8f817e34 | 2016-04-01 17:28:48 | [diff] [blame] | 52 | Run: `download_from_google_storage --config` and follow the |
| 53 | authentication instructions. **Note that you must authenticate with your |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 54 | @google.com credentials**, not @chromium.org. Enter "0" if asked for a |
| 55 | project-id. |
| 56 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 57 | Run: `gclient sync` again to download and install the toolchain automatically. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 58 | |
brucedawson | c218634 | 2016-04-15 18:27:34 | [diff] [blame] | 59 | The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg |
| 60 | can be found in `depot_tools\win_toolchain\vs_files\<hash>\win_sdk\Debuggers`. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 61 | |
| 62 | If you want the IDE for debugging and editing, you will need to install |
| 63 | it separately, but this is optional and not needed to build Chromium. |
| 64 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 65 | ## Using the Visual Studio IDE |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 66 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 67 | If you want to use the Visual Studio IDE, use the `--ide` command line |
| 68 | argument to `gn gen` when you generate your output directory (as described on |
| 69 | the [get the code](http://dev.chromium.org/developers/how-tos/get-the-code) |
| 70 | page): |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 71 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 72 | ```gn gen --ide=vs out\Default |
| 73 | devenv out\Default\all.sln |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 74 | ``` |
| 75 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 76 | GN will produce a file `all.sln` in your build directory. It will internally |
| 77 | use Ninja to compile while still allowing most IDE functions to work (there is |
| 78 | no native Visual Studio compilation mode). If you manually run "gen" again you |
| 79 | will need to resupply this argument, but normally GN will keep the build and |
thakis | 3e861de | 2016-06-14 14:24:01 | [diff] [blame] | 80 | IDE files up to date automatically when you build. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 81 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 82 | The generated solution will contain several thousand projects and will be very |
| 83 | slow to load. Use the `--filters` argument to restrict generating project files |
| 84 | for only the code you're interested in, although this will also limit what |
| 85 | files appear in the project explorer. A minimal solution that will let you |
| 86 | compile 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 | |
| 90 | There are other options for controlling how the solution is generated, run `gn |
| 91 | help gen` for the current documentation. |
| 92 | |
| 93 | ## Performance tips |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 94 | |
Daniel Cheng | 8f817e34 | 2016-04-01 17:28:48 | [diff] [blame] | 95 | 1. Have a lot of fast CPU cores and enough RAM to keep them all busy. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 96 | (Minimum recommended is 4-8 fast cores and 16-32 GB of RAM) |
| 97 | 2. Reduce file system overhead by excluding build directories from |
| 98 | antivirus and indexing software. |
| 99 | 3. Store the build tree on a fast disk (preferably SSD). |
| 100 | 4. If you are primarily going to be doing debug development builds, you |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 101 | should use the component build. Set the [build |
| 102 | arg](https://www.chromium.org/developers/gn-build-configuration) |
| 103 | `is_component_build = true`. |
Daniel Cheng | 8f817e34 | 2016-04-01 17:28:48 | [diff] [blame] | 104 | This will generate many DLLs and enable incremental linking, which makes |
| 105 | linking **much** faster in Debug. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 106 | |
Daniel Cheng | 8f817e34 | 2016-04-01 17:28:48 | [diff] [blame] | 107 | Still, expect build times of 30 minutes to 2 hours when everything has to |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 108 | be recompiled. |