| OLD | NEW |
| 1 # Checking out and building Chromium on Windows | 1 # Checking out and Building Chromium for Windows |
| 2 | 2 |
| 3 There are instructions for other platforms linked from the |
| 4 [get the code](get_the_code.md) page. |
| 5 |
| 3 **See also [the old version of this page](old_linux_build_instructions.md).** | 6 **See also [the old version of this page](old_linux_build_instructions.md).** |
| 4 | 7 |
| 5 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom
e) instead. | 8 ## Instructions for Google Employees |
| 9 |
| 10 Are you a Google employee? See |
| 11 [go/building-chrome](https://goto.google.com/building-chrome) instead. |
| 6 | 12 |
| 7 [TOC] | 13 [TOC] |
| 8 | 14 |
| 9 ## System requirements | 15 ## System requirements |
| 10 | 16 |
| 11 * A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly | 17 * A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly |
| 12 recommended. | 18 recommended. |
| 13 * At least 100GB of free disk space. | 19 * At least 100GB of free disk space. |
| 14 * Visual Studio 2015 Update 3, see below (no other version is supported). | 20 * Visual Studio 2015 Update 3, see below (no other version is supported). |
| 15 * Windows 7 or newer. | 21 * Windows 7 or newer. |
| 16 | 22 |
| 17 ## Setting up Windows | 23 ## Setting up Windows |
| 18 | 24 |
| 19 ### System locale | |
| 20 | |
| 21 You must set your Windows system locale to English, or else you may get | |
| 22 build errors about "The file contains a character that cannot be | |
| 23 represented in the current code page." | |
| 24 | |
| 25 ### Visual Studio | 25 ### Visual Studio |
| 26 | 26 |
| 27 As of March 11, 2016 Chromium requires Visual Studio 2015 to build. | 27 As of March 11, 2016 Chromium requires Visual Studio 2015 to build. |
| 28 | 28 |
| 29 Install Visual Studio 2015 Update 3 or later - Community Edition | 29 Install Visual Studio 2015 Update 3 or later - Community Edition |
| 30 should work if its license is appropriate for you. Use the Custom Install option | 30 should work if its license is appropriate for you. Use the Custom Install option |
| 31 and select: | 31 and select: |
| 32 | 32 |
| 33 - Visual C++, which will select three sub-categories including MFC | 33 - Visual C++, which will select three sub-categories including MFC |
| 34 - Universal Windows Apps Development Tools > Tools | 34 - Universal Windows Apps Development Tools > Tools |
| 35 - Universal Windows Apps Development Tools > Windows 10 SDK (10.0.10586) | 35 - Universal Windows Apps Development Tools > Windows 10 SDK (10.0.10586) |
| 36 | 36 |
| 37 You must have the 10586 SDK installed or else you will hit compile errors such | 37 You must have the 10586 SDK installed or else you will hit compile errors such |
| 38 as redefined macros. | 38 as redefined macros. |
| 39 | 39 |
| 40 Install Windows Driver Kit (WDK) 10, or use some other method to get the | 40 Install the Windows SDK 10, and choose Debugging Tools For Windows when you |
| 41 Debugging Tools for Windows. | 41 install this in order to get windbg. |
| 42 | 42 |
| 43 ## Install `depot_tools` | 43 ## Install `depot_tools` |
| 44 | 44 |
| 45 Download the (depot_tools bundle)[https://storage.googleapis.com/chrome-infra/de
pot_tools.zip] | 45 Download the [depot_tools bundle](https://storage.googleapis.com/chrome-infra/de
pot_tools.zip) |
| 46 and extract it somewhere. | 46 and extract it somewhere. |
| 47 | 47 |
| 48 *** note | 48 *** note |
| 49 **Warning:** **DO NOT** use drag-n-drop or copy-n-paste extract from Explorer, | 49 **Warning:** **DO NOT** use drag-n-drop or copy-n-paste extract from Explorer, |
| 50 this will not extract the hidden “.git” folder which is necessary for | 50 this will not extract the hidden “.git” folder which is necessary for |
| 51 depot_tools to autoupdate itself. You can use “Extract all…” from the | 51 depot_tools to autoupdate itself. You can use “Extract all…” from the |
| 52 context menu though. | 52 context menu though. |
| 53 *** | 53 *** |
| 54 | 54 |
| 55 Add depot_tools to the start of your PATH (must be ahead of any installs of | 55 Add depot_tools to the start of your PATH (must be ahead of any installs of |
| 56 Python). Assuming you unzipped the bundle to C:\src\depot_tools: | 56 Python). Assuming you unzipped the bundle to C:\src\depot_tools: |
| 57 | 57 |
| 58 With Administrator access: | 58 With Administrator access: |
| 59 | 59 |
| 60 Control Panel → System and Security → System → Advanced system settings | 60 Control Panel → System and Security → System → Advanced system settings |
| 61 | 61 |
| 62 Modify the PATH system variable to include C:\src\depot_tools. | 62 Modify the PATH system variable to include C:\src\depot_tools. |
| 63 | 63 |
| 64 Without Administrator access: | 64 Without Administrator access: |
| 65 | 65 |
| 66 Control Panel → User Accounts → User Accounts → Change my environment variables | 66 Control Panel → User Accounts → User Accounts → Change my environment variables |
| 67 | 67 |
| 68 Add a PATH user variable: C:\src\depot_tools;%PATH%. | 68 Add a PATH user variable (or modify the existing one to include): |
| 69 `C:\src\depot_tools`. |
| 69 | 70 |
| 70 Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set | 71 Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set |
| 71 it to 0. This tells depot_tools to use your locally installed version of Visual | 72 it to 0. This tells depot_tools to use your locally installed version of Visual |
| 72 Studio (by default, depot_tools will try to use a google-internal version). | 73 Studio (by default, depot_tools will try to use a google-internal version). |
| 73 | 74 |
| 74 From a cmd.exe shell, run the command gclient (without arguments). On first | 75 From a cmd.exe shell, run the command gclient (without arguments). On first |
| 75 run, gclient will install all the Windows-specific bits needed to work with | 76 run, gclient will install all the Windows-specific bits needed to work with |
| 76 the code, including msysgit and python. | 77 the code, including msysgit and python. |
| 77 | 78 |
| 78 * If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), | 79 * If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 116 |
| 116 ```shell | 117 ```shell |
| 117 $ cd src | 118 $ cd src |
| 118 ``` | 119 ``` |
| 119 | 120 |
| 120 *Optional*: You can also [install API | 121 *Optional*: You can also [install API |
| 121 keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your | 122 keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your |
| 122 build to talk to some Google services, but this is not necessary for most | 123 build to talk to some Google services, but this is not necessary for most |
| 123 development and testing purposes. | 124 development and testing purposes. |
| 124 | 125 |
| 125 ## Building | 126 ## Setting up the build |
| 126 | 127 |
| 127 Chromium uses [Ninja](https://ninja-build.org) as its main build tool along | 128 Chromium uses [Ninja](https://ninja-build.org) as its main build tool along |
| 128 with a tool called [GN](../tools/gn/docs/quick_start.md) to generate `.ninja` | 129 with a tool called [GN](../tools/gn/docs/quick_start.md) to generate `.ninja` |
| 129 files. You can create any number of *build directories* with different | 130 files. You can create any number of *build directories* with different |
| 130 configurations. To create a build directory: | 131 configurations. To create a build directory: |
| 131 | 132 |
| 132 ```shell | 133 ```shell |
| 133 $ gn gen out/Default | 134 $ gn gen out/Default |
| 134 ``` | 135 ``` |
| 135 | 136 |
| 136 * You only have to run this once for each new build directory, Ninja will | 137 * You only have to run this once for each new build directory, Ninja will |
| 137 update the build files as needed. | 138 update the build files as needed. |
| 138 * You can replace `Default` with another name, but | 139 * You can replace `Default` with another name, but |
| 139 it should be a subdirectory of `out`. | 140 it should be a subdirectory of `out`. |
| 140 * For other build arguments, including release settings, see [GN build | 141 * For other build arguments, including release settings, see [GN build |
| 141 configuration](https://www.chromium.org/developers/gn-build-configuration). | 142 configuration](https://www.chromium.org/developers/gn-build-configuration). |
| 142 The default will be a debug component build matching the current host | 143 The default will be a debug component build matching the current host |
| 143 operating system and CPU. | 144 operating system and CPU. |
| 144 * For more info on GN, run `gn help` on the command line or read the | 145 * For more info on GN, run `gn help` on the command line or read the |
| 145 [quick start guide](../tools/gn/docs/quick_start.md). | 146 [quick start guide](../tools/gn/docs/quick_start.md). |
| 146 | 147 |
| 147 ### Using the Visual Studio IDE | 148 ### Using the Visual Studio IDE |
| 148 | 149 |
| 149 If you want to use the Visual Studio IDE, use the `--ide` command line | 150 If you want to use the Visual Studio IDE, use the `--ide` command line |
| 150 argument to `gn gen` when you generate your output directory (as described on | 151 argument to `gn gen` when you generate your output directory (as described on |
| 151 the [get the code](http://dev.chromium.org/developers/how-tos/get-the-code) | 152 the [get the code](http://dev.chromium.org/developers/how-tos/get-the-code) |
| 152 page): | 153 page): |
| 153 | 154 |
| 154 ```gn gen --ide=vs out\Default | 155 ```shell |
| 155 devenv out\Default\all.sln | 156 $ gn gen --ide=vs out\Default |
| 157 $ devenv out\Default\all.sln |
| 156 ``` | 158 ``` |
| 157 | 159 |
| 158 GN will produce a file `all.sln` in your build directory. It will internally | 160 GN will produce a file `all.sln` in your build directory. It will internally |
| 159 use Ninja to compile while still allowing most IDE functions to work (there is | 161 use Ninja to compile while still allowing most IDE functions to work (there is |
| 160 no native Visual Studio compilation mode). If you manually run "gen" again you | 162 no native Visual Studio compilation mode). If you manually run "gen" again you |
| 161 will need to resupply this argument, but normally GN will keep the build and | 163 will need to resupply this argument, but normally GN will keep the build and |
| 162 IDE files up to date automatically when you build. | 164 IDE files up to date automatically when you build. |
| 163 | 165 |
| 164 The generated solution will contain several thousand projects and will be very | 166 The generated solution will contain several thousand projects and will be very |
| 165 slow to load. Use the `--filters` argument to restrict generating project files | 167 slow to load. Use the `--filters` argument to restrict generating project files |
| 166 for only the code you're interested in, although this will also limit what | 168 for only the code you're interested in, although this will also limit what |
| 167 files appear in the project explorer. A minimal solution that will let you | 169 files appear in the project explorer. A minimal solution that will let you |
| 168 compile and run Chrome in the IDE but will not show any source files is: | 170 compile and run Chrome in the IDE but will not show any source files is: |
| 169 | 171 |
| 170 ```gn gen --ide=vs --filters=//chrome out\Default``` | 172 ``` |
| 173 $ gn gen --ide=vs --filters=//chrome out\Default |
| 174 ``` |
| 171 | 175 |
| 172 There are other options for controlling how the solution is generated, run `gn | 176 There are other options for controlling how the solution is generated, run `gn |
| 173 help gen` for the current documentation. | 177 help gen` for the current documentation. |
| 174 | 178 |
| 175 ### Faster builds | 179 ### Faster builds |
| 176 | 180 |
| 177 * Reduce file system overhead by excluding build directories from | 181 * Reduce file system overhead by excluding build directories from |
| 178 antivirus and indexing software. | 182 antivirus and indexing software. |
| 179 * Store the build tree on a fast disk (preferably SSD). | 183 * Store the build tree on a fast disk (preferably SSD). |
| 180 | 184 |
| 181 Still, expect build times of 30 minutes to 2 hours when everything has to | 185 Still, expect build times of 30 minutes to 2 hours when everything has to |
| 182 be recompiled. | 186 be recompiled. |
| 183 | 187 |
| 184 ## Build Chromium | 188 ## Build Chromium |
| 185 | 189 |
| 186 Build Chromium (the "chrome" target) with Ninja using the command: | 190 Build Chromium (the "chrome" target) with Ninja using the command: |
| 187 | 191 |
| 188 $ ninja -C out\Default chrome | 192 ```shell |
| 193 $ ninja -C out\Default chrome |
| 194 ``` |
| 189 | 195 |
| 190 You can get a list of all of the other build targets from GN by running | 196 You can get a list of all of the other build targets from GN by running |
| 191 `gn ls out/Default` from the command line. To compile one, pass to Ninja | 197 `gn ls out/Default` from the command line. To compile one, pass to Ninja |
| 192 the GN label with no preceding "//" (so for `//chrome/test:unit_tests` | 198 the GN label with no preceding "//" (so for `//chrome/test:unit_tests` |
| 193 use ninja -C out/Default chrome/test:unit_tests`). | 199 use ninja -C out/Default chrome/test:unit_tests`). |
| 194 | 200 |
| 195 ## Run Chromium | 201 ## Run Chromium |
| 196 | 202 |
| 197 Once it is built, you can simply run the browser: | 203 Once it is built, you can simply run the browser: |
| 198 | 204 |
| 199 $ out\Default\chrome.exe | 205 ```shell |
| 206 $ out\Default\chrome.exe |
| 207 ``` |
| 208 |
| 209 (The ".exe" suffix in the command is actually optional). |
| 200 | 210 |
| 201 ## Running test targets | 211 ## Running test targets |
| 202 | 212 |
| 203 You can run the tests in the same way. You can also limit which tests are | 213 You can run the tests in the same way. You can also limit which tests are |
| 204 run using the `--gtest_filter` arg, e.g.: | 214 run using the `--gtest_filter` arg, e.g.: |
| 205 | 215 |
| 206 $ ninja -C out\Default unit_tests --gtest_filter="PushClientTest.*" | 216 ```shell |
| 217 $ out\Default\unit_tests.exe --gtest_filter="PushClientTest.*" |
| 218 ``` |
| 207 | 219 |
| 208 You can find out more about GoogleTest at its | 220 You can find out more about GoogleTest at its |
| 209 [GitHub page](https://github.com/google/googletest). | 221 [GitHub page](https://github.com/google/googletest). |
| 210 | 222 |
| 211 ## Update your checkout | 223 ## Update your checkout |
| 212 | 224 |
| 213 To update an existing checkout, you can run | 225 To update an existing checkout, you can run |
| 214 | 226 |
| 215 $ git rebase-update | 227 ```shell |
| 216 $ gclient sync | 228 $ git rebase-update |
| 229 $ gclient sync |
| 230 ``` |
| 217 | 231 |
| 218 The first command updates the primary Chromium source repository and rebases | 232 The first command updates the primary Chromium source repository and rebases |
| 219 any of your local branches on top of tip-of-tree (aka the Git branch `origin/mas
ter`). | 233 any of your local branches on top of tip-of-tree (aka the Git branch `origin/mas
ter`). |
| 220 If you don't want to use this script, you can also just use `git pull` or | 234 If you don't want to use this script, you can also just use `git pull` or |
| 221 other common Git commands to update the repo. | 235 other common Git commands to update the repo. |
| 222 | 236 |
| 223 The second command syncs the subrepositories to the appropriate versions and | 237 The second command syncs the subrepositories to the appropriate versions and |
| 224 re-runs the hooks as needed. | 238 re-runs the hooks as needed. |
| OLD | NEW |