Skip to content

Latest commit

 

History

History
168 lines (106 loc) · 7.41 KB

MSVC.md

File metadata and controls

168 lines (106 loc) · 7.41 KB

##Build instructions for Visual Studio 2013

###Prepare folder

Choose a folder for the future build, for example **D:\TBuild**. There you will have two folders, Libraries for third-party libs and tdesktop (or tdesktop-master) for the app.

###Clone source code

By git – in Git Bash go to /d/tbuild and run

 git clone https://github.com/telegramdesktop/tdesktop.git

or download in ZIP and extract to **D:\TBuild**, rename tdesktop-master to tdesktop to have D:\TBuild\tdesktop\Telegram.sln solution

###Prepare libraries

####OpenSSL 1.0.1h

https://www.openssl.org/related/binaries.html > OpenSSL for Windows > Download Win32 OpenSSL v1.0.1h (16 Mb)

Install to D:\TBuild\Libraries\OpenSSL-Win32, while installing Copy OpenSSL DLLs to choose The OpenSSL binaries (/bin) directory

####LZMA SDK 9.20

http://www.7-zip.org/sdk.html > Download LZMA SDK (C, C++, C#, Java) 9.20

Extract to D:\TBuild\Libraries

#####Building library

  • Open in VS2013 D:\TBuild\Libraries\lzma\C\Util\LzmaLib\LzmaLib.dsw > One-way upgrade – OK
  • For Debug and Release configurations
    • LzmaLib Properties > General > Configuration Type = Static library (.lib)OK
    • LzmaLib Properties > Librarian > General > Target Machine = MachineX86 (/MACHINE:X86)OK
  • Build Debug configuration
  • Build Release configuration

####zlib 1.2.8

http://www.zlib.net/ > Download zlib source code, version 1.2.8, zipfile format

Extract to *D:\TBuild\Libraries*

#####Building library

  • Open in VS2013 D:\TBuild\Libraries\zlib-1.2.8\contrib\vstudio\vc11\zlibvc.sln > One-way upgrade – OK
  • We are interested only in zlibstat project, but it depends on some custom pre-build step, so build all
  • For Debug configuration
    • zlibstat Properties > C/C++ > Code Generation > Runtime Library = Multi-threaded Debug (/MTd)OK
  • For Release configuration
    • zlibstat Properties > C/C++ > Code Generation > Runtime Library = Multi-threaded (/MT)OK
  • Build Solution for Debug configuration – only zlibstat project builds successfully
  • Build Solution for Release configuration – only zlibstat project builds successfully

####libexif 0.6.20

Get sources from https://github.com/telegramdesktop/libexif-0.6.20, by git – in Git Bash go to /d/tbuild/libraries and run

git clone https://github.com/telegramdesktop/libexif-0.6.20.git

or download in ZIP and extract to **D:\TBuild\Libraries**, rename libexif-0.6.20-master to libexif-0.6.20 to have D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln solution

#####Building library

  • Open in VS2013 D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln
  • Build Debug configuration
  • Build Release configuration

####OpenAL Soft

Get sources by git – in Git Bash go to /d/tbuild/libraries and run

git clone git://repo.or.cz/openal-soft.git

to have D:\TBuild\Libraries\openal-soft\CMakeLists.txt

#####Building library

  • Install CMake
  • Go in cmd to *D:\TBuild\Libraries\openal-soft\build*
  • Run cmake -G "Visual Studio 12 2013" -D LIBTYPE:STRING=STATIC ..
  • Open in VS2013 D:\TBuild\Libraries\openal-soft\build\OpenAL.sln
  • For Debug configuration
    • OpenAL32 Properties > C/C++ > Code Generation > Runtime Library = Multi-threaded Debug (/MTd)OK
    • common Properties > C/C++ > Code Generation > Runtime Library = Multi-threaded Debug (/MTd)OK
  • For Release configuration
    • OpenAL32 Properties > C/C++ > Code Generation > Runtime Library = Multi-threaded (/MT)OK
    • common Properties > C/C++ > Code Generation > Runtime Library = Multi-threaded (/MT)OK

####libogg 1.3.2

Get sources from http://xiph.org/downloads/ – in ZIP and extract to *D:\TBuild\Libraries*

#####Building library

  • Open in VS2013 D:\TBuild\Libraries\libogg-1.3.2\win32\VS2010\libogg_static.sln > One-way upgrade – OK
  • Build Debug configuration
  • Build Release configuration

####Opus codec, opusfile

Get sources by git – in Git Bash go to /d/tbuild/libraries and run

git clone git://git.opus-codec.org/opus.git
git clone git://git.xiph.org/opusfile.git

to have D:\TBuild\Libraries\opus\win32

#####Building libraries

  • Open in VS2013 D:\TBuild\Libraries\opus\win32\VS2010\opus.sln > One-way upgrade – OK
  • Build Debug configuration
  • Build Release configuration
  • Open in VS2013 D:\TBuild\Libraries\opusfile\win32\VS2010\opusfile.sln > One-way upgrade – OK
  • For Debug and Release configurations
    • opusfile > C/C++ > General > Additional include directories > Add ../../../libogg-1.3.2/include;
  • Build Debug configuration
  • Build Release configuration

####Qt 5.4.0, slightly patched

http://download.qt-project.org/official_releases/qt/5.4/5.4.0/single/qt-everywhere-opensource-src-5.4.0.zip

Extract to **D:\TBuild\Libraries**, rename qt-everywhere-opensource-src-5.4.0 to QtStatic to have *D:\TBuild\Libraries\QtStatic\qtbase* folder

Apply patch

  • OR copy (with overwrite!) everything from *D:\TBuild\tdesktop\_qt_5_4_0_patch* to *D:\TBuild\Libraries\QtStatic*

  • OR copy D:\TBuild\tdesktop\_qt_5_4_0_patch.diff to **D:\TBuild\Libraries\QtStatic**, go there in Git Bash and run

    git apply _qt_5_4_0_patch.diff

#####Building library

There go to Qt directory

D:
cd TBuild\Libraries\QtStatic

and after that run configure

configure -debug-and-release -opensource -confirm-license -static -I "D:\TBuild\Libraries\OpenSSL-Win32\include" -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -l Gdi32 -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="D:\TBuild\Libraries\OpenSSL-Win32\lib\VC\static\ssleay32MTd.lib D:\TBuild\Libraries\OpenSSL-Win32\lib\VC\static\libeay32MTd.lib" OPENSSL_LIBS_RELEASE="D:\TBuild\Libraries\OpenSSL-Win32\lib\VC\static\ssleay32MT.lib D:\TBuild\Libraries\OpenSSL-Win32\lib\VC\static\libeay32MT.lib" -mp -nomake examples -nomake tests -platform win32-msvc2013

to configure Qt build. After configuration is complete run

nmake module-qtbase module-qtimageformats
nmake module-qtbase-install_subtargets module-qtimageformats-install_subtargets

building (nmake command) will take really long time.

####Qt Visual Studio Addin 1.2.3

http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe

Close all VS2013 instances and install to default location

###Building Telegram Desktop

  • Launch VS2013 for configuring Qt Addin
  • QT5 > Qt Options > Add
    • Version name: QtStatic.5.4.0
    • Path: D:\TBuild\Libraries\QtStatic\qtbase
  • Default Qt/Win version: QtStatic.5.4.0OK
  • File > Open > Project/Solution > D:\TBuild\tdesktop\Telegram.sln
  • Build \ Build Solution (Debug and Release configurations)