tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame^] | 1 | # Windows Build Instructions |
| 2 | |
| 3 | ## Setting up Windows |
| 4 | |
| 5 | You must set your Windows system locale to English, or else you may get |
| 6 | build errors about "The file contains a character that cannot be |
| 7 | represented in the current code page." |
| 8 | |
| 9 | ### Setting up the environment for Visual Studio |
| 10 | |
| 11 | You must build with Visual Studio 2013 Update 4 or Visual Studio 2015 |
| 12 | Update 1, no other versions are supported. |
| 13 | |
| 14 | You must have Windows 7 x64 or later. x86 OSs are unsupported. |
| 15 | |
| 16 | 1. Get |
| 17 | [depot\_tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up). |
| 18 | 2. Follow the appropriate path below: |
| 19 | |
| 20 | ### Open source contributors |
| 21 | |
| 22 | For building with Visual Studio 2015 (default compiler as of March 10, |
| 23 | 2016): |
| 24 | |
| 25 | > Install Visual Studio 2015 Update 1 or later - Community Edition |
| 26 | > should work if its license is appropriate for you. Be sure to select |
| 27 | > Custom install and select VC++ (which selects three sub-categories |
| 28 | > including MFC) and, under Universal Windows App Development Tools, |
| 29 | > select Tools (1.2) and Windows 10 SDK (10.0.10586). You must have the |
| 30 | > 10586 SDK installed or else you will hit compile errors such as |
| 31 | > redefined macros. |
| 32 | |
| 33 | For building with Visual Studio 2013 (no longer default as of March 10, |
| 34 | 2016, and not recommended - requires setting GYP\_MSVS\_VERSION=2013): |
| 35 | |
| 36 | > Install [Visual Studio 2013 |
| 37 | > Community](http://www.visualstudio.com/products/visual-studio-community-vs) |
| 38 | > or [Visual Studio 2013 |
| 39 | > Professional](http://www.visualstudio.com/products/visual-studio-professional-with-msdn-vs) |
| 40 | > depending on which license is appropriate for you. You can deselect |
| 41 | > the default options if you want, but you must make sure to install |
| 42 | > "Microsoft Foundation Classes for C++". |
| 43 | > \ |
| 44 | > You should also install the [Windows 10 |
| 45 | > SDK](https://dev.windows.com/en-us/downloads/windows-10-sdk) to the |
| 46 | > default install location. You must have SDK version 10.0.10586 or |
| 47 | > greater installed. |
| 48 | |
| 49 | Run `set DEPOT\_TOOLS\_WIN\_TOOLCHAIN=0`, or set that variable in your |
| 50 | global environment. |
| 51 | |
| 52 | Visual Studio Express 2013 is **not** supported and will not be able to |
| 53 | build Chromium. |
| 54 | |
| 55 | Compilation is done through ninja, **not** Visual Studio. |
| 56 | |
| 57 | ### Google employees |
| 58 | |
| 59 | Run: `download\_from\_google\_storage --config` and follow the |
| 60 | authentication instructions.**Note that you must authenticate with your |
| 61 | @google.com credentials**, not @chromium.org. Enter "0" if asked for a |
| 62 | project-id. |
| 63 | |
| 64 | Once you've done this, the toolchain will be installed automatically for |
| 65 | you in Step 3, below (near the end of the step). |
| 66 | |
| 67 | The toolchain will be in depot\_tools\\win\_toolchain, and windbg can be |
| 68 | found in |
| 69 | depot\_tools\\win\_toolchain\\vs2013\_files\\win8sdk\\Debuggers. |
| 70 | |
| 71 | If you want the IDE for debugging and editing, you will need to install |
| 72 | it separately, but this is optional and not needed to build Chromium. |
| 73 | |
| 74 | ## Getting the Code |
| 75 | |
| 76 | Follow the steps to [check out the |
| 77 | code](https://www.chromium.org/developers/how-tos/get-the-code) (largely |
| 78 | "fetch chromium"). |
| 79 | |
| 80 | ## Building |
| 81 | |
| 82 | Build the target you are interested in. |
| 83 | |
| 84 | ```shell |
| 85 | ninja -C out\\Debug chrome |
| 86 | ``` |
| 87 | |
| 88 | Alternative (Graphical user interface): Open a generated .sln |
| 89 | file such as all.sln, right-click the chrome project and select build. |
| 90 | This will invoke the real step 4 above. Do not build the whole solution |
| 91 | since that conflicts with ninja's build management and everything will |
| 92 | explode. |
| 93 | Substitute the build directory given to -C with out\\Debug\_x64 for |
| 94 | [64-bit |
| 95 | builds](https://www.chromium.org/developers/design-documents/64-bit-support) |
| 96 | in GYP, or whatever build directory you have configured if using GN. |
| 97 | |
| 98 | ### Performance tips |
| 99 | |
| 100 | 1. Have many and fast CPU cores and enough RAM to keep them all busy. |
| 101 | (Minimum recommended is 4-8 fast cores and 16-32 GB of RAM) |
| 102 | 2. Reduce file system overhead by excluding build directories from |
| 103 | antivirus and indexing software. |
| 104 | 3. Store the build tree on a fast disk (preferably SSD). |
| 105 | 4. If you are primarily going to be doing debug development builds, you |
| 106 | use the component build (in |
| 107 | [GYP](https://www.chromium.org/developers/gyp-environment-variables) |
| 108 | do set GYP\_DEFINES=component=shared\_library, in |
| 109 | [GN](https://www.chromium.org/developers/gn-build-configuration), |
| 110 | set the build arg is\_component\_build = true). This will generate |
| 111 | many DLLs and enable incremental linking, which makes linking |
| 112 | *much*faster in Debug. |
| 113 | |
| 114 | Still expect build times of 30 minutes to 2 hours when everything has to |
| 115 | be recompiled. |