Skip to content

Latest commit

 

History

History
94 lines (70 loc) · 6.79 KB

building-msvc.md

File metadata and controls

94 lines (70 loc) · 6.79 KB

Build instructions for Visual Studio 2017

Install necessary software

  • Install Visual Studio 2017
    • Currently Bettergram will not build with version 15.7, so you must install a previous version of Visual Studio. You can find previous versions here: https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017 (this problem may be resolved in later builds as well)
    • Make sure that under Workloads "Desktop development with C++" is selected
    • Make sure that under Individual Components -> Compilers, build tools and runtimes "Windows XP Support for C++" is selected as well as the V140 toolset for desktop
    • If Visual Studio is already installed, go to Tools -> Get Tools and Features... and make sure that the above options are installed. If they aren't, select them and click Modify
  • Install Git and make sure it is added to the PATH
  • Ensure that you have Windows 10 SDK 10.0.16299 installed
    • If you installed version 15.6 of Visual Studio 2017, this is already installed
    • If you need to figure out if this is installed or not, you can create a new Windows Desktop C++ application, and then go into project properties and look at the target SDK dropdown. If 10.0.16299 appears in the list, then it is installed on your machine
    • If it isn't installed, download and install it: https://developer.microsoft.com/en-us/windows/downloads/sdk-archive

Prepare folder

Choose an empty folder for the future build, for example C:\Bettergram. It will be referred to as BuildPath in the rest of this document. Inside of BuildPath create a BuildPath\ThirdParty folder. The BuildPath folder cannot have any spaces in the entire path or the build process will fail.

Create a BuildPath\TelegramPrivate folder. Obtain a copy of custom_api_id.h and place it into the TelegramPrivate folder. This file will not be stored in the repository, but it is necessary to create a build of the project (see instructions below for how to build a non-commercial build of the project without having access to this file).

All commands will be launched from x86 Native Tools Command Prompt for VS 2017.bat (should be in Start Menu > Visual Studio 2017 menu folder). Pay attention not to use any other Command Prompt.

Install third party software

Open x86 Native Tools Command Prompt for VS 2017.bat, go to BuildPath and run

cd ThirdParty
git clone https://chromium.googlesource.com/external/gyp
cd gyp
git checkout a478c1ab51

then close the window

Add GYP, Ninja and Perl to your PATH:

  • Open Control Panel -> System -> Advanced system settings
  • Press Environment Variables...
  • Select Path
  • Press Edit
  • Add BuildPath\ThirdParty\gyp value
  • Add BuildPath\ThirdParty\Ninja value
  • And please ensure that perl is in the PATH variable. If you have installed it in the BuildPath directory, then add BuildPath\ThirdParty\Perl to the PATH variable.

Clone source code and prepare libraries

Open x86 Native Tools Command Prompt for VS 2017.bat, go to BuildPath and run:

git clone --recursive https://github.com/bettergram/bettergram.git
copy bettergram\build_bettergram.bat .
build_bettergram

Build the project

If you want to pass a build define (like TDESKTOP_DISABLE_AUTOUPDATE or TDESKTOP_DISABLE_NETWORK_PROXY), call set TDESKTOP_BUILD_DEFINES=TDESKTOP_DISABLE_AUTOUPDATE,TDESKTOP_DISABLE_NETWORK_PROXY,... (comma seperated string)

After, call gyp\refresh.bat once again.

  • Open BuildPath\bettergram\Telegram\Telegram.sln in Visual Studio 2017
  • Select Telegram project and press Build > Build Telegram (Debug and Release configurations)
  • The result Telegram.exe will be located in BuildPath\bettergram\out\Debug (and Release)

If you do not have access to custom_api_id.h, you can build a test version of the project by editing the Telegram.gyp file and commenting out the define: CUSTOM_API_ID (be careful not to check this change in to the repository). Then you must execute the refresh.bat file before building. This build should only be used for testing.

Qt Visual Studio Tools

For better debugging you may want to install Qt Visual Studio Tools:

  • Open Tools -> Extensions and Updates...
  • Go to Online tab
  • Search for Qt
  • Install Qt Visual Studio Tools extension