2021-07-20 02:41:11 +00:00
# Build instructions for Windows 64-bit
2020-11-06 17:22:02 +00:00
- [Prepare folder ](#prepare-folder )
- [Install third party software ](#install-third-party-software )
- [Clone source code and prepare libraries ](#clone-source-code-and-prepare-libraries )
- [Build the project ](#build-the-project )
- [Qt Visual Studio Tools ](#qt-visual-studio-tools )
## Prepare folder
2021-11-26 14:13:58 +00:00
The build is done in **Visual Studio 2022** with **10.0.22000.0** SDK version.
2020-11-06 17:22:02 +00:00
Choose an empty folder for the future build, for example **D:\\TBuild** . It will be named ** *BuildPath*** in the rest of this document. Create two folders there, ** *BuildPath*\\ThirdParty** and ** *BuildPath*\\Libraries**.
2021-11-26 14:13:58 +00:00
All commands (if not stated otherwise) will be launched from **x64 Native Tools Command Prompt for VS 2022.bat** (should be in **Start Menu > Visual Studio 2022** menu folder). Pay attention not to use any other Command Prompt.
2020-11-06 17:22:02 +00:00
### Obtain your API credentials
You will require **api_id** and **api_hash** to access the Telegram API servers. To learn how to obtain them [click here][api_credentials].
## Install third party software
2022-09-22 11:31:46 +00:00
* Download **Python 3.10** installer from [https://www.python.org/downloads/ ](https://www.python.org/downloads/ ) and install to ** *BuildPath*\\ThirdParty\\Python39** with adding to PATH
2021-11-26 14:13:58 +00:00
* Download **CMake 3.21 or later** installer from [https://cmake.org/download/ ](https://cmake.org/download/ ) and install to ** *BuildPath*\\ThirdParty\\cmake**
2020-11-06 17:22:02 +00:00
* Download **Git** installer from [https://git-scm.com/download/win ](https://git-scm.com/download/win ) and install it.
2021-11-26 14:13:58 +00:00
Open **x64 Native Tools Command Prompt for VS 2022.bat** , go to ** *BuildPath*** and run
2020-11-06 17:22:02 +00:00
2022-09-22 11:31:46 +00:00
python -m pip install pywin32 six
2020-11-06 17:22:02 +00:00
2021-08-25 09:46:32 +00:00
## Clone source code and prepare libraries
2020-11-06 17:22:02 +00:00
2021-11-26 14:13:58 +00:00
Open **x64 Native Tools Command Prompt for VS 2022.bat** , go to ** *BuildPath*** and run
2020-11-06 17:22:02 +00:00
2021-08-25 09:46:32 +00:00
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
tdesktop\Telegram\build\prepare\win.bat
2020-11-06 17:22:02 +00:00
## Build the project
Go to ** *BuildPath*\\tdesktop\\Telegram** and run (using [your **api_id** and **api_hash** ](#obtain-your-api-credentials ))
2022-08-10 23:30:32 +00:00
configure.bat x64 -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH
2020-11-06 17:22:02 +00:00
2021-11-26 14:13:58 +00:00
* Open ** *BuildPath*\\tdesktop\\out\\Telegram.sln** in Visual Studio 2022
2020-11-06 17:22:02 +00:00
* Select Telegram project and press Build > Build Telegram (Debug and Release configurations)
* The result Telegram.exe will be located in **D:\TBuild\tdesktop\out\Debug** (and **Release** )
### Qt Visual Studio Tools
For better debugging you may want to install Qt Visual Studio Tools:
* Open **Extensions** -> **Manage Extensions**
* Go to **Online** tab
* Search for **Qt**
* Install **Qt Visual Studio Tools** extension
[api_credentials]: api_credentials.md