tdlight/example/uwp
2023-09-22 16:22:03 +03:00
..
app Remove some getAuthorizationState usages. 2023-01-12 22:25:47 +03:00
[Content_Types].xml UWP: build scripts 2018-02-28 21:19:33 +03:00
build.ps1 Exit UWP build early if TDLib build failed. 2023-05-03 14:46:03 +03:00
extension.vsixmanifest Update version to 1.8.19. 2023-09-22 16:22:03 +03:00
LICENSE_1_0.txt Update TDLib UWP manifest. 2018-03-17 02:00:09 +03:00
README.md Use specific vcpkg version in C# and UWP example READMEs. 2023-05-10 16:36:52 +03:00
SDKManifest.xml Update TDLib UWP manifest. 2018-03-17 02:00:09 +03:00
Telegram.Td.UWP.nuspec Update version to 1.8.19. 2023-09-22 16:22:03 +03:00
Telegram.Td.UWP.targets Fixed hardcoded architecture in targets 2023-05-22 17:12:50 +03:00

TDLib Universal Windows Platform example

This is an example of building TDLib SDK for Universal Windows Platform and an example of its usage from C#.

Building SDK

  • Download and install Microsoft Visual Studio 2015+ with Windows 10 SDK. We recommend to use the latest available versions of Microsoft Visual Studio and Windows 10 SDK.
  • Download and install CMake.
  • Install zlib and openssl for all UWP architectures and gperf for x86 using vcpkg:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
git checkout 1b1ae50e1a69f7c659bd7d731e80b358d21c86ad
.\bootstrap-vcpkg.bat
.\vcpkg.exe install gperf:x86-windows openssl:arm-uwp openssl:arm64-uwp openssl:x64-uwp openssl:x86-uwp zlib:arm-uwp zlib:arm64-uwp zlib:x64-uwp zlib:x86-uwp
  • (Optional. For XML documentation generation.) Download PHP. Add the path to php.exe to the PATH environment variable.
  • Download and install 7-Zip archiver, which is used by the build.ps1 script to create a Telegram.Td.UWP Visual Studio Extension. Add the path to 7z.exe to the PATH environment variable. Alternatively build.ps1 supports compressing using WinRAR with option -compress winrar and compressing using zip with -compress zip.
  • Build TDLib using provided build.ps1 script (TDLib should be built 6 times for multiple platforms in Debug and Release configurations, so it make take few hours). Pass path to vcpkg.exe as -vcpkg-root argument, for example:
powershell -ExecutionPolicy ByPass .\build.ps1 -vcpkg_root C:\vcpkg

If you need to restart the build from scratch, call .\build.ps1 -vcpkg_root C:\vcpkg -mode clean first.

  • Install Visual Studio Extension "TDLib for Universal Windows Platform" located at build-uwp\vsix\tdlib.vsix, which was created on the previous step by build.ps1 script.

After this TDLib can be used from any UWP project, built in Visual Studio.

Alternatively, you can build TDLib as a NuGet package, adding the option -nupkg to the .\build.ps1 script invocation. The resulting package will be placed in the directory build-uwp\nupkg.

Example of usage

The app/ directory contains a simple example of a C# application for Universal Windows Platform. Just open it with Visual Studio 2015 or later and run.