diff --git a/.gitignore b/.gitignore index f2db043b89..bfc3d50815 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +/out/ +/Debug/ +/Release/ +/Deploy/ /Telegram/build/target /Telegram/GeneratedFiles/ /Telegram/SourceFiles/art/grid.png @@ -13,7 +17,8 @@ /Telegram/Resources/art/sprite_125x.png /Telegram/Resources/art/sprite_150x.png /Telegram/*.user -*.vcxproj.user +*.vcxproj* +*.sln *.suo *.sdf *.opensdf diff --git a/Telegram.sln b/Telegram.sln deleted file mode 100644 index 1652e9f536..0000000000 --- a/Telegram.sln +++ /dev/null @@ -1,106 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Telegram", "Telegram\Telegram.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}" - ProjectSection(ProjectDependencies) = postProject - {E4DF8176-4DEF-4859-962F-B497E3E7A323} = {E4DF8176-4DEF-4859-962F-B497E3E7A323} - {E417CAA4-259B-4C99-88E3-805F1300E8EB} = {E417CAA4-259B-4C99-88E3-805F1300E8EB} - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6} = {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaEmoji", "Telegram\MetaEmoji.vcxproj", "{EB7D16AC-EACF-4577-B05A-F28E5F356794}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Updater", "Telegram\Updater.vcxproj", "{6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaLang", "Telegram\MetaLang.vcxproj", "{E417CAA4-259B-4C99-88E3-805F1300E8EB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "codegen", "codegen", "{2F863EAD-33C9-4014-A573-93F085BA9CB1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Packer", "Telegram\Packer.vcxproj", "{56A9A4B2-21E5-4360-AFA8-85B43AC43B08}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "codegen_style", "Telegram\build\vc\codegen_style\codegen_style.vcxproj", "{E4DF8176-4DEF-4859-962F-B497E3E7A323}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "codegen_numbers", "Telegram\build\vc\codegen_numbers\codegen_numbers.vcxproj", "{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Deploy|Win32 = Deploy|Win32 - Deploy|x64 = Deploy|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.ActiveCfg = Debug|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.Build.0 = Debug|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.Deploy.0 = Debug|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.ActiveCfg = Debug|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Deploy|Win32.ActiveCfg = Deploy|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Deploy|Win32.Build.0 = Deploy|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Deploy|x64.ActiveCfg = Release|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.ActiveCfg = Release|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.Build.0 = Release|Win32 - {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|Win32 - {EB7D16AC-EACF-4577-B05A-F28E5F356794}.Debug|Win32.ActiveCfg = Debug|Win32 - {EB7D16AC-EACF-4577-B05A-F28E5F356794}.Debug|x64.ActiveCfg = Debug|Win32 - {EB7D16AC-EACF-4577-B05A-F28E5F356794}.Deploy|Win32.ActiveCfg = Deploy|Win32 - {EB7D16AC-EACF-4577-B05A-F28E5F356794}.Deploy|x64.ActiveCfg = Release|Win32 - {EB7D16AC-EACF-4577-B05A-F28E5F356794}.Release|Win32.ActiveCfg = Release|Win32 - {EB7D16AC-EACF-4577-B05A-F28E5F356794}.Release|x64.ActiveCfg = Release|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Debug|Win32.ActiveCfg = Debug|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Debug|Win32.Build.0 = Debug|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Debug|x64.ActiveCfg = Debug|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Deploy|Win32.ActiveCfg = Deploy|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Deploy|Win32.Build.0 = Deploy|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Deploy|x64.ActiveCfg = Release|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Release|Win32.ActiveCfg = Release|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Release|Win32.Build.0 = Release|Win32 - {6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Release|x64.ActiveCfg = Release|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Debug|Win32.ActiveCfg = Debug|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Debug|Win32.Build.0 = Debug|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Debug|x64.ActiveCfg = Debug|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Deploy|Win32.ActiveCfg = Deploy|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Deploy|Win32.Build.0 = Deploy|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Deploy|x64.ActiveCfg = Release|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Release|Win32.ActiveCfg = Release|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Release|Win32.Build.0 = Release|Win32 - {E417CAA4-259B-4C99-88E3-805F1300E8EB}.Release|x64.ActiveCfg = Release|Win32 - {56A9A4B2-21E5-4360-AFA8-85B43AC43B08}.Debug|Win32.ActiveCfg = Debug|Win32 - {56A9A4B2-21E5-4360-AFA8-85B43AC43B08}.Debug|x64.ActiveCfg = Debug|Win32 - {56A9A4B2-21E5-4360-AFA8-85B43AC43B08}.Deploy|Win32.ActiveCfg = Deploy|Win32 - {56A9A4B2-21E5-4360-AFA8-85B43AC43B08}.Deploy|Win32.Build.0 = Deploy|Win32 - {56A9A4B2-21E5-4360-AFA8-85B43AC43B08}.Deploy|x64.ActiveCfg = Release|Win32 - {56A9A4B2-21E5-4360-AFA8-85B43AC43B08}.Release|Win32.ActiveCfg = Release|Win32 - {56A9A4B2-21E5-4360-AFA8-85B43AC43B08}.Release|x64.ActiveCfg = Release|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Debug|Win32.ActiveCfg = Debug|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Debug|Win32.Build.0 = Debug|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Debug|x64.ActiveCfg = Debug|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Deploy|Win32.ActiveCfg = Deploy|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Deploy|Win32.Build.0 = Deploy|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Deploy|x64.ActiveCfg = Release|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Deploy|x64.Build.0 = Release|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Release|Win32.ActiveCfg = Release|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Release|Win32.Build.0 = Release|Win32 - {E4DF8176-4DEF-4859-962F-B497E3E7A323}.Release|x64.ActiveCfg = Release|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Debug|Win32.ActiveCfg = Debug|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Debug|Win32.Build.0 = Debug|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Debug|x64.ActiveCfg = Debug|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Deploy|Win32.ActiveCfg = Deploy|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Deploy|Win32.Build.0 = Deploy|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Deploy|x64.ActiveCfg = Release|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Deploy|x64.Build.0 = Release|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Release|Win32.ActiveCfg = Release|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Release|Win32.Build.0 = Release|Win32 - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Release|x64.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {E4DF8176-4DEF-4859-962F-B497E3E7A323} = {2F863EAD-33C9-4014-A573-93F085BA9CB1} - {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6} = {2F863EAD-33C9-4014-A573-93F085BA9CB1} - EndGlobalSection -EndGlobal diff --git a/Telegram/SourceFiles/_other/genlang.cpp b/Telegram/SourceFiles/_other/genlang.cpp index ec073ac35f..f8924fadb2 100644 --- a/Telegram/SourceFiles/_other/genlang.cpp +++ b/Telegram/SourceFiles/_other/genlang.cpp @@ -777,7 +777,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ cpp.close(); } if (write_cpp) { - cout << "lang.cpp updated, writing " << keysOrder.size() << " rows.\n"; if (!cpp.open(QIODevice::WriteOnly)) throw Exception("Could not open lang.cpp for writing!"); if (cpp.write(cppText) != cppText.size()) throw Exception("Could not open lang.cpp for writing!"); } @@ -791,7 +790,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ h.close(); } if (write_h) { - cout << "lang.h updated, writing " << keysOrder.size() << " rows.\n"; if (!h.open(QIODevice::WriteOnly)) throw Exception("Could not open lang.h for writing!"); if (h.write(hText) != hText.size()) throw Exception("Could not open lang.h for writing!"); } diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp index 9805a71319..08f17ccb5c 100644 --- a/Telegram/SourceFiles/_other/packer.cpp +++ b/Telegram/SourceFiles/_other/packer.cpp @@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "packer.h" -#include +#include #ifdef Q_OS_MAC Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) diff --git a/Telegram/SourceFiles/codegen/style/options.cpp b/Telegram/SourceFiles/codegen/style/options.cpp index 4052b401d2..433c109137 100644 --- a/Telegram/SourceFiles/codegen/style/options.cpp +++ b/Telegram/SourceFiles/codegen/style/options.cpp @@ -47,6 +47,14 @@ Options parseOptions() { if (arg == "--rebuild") { result.rebuildDependencies = true; + // Skip generating style modules + } else if (arg == "--skip-styles") { + result.skipStyles = true; + + // Skip generating sprite_125x.png and sprite_150x.png + } else if (arg == "--skip-sprites") { + result.skipSprites = true; + // Include paths } else if (arg == "-I") { if (++i == count) { diff --git a/Telegram/SourceFiles/codegen/style/options.h b/Telegram/SourceFiles/codegen/style/options.h index 34746ee2d8..f1f591b7cd 100644 --- a/Telegram/SourceFiles/codegen/style/options.h +++ b/Telegram/SourceFiles/codegen/style/options.h @@ -31,6 +31,8 @@ struct Options { QString outputPath = "."; QString inputPath; bool rebuildDependencies = false; + bool skipStyles = false; + bool skipSprites = false; }; // Parsing failed if inputPath is empty in the result. diff --git a/Telegram/SourceFiles/codegen/style/processor.cpp b/Telegram/SourceFiles/codegen/style/processor.cpp index 39f02c41e0..4b534e7c2b 100644 --- a/Telegram/SourceFiles/codegen/style/processor.cpp +++ b/Telegram/SourceFiles/codegen/style/processor.cpp @@ -65,36 +65,40 @@ int Processor::launch() { } bool Processor::write(const structure::Module &module) const { - QDir dir(options_.outputPath); - if (!dir.mkpath(".")) { - common::logError(kErrorCantWritePath, "Command Line") << "can not open path for writing: " << dir.absolutePath().toStdString(); - return false; + bool forceReGenerate = false; + bool onlyStyles = options_.skipSprites; + bool onlySprites = options_.skipStyles; + if (!onlyStyles) { + SpriteGenerator spriteGenerator(module, forceReGenerate); + if (!spriteGenerator.writeSprites()) { + return false; + } } + if (!onlySprites) { + QDir dir(options_.outputPath); + if (!dir.mkpath(".")) { + common::logError(kErrorCantWritePath, "Command Line") << "can not open path for writing: " << dir.absolutePath().toStdString(); + return false; + } - QFileInfo srcFile(module.filepath()); - QString dstFilePath = dir.absolutePath() + '/' + destFileBaseName(module); + QFileInfo srcFile(module.filepath()); + QString dstFilePath = dir.absolutePath() + '/' + destFileBaseName(module); - bool forceReGenerate = false;// !options_.rebuildDependencies; - common::ProjectInfo project = { - "codegen_style", - srcFile.fileName(), - "stdafx.h", - forceReGenerate - }; + common::ProjectInfo project = { + "codegen_style", + srcFile.fileName(), + "stdafx.h", + forceReGenerate + }; - SpriteGenerator spriteGenerator(module, forceReGenerate); - if (!spriteGenerator.writeSprites()) { - return false; + Generator generator(module, dstFilePath, project); + if (!generator.writeHeader()) { + return false; + } + if (!generator.writeSource()) { + return false; + } } - - Generator generator(module, dstFilePath, project); - if (!generator.writeHeader()) { - return false; - } - if (!generator.writeSource()) { - return false; - } - return true; } diff --git a/Telegram/build/build.bat b/Telegram/build/build.bat index 775427765e..28289def6c 100644 --- a/Telegram/build/build.bat +++ b/Telegram/build/build.bat @@ -40,7 +40,7 @@ set "SolutionPath=%HomePath%\.." set "UpdateFile=tupdate%AppVersion%" set "SetupFile=tsetup.%AppVersionStrFull%.exe" set "PortableFile=tportable.%AppVersionStrFull%.zip" -set "ReleasePath=%HomePath%\..\Win32\Deploy" +set "ReleasePath=%HomePath%\..\out\Release" set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%" set "SignPath=%HomePath%\..\..\TelegramPrivate\Sign.bat" set "BinaryName=Telegram" @@ -80,18 +80,11 @@ if %BetaVersion% neq 0 ( ) cd "%HomePath%" -"..\Win32\codegen\Deploy\codegen_style.exe" "-I.\Resources" "-I.\SourceFiles" "-o.\GeneratedFiles\styles" all_files.style --rebuild - -cd "%ResourcesPath%" -if "%1" == "fast" ( - echo Skipping touching of telegram.qrc... -) else ( - copy telegram.qrc /B+,,/Y -) +call gyp\refresh.bat if %errorlevel% neq 0 goto error cd "%SolutionPath%" -MSBuild Telegram.sln /property:Configuration=Deploy +call ninja -C out/Release Telegram if %errorlevel% neq 0 goto error echo . @@ -112,8 +105,9 @@ call "%SignPath%" "Updater.exe" if %errorlevel% neq 0 goto error if %BetaVersion% equ 0 ( - iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% "%FullScriptPath%setup.iss" + iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% "/dReleasePath=%ReleasePath%" "%FullScriptPath%setup.iss" if %errorlevel% neq 0 goto error + if not exist "tsetup.%AppVersionStrFull%.exe" goto error call "%SignPath%" "tsetup.%AppVersionStrFull%.exe" if %errorlevel% neq 0 goto error diff --git a/Telegram/build/setup.iss b/Telegram/build/setup.iss index 6f8bd3c337..78faee5a4b 100644 --- a/Telegram/build/setup.iss +++ b/Telegram/build/setup.iss @@ -19,7 +19,7 @@ AppUpdatesURL={#MyAppURL} DefaultDirName={userappdata}\{#MyAppName} DefaultGroupName={#MyAppName} AllowNoIcons=yes -OutputDir={#SourcePath}..\..\Win32\Deploy +OutputDir={#ReleasePath} OutputBaseFilename=tsetup.{#MyAppVersionFull} SetupIconFile={#SourcePath}..\Resources\art\icon256.ico UninstallDisplayIcon={app}\Telegram.exe @@ -45,8 +45,8 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,6.1 [Files] -Source: "{#SourcePath}..\..\Win32\Deploy\Telegram.exe"; DestDir: "{app}"; Flags: ignoreversion -Source: "{#SourcePath}..\..\Win32\Deploy\Updater.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#ReleasePath}\Telegram.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#ReleasePath}\Updater.exe"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp new file mode 100644 index 0000000000..fe41c59516 --- /dev/null +++ b/Telegram/gyp/Telegram.gyp @@ -0,0 +1,537 @@ +# This file is part of Telegram Desktop, +# the official desktop version of Telegram messaging app, see https://telegram.org +# +# Telegram Desktop is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# It is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# In addition, as a special exception, the copyright holders give permission +# to link the code of portions of this program with the OpenSSL library. +# +# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +# Copyright (c) 2014 John Preston, https://desktop.telegram.org + +{ + 'targets': [{ + 'target_name': 'Telegram', + 'variables': { + 'libs_loc': '../../../Libraries', + 'src_loc': '../SourceFiles', + 'res_loc': '../Resources', + 'style_files': [ + '<(res_loc)/basic.style', + '<(res_loc)/basic_types.style', + '<(src_loc)/boxes/boxes.style', + '<(src_loc)/dialogs/dialogs.style', + '<(src_loc)/history/history.style', + '<(src_loc)/media/view/mediaview.style', + '<(src_loc)/overview/overview.style', + '<(src_loc)/profile/profile.style', + '<(src_loc)/ui/widgets/widgets.style', + ], + 'qrc_files': [ + '<(res_loc)/telegram.qrc', + '<(res_loc)/telegram_emojis.qrc', + ], + }, + 'includes': [ + 'common_executable.gypi', + 'qt.gypi', + 'codegen_rules.gypi', + ], + + 'dependencies': [ + 'codegen.gyp:codegen_style', + 'codegen.gyp:codegen_numbers', + 'codegen.gyp:MetaLang', + 'utils.gyp:Updater', + ], + + 'defines': [ + 'AL_LIBTYPE_STATIC', + ], + + 'include_dirs': [ + '<(src_loc)', + '<(SHARED_INTERMEDIATE_DIR)', + '<(libs_loc)/breakpad/src', + '<(libs_loc)/lzma/C', + '<(libs_loc)/libexif-0.6.20', + '<(libs_loc)/zlib-1.2.8', + '<(libs_loc)/ffmpeg', + '<(libs_loc)/openal-soft/include', + '../ThirdParty/minizip', + ], + 'library_dirs': [ + '<(libs_loc)/ffmpeg', + ], + 'sources': [ + '<@(qrc_files)', + '<@(style_files)', + '<(src_loc)/main.cpp', + '<(src_loc)/stdafx.cpp', + '<(src_loc)/stdafx.h', + '<(src_loc)/apiwrap.cpp', + '<(src_loc)/apiwrap.h', + '<(src_loc)/app.cpp', + '<(src_loc)/app.h', + '<(src_loc)/application.cpp', + '<(src_loc)/application.h', + '<(src_loc)/autoupdater.cpp', + '<(src_loc)/autoupdater.h', + '<(src_loc)/dialogswidget.cpp', + '<(src_loc)/dialogswidget.h', + '<(src_loc)/dropdown.cpp', + '<(src_loc)/dropdown.h', + '<(src_loc)/facades.cpp', + '<(src_loc)/facades.h', + '<(src_loc)/fileuploader.cpp', + '<(src_loc)/fileuploader.h', + '<(src_loc)/history.cpp', + '<(src_loc)/history.h', + '<(src_loc)/historywidget.cpp', + '<(src_loc)/historywidget.h', + '<(src_loc)/lang.cpp', + '<(src_loc)/lang.h', + '<(src_loc)/langloaderplain.cpp', + '<(src_loc)/langloaderplain.h', + '<(src_loc)/layerwidget.cpp', + '<(src_loc)/layerwidget.h', + '<(src_loc)/layout.cpp', + '<(src_loc)/layout.h', + '<(src_loc)/mediaview.cpp', + '<(src_loc)/mediaview.h', + '<(src_loc)/observer_peer.cpp', + '<(src_loc)/observer_peer.h', + '<(src_loc)/overviewwidget.cpp', + '<(src_loc)/overviewwidget.h', + '<(src_loc)/passcodewidget.cpp', + '<(src_loc)/passcodewidget.h', + '<(src_loc)/playerwidget.cpp', + '<(src_loc)/playerwidget.h', + '<(src_loc)/localimageloader.cpp', + '<(src_loc)/localimageloader.h', + '<(src_loc)/localstorage.cpp', + '<(src_loc)/localstorage.h', + '<(src_loc)/logs.cpp', + '<(src_loc)/logs.h', + '<(src_loc)/mainwidget.cpp', + '<(src_loc)/mainwidget.h', + '<(src_loc)/settings.cpp', + '<(src_loc)/settings.h', + '<(src_loc)/settingswidget.cpp', + '<(src_loc)/settingswidget.h', + '<(src_loc)/shortcuts.cpp', + '<(src_loc)/shortcuts.h', + '<(src_loc)/structs.cpp', + '<(src_loc)/structs.h', + '<(src_loc)/sysbuttons.cpp', + '<(src_loc)/sysbuttons.h', + '<(src_loc)/title.cpp', + '<(src_loc)/title.h', + '<(src_loc)/mainwindow.cpp', + '<(src_loc)/mainwindow.h', + '<(src_loc)/boxes/aboutbox.cpp', + '<(src_loc)/boxes/aboutbox.h', + '<(src_loc)/boxes/abstractbox.cpp', + '<(src_loc)/boxes/abstractbox.h', + '<(src_loc)/boxes/addcontactbox.cpp', + '<(src_loc)/boxes/addcontactbox.h', + '<(src_loc)/boxes/autolockbox.cpp', + '<(src_loc)/boxes/autolockbox.h', + '<(src_loc)/boxes/backgroundbox.cpp', + '<(src_loc)/boxes/backgroundbox.h', + '<(src_loc)/boxes/confirmbox.cpp', + '<(src_loc)/boxes/confirmbox.h', + '<(src_loc)/boxes/confirmphonebox.cpp', + '<(src_loc)/boxes/confirmphonebox.h', + '<(src_loc)/boxes/connectionbox.cpp', + '<(src_loc)/boxes/connectionbox.h', + '<(src_loc)/boxes/contactsbox.cpp', + '<(src_loc)/boxes/contactsbox.h', + '<(src_loc)/boxes/downloadpathbox.cpp', + '<(src_loc)/boxes/downloadpathbox.h', + '<(src_loc)/boxes/emojibox.cpp', + '<(src_loc)/boxes/emojibox.h', + '<(src_loc)/boxes/languagebox.cpp', + '<(src_loc)/boxes/languagebox.h', + '<(src_loc)/boxes/passcodebox.cpp', + '<(src_loc)/boxes/passcodebox.h', + '<(src_loc)/boxes/photocropbox.cpp', + '<(src_loc)/boxes/photocropbox.h', + '<(src_loc)/boxes/photosendbox.cpp', + '<(src_loc)/boxes/photosendbox.h', + '<(src_loc)/boxes/report_box.cpp', + '<(src_loc)/boxes/report_box.h', + '<(src_loc)/boxes/sessionsbox.cpp', + '<(src_loc)/boxes/sessionsbox.h', + '<(src_loc)/boxes/stickersetbox.cpp', + '<(src_loc)/boxes/stickersetbox.h', + '<(src_loc)/boxes/usernamebox.cpp', + '<(src_loc)/boxes/usernamebox.h', + '<(src_loc)/core/basic_types.cpp', + '<(src_loc)/core/basic_types.h', + '<(src_loc)/core/click_handler.cpp', + '<(src_loc)/core/click_handler.h', + '<(src_loc)/core/click_handler_types.cpp', + '<(src_loc)/core/click_handler_types.h', + '<(src_loc)/core/observer.cpp', + '<(src_loc)/core/observer.h', + '<(src_loc)/core/qthelp_url.cpp', + '<(src_loc)/core/qthelp_url.h', + '<(src_loc)/data/data_abstract_structure.cpp', + '<(src_loc)/data/data_abstract_structure.h', + '<(src_loc)/data/data_drafts.cpp', + '<(src_loc)/data/data_drafts.h', + '<(src_loc)/dialogs/dialogs_indexed_list.cpp', + '<(src_loc)/dialogs/dialogs_indexed_list.h', + '<(src_loc)/dialogs/dialogs_layout.cpp', + '<(src_loc)/dialogs/dialogs_layout.h', + '<(src_loc)/dialogs/dialogs_list.cpp', + '<(src_loc)/dialogs/dialogs_list.h', + '<(src_loc)/dialogs/dialogs_row.cpp', + '<(src_loc)/dialogs/dialogs_row.h', + '<(src_loc)/history/field_autocomplete.cpp', + '<(src_loc)/history/field_autocomplete.h', + '<(src_loc)/history/history_service_layout.cpp', + '<(src_loc)/history/history_service_layout.h', + '<(src_loc)/inline_bots/inline_bot_layout_internal.cpp', + '<(src_loc)/inline_bots/inline_bot_layout_internal.h', + '<(src_loc)/inline_bots/inline_bot_layout_item.cpp', + '<(src_loc)/inline_bots/inline_bot_layout_item.h', + '<(src_loc)/inline_bots/inline_bot_result.cpp', + '<(src_loc)/inline_bots/inline_bot_result.h', + '<(src_loc)/inline_bots/inline_bot_send_data.cpp', + '<(src_loc)/inline_bots/inline_bot_send_data.h', + '<(src_loc)/intro/introwidget.cpp', + '<(src_loc)/intro/introwidget.h', + '<(src_loc)/intro/introcode.cpp', + '<(src_loc)/intro/introcode.h', + '<(src_loc)/intro/introphone.cpp', + '<(src_loc)/intro/introphone.h', + '<(src_loc)/intro/intropwdcheck.cpp', + '<(src_loc)/intro/intropwdcheck.h', + '<(src_loc)/intro/introsignup.cpp', + '<(src_loc)/intro/introsignup.h', + '<(src_loc)/intro/introstart.cpp', + '<(src_loc)/intro/introstart.h', + '<(src_loc)/media/view/media_clip_controller.cpp', + '<(src_loc)/media/view/media_clip_controller.h', + '<(src_loc)/media/view/media_clip_playback.cpp', + '<(src_loc)/media/view/media_clip_playback.h', + '<(src_loc)/media/view/media_clip_volume_controller.cpp', + '<(src_loc)/media/view/media_clip_volume_controller.h', + '<(src_loc)/media/media_audio.cpp', + '<(src_loc)/media/media_audio.h', + '<(src_loc)/media/media_audio_ffmpeg_loader.cpp', + '<(src_loc)/media/media_audio_ffmpeg_loader.h', + '<(src_loc)/media/media_audio_loader.cpp', + '<(src_loc)/media/media_audio_loader.h', + '<(src_loc)/media/media_audio_loaders.cpp', + '<(src_loc)/media/media_audio_loaders.h', + '<(src_loc)/media/media_child_ffmpeg_loader.cpp', + '<(src_loc)/media/media_child_ffmpeg_loader.h', + '<(src_loc)/media/media_clip_ffmpeg.cpp', + '<(src_loc)/media/media_clip_ffmpeg.h', + '<(src_loc)/media/media_clip_implementation.cpp', + '<(src_loc)/media/media_clip_implementation.h', + '<(src_loc)/media/media_clip_qtgif.cpp', + '<(src_loc)/media/media_clip_qtgif.h', + '<(src_loc)/media/media_clip_reader.cpp', + '<(src_loc)/media/media_clip_reader.h', + '<(src_loc)/mtproto/facade.cpp', + '<(src_loc)/mtproto/facade.h', + '<(src_loc)/mtproto/auth_key.cpp', + '<(src_loc)/mtproto/auth_key.h', + '<(src_loc)/mtproto/connection.cpp', + '<(src_loc)/mtproto/connection.h', + '<(src_loc)/mtproto/connection_abstract.cpp', + '<(src_loc)/mtproto/connection_abstract.h', + '<(src_loc)/mtproto/connection_auto.cpp', + '<(src_loc)/mtproto/connection_auto.h', + '<(src_loc)/mtproto/connection_http.cpp', + '<(src_loc)/mtproto/connection_http.h', + '<(src_loc)/mtproto/connection_tcp.cpp', + '<(src_loc)/mtproto/connection_tcp.h', + '<(src_loc)/mtproto/core_types.cpp', + '<(src_loc)/mtproto/core_types.h', + '<(src_loc)/mtproto/dcenter.cpp', + '<(src_loc)/mtproto/dcenter.h', + '<(src_loc)/mtproto/file_download.cpp', + '<(src_loc)/mtproto/file_download.h', + '<(src_loc)/mtproto/rsa_public_key.cpp', + '<(src_loc)/mtproto/rsa_public_key.h', + '<(src_loc)/mtproto/rpc_sender.cpp', + '<(src_loc)/mtproto/rpc_sender.h', + '<(src_loc)/mtproto/scheme_auto.cpp', + '<(src_loc)/mtproto/scheme_auto.h', + '<(src_loc)/mtproto/session.cpp', + '<(src_loc)/mtproto/session.h', + '<(src_loc)/overview/overview_layout.cpp', + '<(src_loc)/overview/overview_layout.h', + '<(src_loc)/pspecific_win.cpp', + '<(src_loc)/pspecific_win.h', + '<(src_loc)/platform/linux/linux_gdk_helper.cpp', + '<(src_loc)/platform/linux/linux_gdk_helper.h', + '<(src_loc)/platform/linux/linux_libs.cpp', + '<(src_loc)/platform/linux/linux_libs.h', + '<(src_loc)/platform/linux/file_dialog_linux.cpp', + '<(src_loc)/platform/linux/file_dialog_linux.h', + '<(src_loc)/platform/linux/main_window_linux.cpp', + '<(src_loc)/platform/linux/main_window_linux.h', + '<(src_loc)/platform/mac/main_window_mac.mm', + '<(src_loc)/platform/mac/main_window_mac.h', + '<(src_loc)/platform/win/main_window_win.cpp', + '<(src_loc)/platform/win/main_window_win.h', + '<(src_loc)/platform/win/windows_app_user_model_id.cpp', + '<(src_loc)/platform/win/windows_app_user_model_id.h', + '<(src_loc)/platform/win/windows_dlls.cpp', + '<(src_loc)/platform/win/windows_dlls.h', + '<(src_loc)/platform/win/windows_event_filter.cpp', + '<(src_loc)/platform/win/windows_event_filter.h', + '<(src_loc)/platform/win/windows_toasts.cpp', + '<(src_loc)/platform/win/windows_toasts.h', + '<(src_loc)/profile/profile_actions_widget.cpp', + '<(src_loc)/profile/profile_actions_widget.h', + '<(src_loc)/profile/profile_block_widget.cpp', + '<(src_loc)/profile/profile_block_widget.h', + '<(src_loc)/profile/profile_cover_drop_area.cpp', + '<(src_loc)/profile/profile_cover_drop_area.h', + '<(src_loc)/profile/profile_cover.cpp', + '<(src_loc)/profile/profile_cover.h', + '<(src_loc)/profile/profile_fixed_bar.cpp', + '<(src_loc)/profile/profile_fixed_bar.h', + '<(src_loc)/profile/profile_info_widget.cpp', + '<(src_loc)/profile/profile_info_widget.h', + '<(src_loc)/profile/profile_inner_widget.cpp', + '<(src_loc)/profile/profile_inner_widget.h', + '<(src_loc)/profile/profile_invite_link_widget.cpp', + '<(src_loc)/profile/profile_invite_link_widget.h', + '<(src_loc)/profile/profile_members_widget.cpp', + '<(src_loc)/profile/profile_members_widget.h', + '<(src_loc)/profile/profile_section_memento.cpp', + '<(src_loc)/profile/profile_section_memento.h', + '<(src_loc)/profile/profile_settings_widget.cpp', + '<(src_loc)/profile/profile_settings_widget.h', + '<(src_loc)/profile/profile_shared_media_widget.cpp', + '<(src_loc)/profile/profile_shared_media_widget.h', + '<(src_loc)/profile/profile_userpic_button.cpp', + '<(src_loc)/profile/profile_userpic_button.h', + '<(src_loc)/profile/profile_widget.cpp', + '<(src_loc)/profile/profile_widget.h', + '<(src_loc)/serialize/serialize_common.cpp', + '<(src_loc)/serialize/serialize_common.h', + '<(src_loc)/serialize/serialize_document.cpp', + '<(src_loc)/serialize/serialize_document.h', + '<(src_loc)/ui/buttons/history_down_button.cpp', + '<(src_loc)/ui/buttons/history_down_button.h', + '<(src_loc)/ui/buttons/icon_button.cpp', + '<(src_loc)/ui/buttons/icon_button.h', + '<(src_loc)/ui/buttons/left_outline_button.cpp', + '<(src_loc)/ui/buttons/left_outline_button.h', + '<(src_loc)/ui/buttons/peer_avatar_button.cpp', + '<(src_loc)/ui/buttons/peer_avatar_button.h', + '<(src_loc)/ui/buttons/round_button.cpp', + '<(src_loc)/ui/buttons/round_button.h', + '<(src_loc)/ui/effects/fade_animation.cpp', + '<(src_loc)/ui/effects/fade_animation.h', + '<(src_loc)/ui/style/style_core.cpp', + '<(src_loc)/ui/style/style_core.h', + '<(src_loc)/ui/style/style_core_color.cpp', + '<(src_loc)/ui/style/style_core_color.h', + '<(src_loc)/ui/style/style_core_font.cpp', + '<(src_loc)/ui/style/style_core_font.h', + '<(src_loc)/ui/style/style_core_icon.cpp', + '<(src_loc)/ui/style/style_core_icon.h', + '<(src_loc)/ui/style/style_core_types.cpp', + '<(src_loc)/ui/style/style_core_types.h', + '<(src_loc)/ui/text/text.cpp', + '<(src_loc)/ui/text/text.h', + '<(src_loc)/ui/text/text_block.cpp', + '<(src_loc)/ui/text/text_block.h', + '<(src_loc)/ui/text/text_entity.cpp', + '<(src_loc)/ui/text/text_entity.h', + '<(src_loc)/ui/toast/toast.cpp', + '<(src_loc)/ui/toast/toast.h', + '<(src_loc)/ui/toast/toast_manager.cpp', + '<(src_loc)/ui/toast/toast_manager.h', + '<(src_loc)/ui/toast/toast_widget.cpp', + '<(src_loc)/ui/toast/toast_widget.h', + '<(src_loc)/ui/widgets/label_simple.cpp', + '<(src_loc)/ui/widgets/label_simple.h', + '<(src_loc)/ui/animation.cpp', + '<(src_loc)/ui/animation.h', + '<(src_loc)/ui/boxshadow.cpp', + '<(src_loc)/ui/boxshadow.h', + '<(src_loc)/ui/button.cpp', + '<(src_loc)/ui/button.h', + '<(src_loc)/ui/popupmenu.cpp', + '<(src_loc)/ui/popupmenu.h', + '<(src_loc)/ui/countryinput.cpp', + '<(src_loc)/ui/countryinput.h', + '<(src_loc)/ui/emoji_config.cpp', + '<(src_loc)/ui/emoji_config.h', + '<(src_loc)/ui/filedialog.cpp', + '<(src_loc)/ui/filedialog.h', + '<(src_loc)/ui/flatbutton.cpp', + '<(src_loc)/ui/flatbutton.h', + '<(src_loc)/ui/flatcheckbox.cpp', + '<(src_loc)/ui/flatcheckbox.h', + '<(src_loc)/ui/flatinput.cpp', + '<(src_loc)/ui/flatinput.h', + '<(src_loc)/ui/flatlabel.cpp', + '<(src_loc)/ui/flatlabel.h', + '<(src_loc)/ui/flattextarea.cpp', + '<(src_loc)/ui/flattextarea.h', + '<(src_loc)/ui/images.cpp', + '<(src_loc)/ui/images.h', + '<(src_loc)/ui/inner_dropdown.cpp', + '<(src_loc)/ui/inner_dropdown.h', + '<(src_loc)/ui/scrollarea.cpp', + '<(src_loc)/ui/scrollarea.h', + '<(src_loc)/ui/twidget.cpp', + '<(src_loc)/ui/twidget.h', + '<(src_loc)/window/main_window.cpp', + '<(src_loc)/window/main_window.h', + '<(src_loc)/window/section_widget.cpp', + '<(src_loc)/window/section_widget.h', + '<(src_loc)/window/slide_animation.cpp', + '<(src_loc)/window/slide_animation.h', + '<(src_loc)/window/top_bar_widget.cpp', + '<(src_loc)/window/top_bar_widget.h', + ], + 'configurations': { + 'Debug': { + 'include_dirs': [ + '<(libs_loc)/openssl_debug/Debug/include', + ], + 'library_dirs': [ + '<(libs_loc)/lzma/C/Util/LzmaLib/Debug', + '<(libs_loc)/libexif-0.6.20/win32/Debug', + '<(libs_loc)/opus/win32/VS2010/Win32/Debug', + '<(libs_loc)/openal-soft/build/Debug', + '<(libs_loc)/zlib-1.2.8/contrib/vstudio/vc11/x86/ZlibStatDebug', + '<(libs_loc)/openssl_debug/Debug/lib', + '<(libs_loc)/breakpad/src/client/windows/Debug', + ], + }, + 'Release': { + 'conditions': [ + ['"<(official_build_target)" != ""', { + 'defines': [ + 'CUSTOM_API_ID', + ], + }], + ], + 'include_dirs': [ + '<(libs_loc)/openssl/Release/include', + ], + 'library_dirs': [ + '<(libs_loc)/lzma/C/Util/LzmaLib/Release', + '<(libs_loc)/libexif-0.6.20/win32/Release', + '<(libs_loc)/opus/win32/VS2010/Win32/Release', + '<(libs_loc)/openal-soft/build/Release', + '<(libs_loc)/zlib-1.2.8/contrib/vstudio/vc11/x86/ZlibStatRelease', + '<(libs_loc)/openssl/Release/lib', + '<(libs_loc)/breakpad/src/client/windows/Release', + ], + }, + }, + 'libraries': [ + 'libeay32', + 'ssleay32', + 'Crypt32', + 'zlibstat', + 'LzmaLib', + 'lib_exif', + 'UxTheme', + 'DbgHelp', + 'OpenAL32', + 'common', + 'libavformat\libavformat.a', + 'libavcodec\libavcodec.a', + 'libavutil\libavutil.a', + 'libswresample\libswresample.a', + 'libswscale\libswscale.a', + 'opus', + 'celt', + 'silk_common', + 'silk_float', + 'lib\common', + 'lib\exception_handler', + 'lib\crash_generation_client', + ], + 'conditions': [ + [ '"<(official_build_target)" != ""', { + 'dependencies': [ + 'utils.gyp:Packer', + ], + }], + [ 'build_linux', { + 'variables': { + 'qrc_files': [ + '<(res_loc)/telegram_linux.qrc', + ], + } + }], + [ 'build_mac', { + 'variables': { + 'qrc_files': [ + '<(res_loc)/telegram_mac.qrc', + ], + } + }], + [ 'build_win', { + 'msvs_precompiled_source': '<(src_loc)/stdafx.cpp', + 'msvs_precompiled_header': '<(src_loc)/stdafx.h', + 'msbuild_toolset': 'v140_xp', #Windows7.1SDK + 'sources': [ + '<(res_loc)/winrc/Telegram.rc', + ], + 'variables': { + 'qrc_files': [ + '<(res_loc)/telegram_wnd.qrc', + ], + } + }], + [ '"<(build_linux)" != "1"', { + 'sources!': [ + '<(src_loc)/platform/linux/linux_gdk_helper.cpp', + '<(src_loc)/platform/linux/linux_gdk_helper.h', + '<(src_loc)/platform/linux/linux_libs.cpp', + '<(src_loc)/platform/linux/linux_libs.h', + '<(src_loc)/platform/linux/file_dialog_linux.cpp', + '<(src_loc)/platform/linux/file_dialog_linux.h', + '<(src_loc)/platform/linux/main_window_linux.cpp', + '<(src_loc)/platform/linux/main_window_linux.h', + ], + }], + [ '"<(build_mac)" != "1"', { + 'sources!': [ + '<(src_loc)/platform/mac/main_window_mac.mm', + '<(src_loc)/platform/mac/main_window_mac.h', + ], + }], + [ '"<(build_win)" != "1"', { + 'sources!': [ + '<(src_loc)/platform/win/main_window_win.cpp', + '<(src_loc)/platform/win/main_window_win.h', + '<(src_loc)/platform/win/windows_app_user_model_id.cpp', + '<(src_loc)/platform/win/windows_app_user_model_id.h', + '<(src_loc)/platform/win/windows_dlls.cpp', + '<(src_loc)/platform/win/windows_dlls.h', + '<(src_loc)/platform/win/windows_event_filter.cpp', + '<(src_loc)/platform/win/windows_event_filter.h', + '<(src_loc)/platform/win/windows_toasts.cpp', + '<(src_loc)/platform/win/windows_toasts.h', + ], + }], + ], + }], +} diff --git a/Telegram/gyp/codegen.gyp b/Telegram/gyp/codegen.gyp new file mode 100644 index 0000000000..ecdd460141 --- /dev/null +++ b/Telegram/gyp/codegen.gyp @@ -0,0 +1,124 @@ +# This file is part of Telegram Desktop, +# the official desktop version of Telegram messaging app, see https://telegram.org +# +# Telegram Desktop is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# It is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# In addition, as a special exception, the copyright holders give permission +# to link the code of portions of this program with the OpenSSL library. +# +# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +# Copyright (c) 2014 John Preston, https://desktop.telegram.org + +{ + 'targets': [{ + 'target_name': 'MetaLang', + 'variables': { + 'libs_loc': '../../../Libraries', + 'src_loc': '../SourceFiles', + 'gen_loc': '../GeneratedFiles', + }, + 'includes': [ + 'common_executable.gypi', + 'qt.gypi', + ], + + 'include_dirs': [ + '<(src_loc)', + '<(gen_loc)', + ], + 'sources': [ + '<(src_loc)/_other/mlmain.cpp', + '<(src_loc)/_other/mlmain.h', + '<(src_loc)/_other/genlang.cpp', + '<(src_loc)/_other/genlang.h', + ], + }, { + 'target_name': 'codegen_style', + 'variables': { + 'libs_loc': '../../../Libraries', + 'src_loc': '../SourceFiles', + }, + 'includes': [ + 'common_executable.gypi', + 'qt.gypi', + ], + + 'include_dirs': [ + '<(src_loc)', + ], + 'sources': [ + '<(src_loc)/codegen/common/basic_tokenized_file.cpp', + '<(src_loc)/codegen/common/basic_tokenized_file.h', + '<(src_loc)/codegen/common/checked_utf8_string.cpp', + '<(src_loc)/codegen/common/checked_utf8_string.h', + '<(src_loc)/codegen/common/clean_file.cpp', + '<(src_loc)/codegen/common/clean_file.h', + '<(src_loc)/codegen/common/clean_file_reader.h', + '<(src_loc)/codegen/common/const_utf8_string.h', + '<(src_loc)/codegen/common/cpp_file.cpp', + '<(src_loc)/codegen/common/cpp_file.h', + '<(src_loc)/codegen/common/logging.cpp', + '<(src_loc)/codegen/common/logging.h', + '<(src_loc)/codegen/style/generator.cpp', + '<(src_loc)/codegen/style/generator.h', + '<(src_loc)/codegen/style/main.cpp', + '<(src_loc)/codegen/style/module.cpp', + '<(src_loc)/codegen/style/module.h', + '<(src_loc)/codegen/style/options.cpp', + '<(src_loc)/codegen/style/options.h', + '<(src_loc)/codegen/style/parsed_file.cpp', + '<(src_loc)/codegen/style/parsed_file.h', + '<(src_loc)/codegen/style/processor.cpp', + '<(src_loc)/codegen/style/processor.h', + '<(src_loc)/codegen/style/sprite_generator.cpp', + '<(src_loc)/codegen/style/sprite_generator.h', + '<(src_loc)/codegen/style/structure_types.cpp', + '<(src_loc)/codegen/style/structure_types.h', + ], + }, { + 'target_name': 'codegen_numbers', + 'variables': { + 'libs_loc': '../../../Libraries', + 'src_loc': '../SourceFiles', + }, + 'includes': [ + 'common_executable.gypi', + 'qt.gypi', + ], + + 'include_dirs': [ + '<(src_loc)', + ], + 'sources': [ + '<(src_loc)/codegen/common/basic_tokenized_file.cpp', + '<(src_loc)/codegen/common/basic_tokenized_file.h', + '<(src_loc)/codegen/common/checked_utf8_string.cpp', + '<(src_loc)/codegen/common/checked_utf8_string.h', + '<(src_loc)/codegen/common/clean_file.cpp', + '<(src_loc)/codegen/common/clean_file.h', + '<(src_loc)/codegen/common/clean_file_reader.h', + '<(src_loc)/codegen/common/const_utf8_string.h', + '<(src_loc)/codegen/common/cpp_file.cpp', + '<(src_loc)/codegen/common/cpp_file.h', + '<(src_loc)/codegen/common/logging.cpp', + '<(src_loc)/codegen/common/logging.h', + '<(src_loc)/codegen/numbers/generator.cpp', + '<(src_loc)/codegen/numbers/generator.h', + '<(src_loc)/codegen/numbers/main.cpp', + '<(src_loc)/codegen/numbers/options.cpp', + '<(src_loc)/codegen/numbers/options.h', + '<(src_loc)/codegen/numbers/parsed_file.cpp', + '<(src_loc)/codegen/numbers/parsed_file.h', + '<(src_loc)/codegen/numbers/processor.cpp', + '<(src_loc)/codegen/numbers/processor.h', + ], + }], +} diff --git a/Telegram/gyp/codegen_rules.gypi b/Telegram/gyp/codegen_rules.gypi new file mode 100644 index 0000000000..a437037e9d --- /dev/null +++ b/Telegram/gyp/codegen_rules.gypi @@ -0,0 +1,124 @@ +# This file is part of Telegram Desktop, +# the official desktop version of Telegram messaging app, see https://telegram.org +# +# Telegram Desktop is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# It is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# In addition, as a special exception, the copyright holders give permission +# to link the code of portions of this program with the OpenSSL library. +# +# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +# Copyright (c) 2014 John Preston, https://desktop.telegram.org + +{ + 'actions': [{ + 'action_name': 'update_sprites', + 'inputs': [ + '<(PRODUCT_DIR)/codegen_style.exe', + '<(res_loc)/basic.style', + '<(res_loc)/art/sprite.png', + '<(res_loc)/art/sprite_200x.png', + ], + 'outputs': [ + '<(res_loc)/art/sprite_125x.png', + '<(res_loc)/art/sprite_150x.png', + ], + 'action': [ + '<(PRODUCT_DIR)/codegen_style.exe', + '-I<(res_loc)', '-I<(src_loc)', + '--skip-styles', '<(res_loc)/basic.style', + ], + 'message': 'Updating sprites..', + }, { + 'action_name': 'update_dependent_styles', + 'inputs': [ + '<(DEPTH)/update_dependent.py', + '<@(style_files)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/update_dependent_styles.timestamp', + ], + 'action': [ + 'python', '<(DEPTH)/update_dependent.py', '-tstyle', + '-I<(res_loc)', '-I<(src_loc)', + '-o<(SHARED_INTERMEDIATE_DIR)/update_dependent_styles.timestamp', + '<@(style_files)', + ], + 'message': 'Updating dependent style files..', + }, { + 'action_name': 'update_dependent_qrc', + 'inputs': [ + '<(DEPTH)/update_dependent.py', + '<@(qrc_files)', + ' 1 and sys.argv[1] == '--read-target': + target_path = my_path + '/../build/target' + if os.path.isfile(target_path): + with open(target_path) as f: + for line in f: + cleanline = re.sub(r'^\s*|\s*$', '', line); + if cleanline != '': + print(cleanline); +else: + print('This is a helper script, it should not be called directly.') diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi new file mode 100644 index 0000000000..4e394e034e --- /dev/null +++ b/Telegram/gyp/qt.gypi @@ -0,0 +1,156 @@ +# This file is part of Telegram Desktop, +# the official desktop version of Telegram messaging app, see https://telegram.org +# +# Telegram Desktop is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# It is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# In addition, as a special exception, the copyright holders give permission +# to link the code of portions of this program with the OpenSSL library. +# +# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +# Copyright (c) 2014 John Preston, https://desktop.telegram.org + +{ + 'variables': { + 'variables': { + 'variables': { + 'qt_version%': '5.6.0', + }, + 'qt_version%': '<(qt_version)', + 'qt_version_loc': 'nul" +if "%1" == "-v" set "Silence=" + +rem strangely linking of Release Telegram build complains about the absence of lib.pdb +if exist "%FullScriptPath%..\..\..\Libraries\openssl\tmp32\lib.pdb" ( + if not exist "%FullScriptPath%..\..\..\Libraries\openssl\Release\lib\lib.pdb" ( + xcopy "%FullScriptPath%..\..\..\Libraries\openssl\tmp32\lib.pdb" "%FullScriptPath%..\..\..\Libraries\openssl\Release\lib\" %Silence% + ) +) + +cd "%FullScriptPath%" +call gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=ninja +if %errorlevel% neq 0 goto error +call gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=msvs-ninja +if %errorlevel% neq 0 goto error +cd ../.. + +rem looks like ninja build works without sdk 7.1 which was used by generating custom environment.arch files + +rem cd "%FullScriptPath%" +rem call gyp --depth=. --generator-output=../.. -Goutput_dir=out -Gninja_use_custom_environment_files=1 Telegram.gyp --format=ninja +rem if %errorlevel% neq 0 goto error +rem call gyp --depth=. --generator-output=../.. -Goutput_dir=out -Gninja_use_custom_environment_files=1 Telegram.gyp --format=msvs-ninja +rem if %errorlevel% neq 0 goto error +rem cd ../.. + +rem call msbuild /target:SetBuildDefaultEnvironmentVariables Telegram.vcxproj /fileLogger %Silence% +rem if %errorlevel% neq 0 goto error + +rem call python "%FullScriptPath%create_env.py" +rem if %errorlevel% neq 0 goto error + +rem call move environment.x86 out\Debug\ %Silence% +rem if %errorlevel% neq 0 goto error + +cd "%FullExecPath%" +exit /b + +:error +echo FAILED +if exist "%FullScriptPath%..\..\msbuild.log" del "%FullScriptPath%..\..\msbuild.log" +if exist "%FullScriptPath%..\..\environment.x86" del "%FullScriptPath%..\..\environment.x86" +cd "%FullExecPath%" +exit /b 1 diff --git a/Telegram/gyp/settings_win.gypi b/Telegram/gyp/settings_win.gypi new file mode 100644 index 0000000000..873ff21a9a --- /dev/null +++ b/Telegram/gyp/settings_win.gypi @@ -0,0 +1,108 @@ +# This file is part of Telegram Desktop, +# the official desktop version of Telegram messaging app, see https://telegram.org +# +# Telegram Desktop is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# It is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# In addition, as a special exception, the copyright holders give permission +# to link the code of portions of this program with the OpenSSL library. +# +# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +# Copyright (c) 2014 John Preston, https://desktop.telegram.org + +{ + 'conditions': [ + [ 'build_win', { + 'msvs_cygwin_shell': 0, + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb', + 'DebugInformationFormat': '3', # Program Database (/Zi) + 'AdditionalOptions': [ + '/MP', # Enable multi process build. + '/EHsc', # Catch C++ exceptions only, extern C functions never throw a C++ exception. + ], + 'PreprocessorDefinitions': [ + 'WIN32', + '_WINDOWS', + '_UNICODE', + 'UNICODE', + 'HAVE_STDINT_H', + 'ZLIB_WINAPI', + '_SCL_SECURE_NO_WARNINGS', + '_USING_V110_SDK71_', + ], + 'TreatWChar_tAsBuiltInType': 'false', + }, + 'VCLinkerTool': { + 'SubSystem': '<(win_subsystem)', + 'MinimumRequiredVersion': '5.01', + 'ImageHasSafeExceptionHandlers': 'false', # Disable /SAFESEH + 'ImportLibrary': '<(PRODUCT_DIR)/<(_target_name).lib', + }, + }, + 'libraries': [ + 'winmm', + 'imm32', + 'ws2_32', + 'kernel32', + 'user32', + 'gdi32', + 'winspool', + 'comdlg32', + 'advapi32', + 'shell32', + 'ole32', + 'oleaut32', + 'uuid', + 'odbc32', + 'odbccp32', + 'Shlwapi', + 'Iphlpapi', + 'Gdiplus', + 'Strmiids', + ], + + 'configurations': { + 'Debug': { + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0', # Disabled (/Od) + 'RuntimeLibrary': '1', # Multi-threaded Debug (/MTd) + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', # true (/DEBUG) + 'IgnoreDefaultLibraryNames': 'LIBCMT', + 'LinkIncremental': '2', # Yes (/INCREMENTAL) + }, + }, + }, + 'Release': { + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '2', # Maximize Speed (/O2) + 'InlineFunctionExpansion': '2', # Any suitable (/Ob2) + 'EnableIntrinsicFunctions': 'true', # Yes (/Oi) + 'FavorSizeOrSpeed': '1', # Favor fast code (/Ot) + 'RuntimeLibrary': '0', # Multi-threaded (/MT) + 'EnableEnhancedInstructionSet': '2', # Streaming SIMD Extensions 2 (/arch:SSE2) + 'WholeProgramOptimization': 'true', # /GL + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', # /DEBUG + 'OptimizeReferences': '2', + 'LinkTimeCodeGeneration': '1', # /LTCG + }, + }, + }, + }, + }], + ], +} diff --git a/Telegram/gyp/update_dependent.py b/Telegram/gyp/update_dependent.py new file mode 100644 index 0000000000..62e3f9a89e --- /dev/null +++ b/Telegram/gyp/update_dependent.py @@ -0,0 +1,192 @@ +''' +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014 John Preston, https://desktop.telegram.org +''' +from __future__ import print_function +import sys +import os +import re +import time + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + sys.exit(1) + +my_path = os.path.dirname(os.path.realpath(__file__)).replace('\\', '/') + +def get_qrc_dependencies(file_path): + global one_modified + dependencies = {} + if not os.path.isfile(file_path): + eprint('File not found: ' + file_path) + dir_name = os.path.dirname(file_path).replace('\\', '/') + with open(file_path) as f: + for line in f: + file_match = re.match('^\s*]*)?>([^<]+)', line) + if file_match: + full_path = dir_name + '/' + file_match.group(2) + dependencies[full_path] = 1 + return dependencies + +def list_qrc_dependencies(file_path): + global one_modified + dependencies = get_qrc_dependencies(file_path) + for path in dependencies: + print(path) + sys.exit(0) + +one_modified = 0 +def handle_qrc_dependencies(file_path): + global one_modified + dependencies = get_qrc_dependencies(file_path) + file_modified = os.path.getmtime(file_path) + latest_modified = file_modified + for path in dependencies: + if os.path.isfile(path): + dependency_modified = os.path.getmtime(path) + if latest_modified < dependency_modified: + latest_modified = dependency_modified + else: + eprint('File not found: ' + full_path) + if file_modified < latest_modified: + os.utime(file_path, None); + one_modified = 1 + +def get_direct_style_dependencies(file_path): + dependencies = {} + dependencies[file_path] = 1 + if not os.path.isfile(file_path): + eprint('File not found: ' + file_path) + with open(file_path) as f: + for line in f: + using_match = re.match('^\s*using "([^"]+)"', line) + if using_match: + path = using_match.group(1) + found = 0 + for include_dir in include_dirs: + full_path = include_dir + '/' + path + if os.path.isfile(full_path): + try: + if dependencies[full_path]: + eprint('Cyclic dependencies: ' + full_path) + except KeyError: + dependencies[full_path] = 1 + found = 1 + break + if found != 1: + eprint('File not found: ' + path) + return dependencies + +include_dirs = [] +def handle_style_dependencies(file_path): + global one_modified + all_dependencies = {} + all_dependencies[file_path] = 1 + added_from = {} + while len(added_from) != len(all_dependencies): + for dependency in all_dependencies: + try: + if added_from[dependency]: + continue + except KeyError: + added_from[dependency] = 1 + add = get_direct_style_dependencies(dependency) + for new_dependency in add: + all_dependencies[new_dependency] = 1 + break + + file_modified = os.path.getmtime(file_path) + latest_modified = file_modified + for path in all_dependencies: + if path != file_path: + dependency_modified = os.path.getmtime(path) + if latest_modified < dependency_modified: + latest_modified = dependency_modified + if file_modified < latest_modified: + os.utime(file_path, None); + one_modified = 1 + +file_paths = [] +file_type = '' +output_file = '' +next_file_type = 0 +next_include_dir = 0 +next_output_file = 0 +next_self = 1 +for arg in sys.argv: + if next_self != 0: + next_self = 0 + continue + if next_file_type != 0: + next_file_type = 0 + file_type = arg + continue + if next_include_dir != 0: + next_include_dir = 0 + include_dirs.append(arg) + continue + if next_output_file != 0: + next_output_file = 0 + output_file = arg + continue + + type_match = re.match(r'^\-t(.*)$', arg) + if type_match: + file_type = type_match.group(1) + if file_type == '': + next_file_type = 1 + continue + + include_dir_match = re.match(r'^\-I(.*)$', arg) + if include_dir_match: + include_dir = include_dir_match.group(1) + if include_dir == '': + next_include_dir = 1 + else: + include_dirs.append(include_dir) + continue + + output_match = re.match(r'^-o(.*)$', arg) + if output_match: + output_file = output_match.group(1) + if output_file == '': + next_output_file = 1 + continue + + file_paths.append(arg) + +if file_type == 'style': + for file_path in file_paths: + handle_style_dependencies(file_path) +elif file_type == 'qrc': + for file_path in file_paths: + handle_qrc_dependencies(file_path) +elif file_type == 'qrc_list': + for file_path in file_paths: + list_qrc_dependencies(file_path) +elif file_type != '': + eprint('Unknown file type: ' + file_type) +else: + eprint('File type was not provided.') + +if not os.path.isfile(output_file): + with open(output_file, "w") as f: + f.write('1') +elif one_modified != 0: + os.utime(output_file, None); diff --git a/Telegram/gyp/utils.gyp b/Telegram/gyp/utils.gyp new file mode 100644 index 0000000000..1ff4110b76 --- /dev/null +++ b/Telegram/gyp/utils.gyp @@ -0,0 +1,113 @@ +# This file is part of Telegram Desktop, +# the official desktop version of Telegram messaging app, see https://telegram.org +# +# Telegram Desktop is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# It is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# In addition, as a special exception, the copyright holders give permission +# to link the code of portions of this program with the OpenSSL library. +# +# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +# Copyright (c) 2014 John Preston, https://desktop.telegram.org + +{ + 'targets': [{ + 'target_name': 'Updater', + 'variables': { + 'libs_loc': '../../../Libraries', + 'src_loc': '../SourceFiles', + 'res_loc': '../Resources', + }, + 'includes': [ + 'common_executable.gypi', + ], + + 'include_dirs': [ + '<(src_loc)', + ], + 'sources': [ + '<(src_loc)/_other/updater.cpp', + '<(src_loc)/_other/updater.h', + '<(src_loc)/_other/updater_linux.cpp', + '<(src_loc)/_other/updater_osx.m', + ], + 'conditions': [ + [ 'build_win', { + 'sources': [ + '<(res_loc)/winrc/Updater.rc', + ], + }], + [ '"<(build_linux)" != "1"', { + 'sources!': [ + '<(src_loc)/_other/updater_linux.cpp', + ], + }], + [ '"<(build_mac)" != "1"', { + 'sources!': [ + '<(src_loc)/_other/updater_osx.m', + ], + }], + [ '"<(build_win)" != "1"', { + 'sources!': [ + '<(src_loc)/_other/updater.cpp', + ], + }], + ], + }, { + 'target_name': 'Packer', + 'variables': { + 'libs_loc': '../../../Libraries', + 'src_loc': '../SourceFiles', + }, + 'includes': [ + 'common_executable.gypi', + 'qt.gypi', + ], + 'libraries': [ + 'libeay32', + 'ssleay32', + 'Crypt32', + 'zlibstat', + 'LzmaLib', + ], + + 'include_dirs': [ + '<(src_loc)', + '<(libs_loc)/lzma/C', + '<(libs_loc)/zlib-1.2.8', + ], + 'sources': [ + '<(src_loc)/_other/packer.cpp', + '<(src_loc)/_other/packer.h', + ], + 'configurations': { + 'Debug': { + 'include_dirs': [ + '<(libs_loc)/openssl_debug/Debug/include', + ], + 'library_dirs': [ + '<(libs_loc)/lzma/C/Util/LzmaLib/Debug', + '<(libs_loc)/zlib-1.2.8/contrib/vstudio/vc11/x86/ZlibStatDebug', + '<(libs_loc)/openssl_debug/Debug/lib', + ], + }, + 'Release': { + 'include_dirs': [ + '<(libs_loc)/openssl/Release/include', + ], + 'library_dirs': [ + '<(libs_loc)/lzma/C/Util/LzmaLib/Release', + '<(libs_loc)/zlib-1.2.8/contrib/vstudio/vc11/x86/ZlibStatRelease', + '<(libs_loc)/openssl/Release/lib', + ], + }, + }, + }], +} diff --git a/doc/building-msvc.md b/doc/building-msvc.md index ec67b58d6e..b532b6412a 100644 --- a/doc/building-msvc.md +++ b/doc/building-msvc.md @@ -244,7 +244,6 @@ and run ..\depot_tools\gclient sync xcopy src\src\* src /s /i - #### Build * Open in VS2015 **D:\TBuild\Libraries\breakpad\src\client\windows\breakpad_client.sln** @@ -255,10 +254,33 @@ and run ## Building Telegram Desktop +#### Setup GYP/Ninja and generate VS solution + +* Download [Ninja binaries](https://github.com/ninja-build/ninja/releases/download/v1.7.1/ninja-win.zip) and unpack them to **D:\\TBuild\\Libraries\\ninja** to have **D:\\TBuild\\Libraries\\ninja\\ninja.exe** +* Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder) + +There go to Libraries directory + + D: + cd TBuild\Libraries + +and run + + git clone https://chromium.googlesource.com/external/gyp + SET PATH=%PATH%;D:\TBuild\Libraries\gyp;D:\TBuild\Libraries\ninja; + cd ..\tdesktop\Telegram + gyp\refresh.bat + +#### Configure VS + * Launch VS2015 for configuring Qt5Package * QT5 > Qt Options > Add * Version name: **Qt 5.6.0 Win32** * Path: **D:\TBuild\Libraries\qt5_6_0\qtbase** * Default Qt/Win version: **Qt 5.6.0 Win32** – **OK** - You may need to restart Visual Studio for this to take effect. + +#### Build the project + * File > Open > Project/Solution > **D:\TBuild\tdesktop\Telegram.sln** -* Build \ Build Solution (Debug and Release configurations) +* 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**)