2021-07-20 04:41:11 +02:00
# Build instructions for Windows
2016-07-03 15:17:22 +02:00
2017-02-16 11:57:53 +01:00
- [Prepare folder ](#prepare-folder )
2017-09-06 11:12:27 +02:00
- [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 )
2016-07-03 15:17:22 +02:00
## Prepare folder
2014-06-25 22:15:34 +02:00
2021-11-26 15:13:58 +01:00
The build is done in **Visual Studio 2022** with **10.0.22000.0** SDK version.
2017-09-28 11:40:26 +02: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**.
2016-10-11 11:56:51 +02:00
2021-11-26 15:13:58 +01:00
All commands (if not stated otherwise) will be launched from **x86 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.
2014-06-25 22:15:34 +02:00
2018-11-04 11:29:30 +01: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].
2017-09-06 11:12:27 +02:00
## Install third party software
2017-04-14 11:58:10 +02:00
2022-12-19 17:48:59 +01:00
* Download **Python 3.10** installer from [https://www.python.org/downloads/ ](https://www.python.org/downloads/ ) and install it with adding to PATH.
* Download **CMake 3.21 or later** installer from [https://cmake.org/download/ ](https://cmake.org/download/ ) and install it.
2020-07-04 01:40:48 +02:00
* Download **Git** installer from [https://git-scm.com/download/win ](https://git-scm.com/download/win ) and install it.
2017-02-16 11:57:53 +01:00
2021-08-25 11:46:32 +02:00
## Clone source code and prepare libraries
2017-02-16 11:57:53 +01:00
2021-11-26 15:13:58 +01:00
Open **x86 Native Tools Command Prompt for VS 2022.bat** , go to ** *BuildPath*** and run
2014-06-25 22:15:34 +02:00
2021-08-25 11:46:32 +02:00
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
tdesktop\Telegram\build\prepare\win.bat
2020-07-09 19:38:26 +02:00
2017-09-06 11:12:27 +02:00
## Build the project
2017-02-18 20:23:50 +01:00
2019-12-31 13:08:56 +01:00
Go to ** *BuildPath*\\tdesktop\\Telegram** and run (using [your **api_id** and **api_hash** ](#obtain-your-api-credentials ))
2017-02-18 20:23:50 +01:00
2022-08-11 01:30:32 +02:00
configure.bat -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH
2016-08-14 20:41:31 +02:00
2021-11-26 15:13:58 +01:00
* Open ** *BuildPath*\\tdesktop\\out\\Telegram.sln** in Visual Studio 2022
2017-09-06 11:12:27 +02: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** )
2016-08-14 20:41:31 +02:00
2017-09-06 11:12:27 +02:00
### Qt Visual Studio Tools
2016-08-14 20:41:31 +02:00
2017-09-06 11:12:27 +02:00
For better debugging you may want to install Qt Visual Studio Tools:
2016-08-14 20:41:31 +02:00
2020-06-10 06:08:51 +02:00
* Open **Extensions** -> **Manage Extensions**
2017-09-06 11:12:27 +02:00
* Go to **Online** tab
* Search for **Qt**
* Install **Qt Visual Studio Tools** extension
2018-11-04 11:29:30 +01:00
[api_credentials]: api_credentials.md