## These are instruction for building Thorium for Windows, natively on Windows. Preliminary file for @gz83, to be eventually migrated to a Wiki with building instructions for all paltforms.
## Copyright (c) 2022 Alex313031
## Preparatory setup
First, we need to install depot_tools and Visual Studio. depot_tools is a .zip that contains tools for all Google projects like Chromium, ChromiumOS, NaCl, V8, Infra, Android, Google Cloud, and Fuschia.
We will be in general following instructions from > https://chromium.googlesource.com/chromium/src/+/main/docs/windows_build_instructions.md
Visual Studio 2019 or 2022 is needed, and the Windows SDK version 10.0.20348.0 is needed along with its Debugging Tools.
EVERYTHING in this document is to be done in command prompt. No powershell, no windows terminal (Win 11).
The easiest way to do this is (and even if you already have Visual Studio installed, go ahead and redownload the latest installer to do this)
(VISUAL_STUDIO_INSTALLER is the actual path/name of the installer .exe)
As noted above The SDK Debugging Tools must also be installed. If the Windows 10 SDK was installed via the Visual Studio installer, then they can be installed by going to:
Control Panel → Programs → Programs and Features → Select the “Windows Software Development Kit” → Change → Change → Check “Debugging Tools For Windows” → Change.
Then download depot_tools. We are assuming that depot_tools, chromium, and thorium will all be in C:\src\.
Then, If you have Administrator access, Modify the PATH system variable and put C:\src\depot_tools at the front (or at least in front of any directory that might already have a copy of Python or Git).
Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN environment variable in the same way, and set it to 0. This tells depot_tools to use your locally installed version of Visual Studio
(by default, depot_tools will try to use a google-internal version).
Also, add a NINJA_SUMMARIZE_BUILD environment variable the same way, and set it to 1.
Then, go to C:\src in cmd, and run
gclient
Now, lets configure git (you can skip the user.name and user.email if it is already configured)
Good, now we have a full Chromium checkout ready to be built, but to turn it into Thorium, we must copy the Thorium sources over the Chromium tree.
## Thorium Setup
So, lets download Thorium in C:\src
git clone https://github.com/Alex313031/Thorium.git or download the .zip and unpack it there > https://github.com/Alex313031/Thorium/archive/refs/heads/main.zip
Now, go back to C:\chromium\src
We are going to download the PGO profile (which changes with every release) so that we can set it in our args.gn file, which ninja (the build system) parses before compiling. So run
You can also add API Keys to the top three lines of this file to enable Google Sync, Translate, etc. (Out of the scope of this article, for help, contact me.)
Now, we are going to copy the Thorium sources. Select (via Ctrl + Left Mouse button) these folders in C:\src\Thorium:
ash, base, build, chrome, components, content, extensions, media, net, sandbox, third_party, tools, ui, v8 as well as the BUILD.gn in the root of Thorium.
It will pull up notepad. Copy and paste the contents of the win_args.gn we just edited into notepad, save it, and then exit notepad. Cmd will show "generating files..."
#NOTE: For AVX2 you should use the win_AVX2_args.gn and for ARM you should use the win_ARM_args.gn.
But wait, we also need to cherry pick some files from Thorium and copy them into C:\src\chromium\src\out\thorium (These are things like logos, the pak binaries, etc. that are thorium specific)
content_shell\thorium-devtools.ico and content_shell\thorium-devtools.png AND
You can substitute the -j# for the number of jobs. I use 8 because I have an 8 core cpu. Do not use a number more than the number of threads your CPU has.
I rename it to thorium_mini_installer.exe or thorium_avx2_mini_installer.exe for releases. Just double click to install Thorium to C:\Users\$USERNAME\AppData\Local\Thorium
Speaking of which! Thorium by default compiles with AVX and AES. To make the AVX2 version of it, you will follow all the steps above, except before running gn args out\thorium, we need to download the avx2 sources. You should also use the win_AVX2_args.gn in the Thorium-AVX2 repo.