This commit is contained in:
John Preston 2016-09-12 14:51:24 +03:00
commit 273637f9ac
23 changed files with 531 additions and 107 deletions

View File

@ -1,5 +1,33 @@
diff --git a/pylib/gyp/generator/cmake.py b/pylib/gyp/generator/cmake.py
index a2b9629..68d7020 100644
--- a/pylib/gyp/generator/cmake.py
+++ b/pylib/gyp/generator/cmake.py
@@ -1070,6 +1070,23 @@ def WriteTarget(namer, qualified_target, target_dicts, build_dir, config_to_use,
output.write(')\n')
+ # Precompile header
+ precompiled_header = config.get('cmake_precompiled_header', '')
+ if precompiled_header:
+ precompiled_header_script = config.get('cmake_precompiled_header_script', '')
+ if not precompiled_header_script:
+ print ('ERROR: cmake_precompiled_header requires cmake_precompiled_header_script')
+ cmake_precompiled_header = NormjoinPath(path_from_cmakelists_to_gyp, precompiled_header)
+ cmake_precompiled_header_script = NormjoinPathForceCMakeSource(path_from_cmakelists_to_gyp, precompiled_header_script)
+ output.write('include(')
+ output.write(cmake_precompiled_header_script)
+ output.write(')\n')
+ output.write('add_precompiled_header(')
+ output.write(cmake_target_name)
+ output.write(' ')
+ output.write(cmake_precompiled_header)
+ output.write(')\n')
+
UnsetVariable(output, 'TOOLSET')
UnsetVariable(output, 'TARGET')
diff --git a/pylib/gyp/generator/xcode.py b/pylib/gyp/generator/xcode.py diff --git a/pylib/gyp/generator/xcode.py b/pylib/gyp/generator/xcode.py
index 0e3fb93..0679660 100644 index db99d6a..f8398cc 100644
--- a/pylib/gyp/generator/xcode.py --- a/pylib/gyp/generator/xcode.py
+++ b/pylib/gyp/generator/xcode.py +++ b/pylib/gyp/generator/xcode.py
@@ -72,6 +72,10 @@ generator_additional_non_configuration_keys = [ @@ -72,6 +72,10 @@ generator_additional_non_configuration_keys = [
@ -13,7 +41,7 @@ index 0e3fb93..0679660 100644
'mac_bundle', 'mac_bundle',
'mac_bundle_resources', 'mac_bundle_resources',
'mac_framework_headers', 'mac_framework_headers',
@@ -761,6 +765,26 @@ def GenerateOutput(target_list, target_dicts, data, params): @@ -772,6 +776,26 @@ def GenerateOutput(target_list, target_dicts, data, params):
xcode_targets[qualified_target] = xct xcode_targets[qualified_target] = xct
xcode_target_to_target_dict[xct] = spec xcode_target_to_target_dict[xct] = spec

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,4,0 FILEVERSION 0,10,4,1
PRODUCTVERSION 0,10,4,0 PRODUCTVERSION 0,10,4,1
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.10.4.0" VALUE "FileVersion", "0.10.4.1"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.4.0" VALUE "ProductVersion", "0.10.4.1"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,4,0 FILEVERSION 0,10,4,1
PRODUCTVERSION 0,10,4,0 PRODUCTVERSION 0,10,4,1
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Updater" VALUE "FileDescription", "Telegram Updater"
VALUE "FileVersion", "0.10.4.0" VALUE "FileVersion", "0.10.4.1"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.4.0" VALUE "ProductVersion", "0.10.4.1"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -141,6 +141,7 @@ int main(int argc, char *argv[])
QString remove; QString remove;
int version = 0; int version = 0;
bool target32 = false;
QFileInfoList files; QFileInfoList files;
for (int i = 0; i < argc; ++i) { for (int i = 0; i < argc; ++i) {
if (string("-path") == argv[i] && i + 1 < argc) { if (string("-path") == argv[i] && i + 1 < argc) {
@ -148,6 +149,8 @@ int main(int argc, char *argv[])
QFileInfo info(path); QFileInfo info(path);
files.push_back(info); files.push_back(info);
if (remove.isEmpty()) remove = info.canonicalPath() + "/"; if (remove.isEmpty()) remove = info.canonicalPath() + "/";
} else if (string("-target") == argv[i] && i + 1 < argc) {
target32 = (string("mac32") == argv[i + 1]);
} else if (string("-version") == argv[i] && i + 1 < argc) { } else if (string("-version") == argv[i] && i + 1 < argc) {
version = QString(argv[i + 1]).toInt(); version = QString(argv[i + 1]).toInt();
} else if (string("-alpha") == argv[i]) { } else if (string("-alpha") == argv[i]) {
@ -451,11 +454,11 @@ int main(int argc, char *argv[])
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QString outName(QString("tupdate%1").arg(BetaVersion ? BetaVersion : version)); QString outName(QString("tupdate%1").arg(BetaVersion ? BetaVersion : version));
#elif defined Q_OS_MAC #elif defined Q_OS_MAC
QString outName(QString("tmacupd%1").arg(BetaVersion ? BetaVersion : version)); QString outName((target32 ? QString("tmac32upd%1") : QString("tmacupd%1")).arg(BetaVersion ? BetaVersion : version));
#elif defined Q_OS_LINUX32 #elif defined Q_OS_LINUX32
QString outName(QString("tlinux32upd%1").arg(BetaVersion ? BetaVersion : version)); QString outName(QString("tlinux32upd%1").arg(BetaVersion ? BetaVersion : version));
#elif defined Q_OS_LINUX64 #elif defined Q_OS_LINUX64
QString outName(QString("tlinuxupd%1").arg(BetaVersion ? BetaVersion : version)); QString outName(QString("tlinuxupd%1").arg(BetaVersion ? BetaVersion : version));
#else #else
#error Unknown platform! #error Unknown platform!
#endif #endif

View File

@ -22,9 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "core/basic_types.h" #include "core/basic_types.h"
#define BETA_VERSION_MACRO (0ULL) #define BETA_VERSION_MACRO (10004001ULL)
constexpr int AppVersion = 10004; constexpr int AppVersion = 10004;
constexpr str_const AppVersionStr = "0.10.4"; constexpr str_const AppVersionStr = "0.10.4";
constexpr bool AppAlphaVersion = true; constexpr bool AppAlphaVersion = false;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View File

@ -224,7 +224,7 @@ namespace {
} }
} else { } else {
secs = m.captured(1).toInt(); secs = m.captured(1).toInt();
if (secs >= 60) return false; // if (secs >= 60) return false;
} }
uint64 sendAt = getms(true) + secs * 1000 + 10; uint64 sendAt = getms(true) + secs * 1000 + 10;
DelayedRequestsList::iterator i = delayedRequests.begin(), e = delayedRequests.end(); DelayedRequestsList::iterator i = delayedRequests.begin(), e = delayedRequests.end();

View File

@ -430,7 +430,7 @@ bool mtpFileLoader::loadPart() {
App::app()->killDownloadSessionsStop(_dc); App::app()->killDownloadSessionsStop(_dc);
mtpRequestId reqId = MTP::send(MTPupload_GetFile(MTPupload_getFile(loc, MTP_int(offset), MTP_int(limit))), rpcDone(&mtpFileLoader::partLoaded, offset), rpcFail(&mtpFileLoader::partFailed), MTP::dldDcId(_dc, dcIndex), 50); mtpRequestId reqId = MTP::send(MTPupload_GetFile(loc, MTP_int(offset), MTP_int(limit)), rpcDone(&mtpFileLoader::partLoaded, offset), rpcFail(&mtpFileLoader::partFailed), MTP::dldDcId(_dc, dcIndex), 50);
++_queue->queries; ++_queue->queries;
dr.v[dcIndex] += limit; dr.v[dcIndex] += limit;

View File

@ -155,9 +155,9 @@ void QGtkDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindo
Libs::gtk_widget_realize(gtkWidget); // creates X window Libs::gtk_widget_realize(gtkWidget); // creates X window
if (parent) { if (parent) {
Platform::internal::XSetTransientForHint(Libs::gtk_widget_get_window(gtkWidget), parent->winId()); Platform::internal::XSetTransientForHint(Libs::gtk_widget_get_window(gtkWidget), parent->winId());
} }
if (modality != Qt::NonModal) { if (modality != Qt::NonModal) {
Libs::gdk_window_set_modal_hint(Libs::gtk_widget_get_window(gtkWidget), true); Libs::gdk_window_set_modal_hint(Libs::gtk_widget_get_window(gtkWidget), true);

View File

@ -25,15 +25,19 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
//Q_IMPORT_PLUGIN(QWinRTIntegrationPlugin) //Q_IMPORT_PLUGIN(QWinRTIntegrationPlugin)
//Q_IMPORT_PLUGIN(QWbmpPlugin) //Q_IMPORT_PLUGIN(QWbmpPlugin)
#elif defined Q_OS_WIN // Q_OS_WINRT #elif defined Q_OS_WIN // Q_OS_WINRT
Q_IMPORT_PLUGIN(QWebpPlugin)
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin)
#elif defined Q_OS_MAC // Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WIN
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin) Q_IMPORT_PLUGIN(QWebpPlugin)
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
#elif defined Q_OS_LINUX // Q_OS_LINUX #elif defined Q_OS_LINUX // Q_OS_LINUX
Q_IMPORT_PLUGIN(QWebpPlugin)
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin)
#endif #endif

View File

@ -3,8 +3,6 @@ FullExecPath=$PWD
pushd `dirname $0` > /dev/null pushd `dirname $0` > /dev/null
FullScriptPath=`pwd` FullScriptPath=`pwd`
popd > /dev/null popd > /dev/null
QMakePath="/usr/local/tdesktop/Qt-5.6.0/bin/qmake"
QMakeArgs="INCLUDEPATH+=/usr/local/include INCLUDEPATH+=/usr/local/include/opus"
if [ ! -d "$FullScriptPath/../../../TelegramPrivate" ]; then if [ ! -d "$FullScriptPath/../../../TelegramPrivate" ]; then
echo "" echo ""
@ -54,15 +52,13 @@ if [ "$BuildTarget" == "linux" ]; then
echo "Building version $AppVersionStrFull for Linux 64bit.." echo "Building version $AppVersionStrFull for Linux 64bit.."
UpdateFile="tlinuxupd$AppVersion" UpdateFile="tlinuxupd$AppVersion"
SetupFile="tsetup.$AppVersionStrFull.tar.xz" SetupFile="tsetup.$AppVersionStrFull.tar.xz"
WorkPath="$HomePath/../Linux" ReleasePath="$HomePath/../out/Release"
ReleasePath="$WorkPath/Release"
BinaryName="Telegram" BinaryName="Telegram"
elif [ "$BuildTarget" == "linux32" ]; then elif [ "$BuildTarget" == "linux32" ]; then
echo "Building version $AppVersionStrFull for Linux 32bit.." echo "Building version $AppVersionStrFull for Linux 32bit.."
UpdateFile="tlinux32upd$AppVersion" UpdateFile="tlinux32upd$AppVersion"
SetupFile="tsetup32.$AppVersionStrFull.tar.xz" SetupFile="tsetup32.$AppVersionStrFull.tar.xz"
WorkPath="$HomePath/../Linux" ReleasePath="$HomePath/../out/Release"
ReleasePath="$WorkPath/Release"
BinaryName="Telegram" BinaryName="Telegram"
elif [ "$BuildTarget" == "mac" ]; then elif [ "$BuildTarget" == "mac" ]; then
echo "Building version $AppVersionStrFull for OS X 10.8+.." echo "Building version $AppVersionStrFull for OS X 10.8+.."
@ -127,20 +123,9 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then
Error "Dropbox path not found!" Error "Dropbox path not found!"
fi fi
mkdir -p "$WorkPath/ReleaseIntermediateUpdater" gyp/refresh.sh
cd "$WorkPath/ReleaseIntermediateUpdater"
"$QMakePath" "$HomePath/Updater.pro" -r -spec linux-g++ cd $ReleasePath
make
echo "Updater build complete!"
mkdir -p "$WorkPath/ReleaseIntermediate"
cd "$WorkPath/ReleaseIntermediate"
"$QMakePath" $QMakeArgs "$HomePath/Telegram.pro" -r -spec linux-g++
eval "$HomePath/build/makefile_static.sh"
./../codegen/Debug/codegen_style "-I./../../Telegram/Resources" "-I./../../Telegram/SourceFiles" "-o./GeneratedFiles/styles" all_files.style --rebuild
./../codegen/Debug/codegen_numbers "-o./GeneratedFiles" "./../../Telegram/Resources/numbers.txt"
./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/langs/lang.strings -lang_out ./GeneratedFiles/lang_auto
make -j4 make -j4
echo "$BinaryName build complete!" echo "$BinaryName build complete!"
@ -301,7 +286,7 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "mac32" ] || [ "$BuildTarg
hdiutil convert tsetup.dmg -format UDZO -imagekey zlib-level=9 -ov -o "$SetupFile" hdiutil convert tsetup.dmg -format UDZO -imagekey zlib-level=9 -ov -o "$SetupFile"
fi fi
cd "$ReleasePath" cd "$ReleasePath"
"./Packer" -path "$BinaryName.app" -version $VersionForPacker $AlphaBetaParam "./Packer" -path "$BinaryName.app" -target "$BuildTarget" -version $VersionForPacker $AlphaBetaParam
echo "Packer done!" echo "Packer done!"
if [ "$BetaVersion" != "0" ]; then if [ "$BetaVersion" != "0" ]; then

View File

@ -50,13 +50,13 @@ if [ "$BuildTarget" == "linux" ]; then
echo "Deploying version $AppVersionStrFull for Linux 64bit.." echo "Deploying version $AppVersionStrFull for Linux 64bit.."
UpdateFile="tlinuxupd$AppVersion" UpdateFile="tlinuxupd$AppVersion"
SetupFile="tsetup.$AppVersionStrFull.tar.xz" SetupFile="tsetup.$AppVersionStrFull.tar.xz"
ReleasePath="$HomePath/../Linux/Release" ReleasePath="$HomePath/../out/Release"
RemoteFolder="tlinux" RemoteFolder="tlinux"
elif [ "$BuildTarget" == "linux32" ]; then elif [ "$BuildTarget" == "linux32" ]; then
echo "Deploying version $AppVersionStrFull for Linux 32bit.." echo "Deploying version $AppVersionStrFull for Linux 32bit.."
UpdateFile="tlinux32upd$AppVersion" UpdateFile="tlinux32upd$AppVersion"
SetupFile="tsetup32.$AppVersionStrFull.tar.xz" SetupFile="tsetup32.$AppVersionStrFull.tar.xz"
ReleasePath="$HomePath/../Linux/Release" ReleasePath="$HomePath/../out/Release"
RemoteFolder="tlinux32" RemoteFolder="tlinux32"
elif [ "$BuildTarget" == "mac" ]; then elif [ "$BuildTarget" == "mac" ]; then
DeployMac="0" DeployMac="0"

View File

@ -2,5 +2,5 @@ AppVersion 10004
AppVersionStrMajor 0.10 AppVersionStrMajor 0.10
AppVersionStrSmall 0.10.4 AppVersionStrSmall 0.10.4
AppVersionStr 0.10.4 AppVersionStr 0.10.4
AlphaChannel 1 AlphaChannel 0
BetaVersion 0 BetaVersion 10004001

View File

@ -0,0 +1,161 @@
##
## Modified for Telegram Desktop project by Telegram Desktop authors.
##
# Function for setting up precompiled headers. Usage:
#
# add_library/executable(target
# pchheader.c pchheader.cpp pchheader.h)
#
# add_precompiled_header(target pchheader.h
# [FORCEINCLUDE]
# [SOURCE_C pchheader.c]
# [SOURCE_CXX pchheader.cpp])
#
# Options:
#
# FORCEINCLUDE: Add compiler flags to automatically include the
# pchheader.h from every source file. Works with both GCC and
# MSVC. This is recommended.
#
# SOURCE_C/CXX: Specifies the .c/.cpp source file that includes
# pchheader.h for generating the pre-compiled header
# output. Defaults to pchheader.c. Only required for MSVC.
#
# Caveats:
#
# * Its not currently possible to use the same precompiled-header in
# more than a single target in the same directory (No way to set
# the source file properties differently for each target).
#
# * MSVC: A source file with the same name as the header must exist
# and be included in the target (E.g. header.cpp). Name of file
# can be changed using the SOURCE_CXX/SOURCE_C options.
#
# License:
#
# Copyright (C) 2009-2013 Lars Christensen <larsch@belunktum.dk>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the 'Software') deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
include(CMakeParseArguments)
macro(combine_arguments _variable)
set(_result "")
foreach(_element ${${_variable}})
set(_result "${_result} \"${_element}\"")
endforeach()
string(STRIP "${_result}" _result)
set(${_variable} "${_result}")
endmacro()
function(export_all_flags _filename _source_name_for_flags)
set(_include_directories "$<TARGET_PROPERTY:${_target},INCLUDE_DIRECTORIES>")
set(_compile_definitions "$<TARGET_PROPERTY:${_target},COMPILE_DEFINITIONS>")
get_source_file_property(_compile_flags "${_source_name_for_flags}" COMPILE_FLAGS)
set(_compile_options "$<TARGET_PROPERTY:${_target},COMPILE_OPTIONS>")
set(_include_directories "$<$<BOOL:${_include_directories}>:-I$<JOIN:${_include_directories},\n-I>\n>")
set(_compile_definitions "$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions},\n-D>\n>")
set(_compile_flags "$<$<BOOL:${_compile_flags}>:$<JOIN:${_compile_flags},\n>\n>")
set(_compile_options "$<$<BOOL:${_compile_options}>:$<JOIN:${_compile_options},\n>\n>")
file(GENERATE OUTPUT "${_filename}" CONTENT "${_source_name_for_flags}\n${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}\n")
endfunction()
function(add_precompiled_header _target _input)
if(CMAKE_COMPILER_IS_GNUCXX)
get_filename_component(_name ${_input} NAME)
set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch")
set(_pchfile "${_pch_binary_dir}/${_name}")
set(_outdir "${_pch_binary_dir}/${_name}.gch")
make_directory(${_outdir})
set(_output_cxx "${_outdir}/.c++")
set(_output_c "${_outdir}/.c")
get_property(_sources TARGET ${_target} PROPERTY SOURCES)
foreach(_source ${_sources})
if(_source MATCHES \\.\(c\)$ AND NOT _source_for_c_flags)
set(_source_for_c_flags "${_source}")
elseif(_source MATCHES \\.\(cc|cxx|cpp\)$ AND NOT _source_for_cpp_flags)
set(_source_for_cpp_flags "${_source}")
endif()
endforeach()
add_custom_command(
OUTPUT "${_pchfile}"
COMMAND "${CMAKE_COMMAND}" -E copy "${_pch_header}" "${_pchfile}"
DEPENDS "${_pch_header}"
COMMENT "Updating ${_name}")
if(_source_for_c_flags)
set(_pch_c_flags_file "${_pch_binary_dir}/compile_flags_c.rsp")
export_all_flags("${_pch_c_flags_file}" "${_source_for_c_flags}")
set(_compiler_FLAGS "@${_pch_c_flags_file}")
add_custom_command(
OUTPUT "${_output_c}"
COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}"
DEPENDS "${_pchfile}" "${_pch_c_flags_file}"
COMMENT "Precompiling ${_name} for ${_target} (C)")
endif()
if(_source_for_cpp_flags)
set(_pch_cpp_flags_file "${_pch_binary_dir}/compile_flags_cpp.rsp")
export_all_flags("${_pch_cpp_flags_file}" "${_source_for_cpp_flags}")
set(_compiler_FLAGS "@${_pch_cpp_flags_file}")
add_custom_command(
OUTPUT "${_output_cxx}"
COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}"
COMMENT "Precompiling ${_name} for ${_target} (C++)")
endif()
foreach(_source ${_sources})
set(_pch_compile_flags "")
if(_source MATCHES \\.\(cc|cxx|cpp|c\)$)
get_source_file_property(_pch_compile_flags "${_source}" COMPILE_FLAGS)
if(NOT _pch_compile_flags)
set(_pch_compile_flags)
endif()
separate_arguments(_pch_compile_flags)
if(_source MATCHES \\.\(cc|cxx|cpp\)$)
list(APPEND _pch_compile_flags -Winvalid-pch -include "${_pchfile}")
else()
list(APPEND _pch_compile_flags -Winvalid-pch "-I${_pch_binary_dir}")
endif()
get_source_file_property(_object_depends "${_source}" OBJECT_DEPENDS)
if(NOT _object_depends)
set(_object_depends)
endif()
list(APPEND _object_depends "${_pchfile}")
if(_source MATCHES \\.\(cc|cxx|cpp\)$)
list(APPEND _object_depends "${_output_cxx}")
else()
list(APPEND _object_depends "${_output_c}")
endif()
combine_arguments(_pch_compile_flags)
set_source_files_properties(${_source} PROPERTIES
COMPILE_FLAGS "${_pch_compile_flags}"
OBJECT_DEPENDS "${_object_depends}")
endif()
endforeach()
endif(CMAKE_COMPILER_IS_GNUCXX)
endfunction()

View File

@ -57,6 +57,7 @@
'telegram_mac.gypi', 'telegram_mac.gypi',
'telegram_linux.gypi', 'telegram_linux.gypi',
'qt.gypi', 'qt.gypi',
'qt_rcc.gypi',
'codegen_rules.gypi', 'codegen_rules.gypi',
], ],
@ -199,6 +200,7 @@
'<(src_loc)/core/qthelp_url.cpp', '<(src_loc)/core/qthelp_url.cpp',
'<(src_loc)/core/qthelp_url.h', '<(src_loc)/core/qthelp_url.h',
'<(src_loc)/core/vector_of_moveable.h', '<(src_loc)/core/vector_of_moveable.h',
'<(src_loc)/core/version.h',
'<(src_loc)/data/data_abstract_structure.cpp', '<(src_loc)/data/data_abstract_structure.cpp',
'<(src_loc)/data/data_abstract_structure.h', '<(src_loc)/data/data_abstract_structure.h',
'<(src_loc)/data/data_drafts.cpp', '<(src_loc)/data/data_drafts.cpp',
@ -455,19 +457,11 @@
'<(src_loc)/window/top_bar_widget.cpp', '<(src_loc)/window/top_bar_widget.cpp',
'<(src_loc)/window/top_bar_widget.h', '<(src_loc)/window/top_bar_widget.h',
], ],
'configurations': {
'Release': {
'conditions': [
['"<(official_build_target)" != ""', {
'defines': [
'CUSTOM_API_ID',
],
}],
],
},
},
'conditions': [ 'conditions': [
[ '"<(official_build_target)" != ""', { [ '"<(official_build_target)" != ""', {
'defines': [
'CUSTOM_API_ID',
],
'dependencies': [ 'dependencies': [
'utils.gyp:Packer', 'utils.gyp:Packer',
], ],

View File

@ -18,10 +18,11 @@
# Copyright (c) 2014 John Preston, https://desktop.telegram.org # Copyright (c) 2014 John Preston, https://desktop.telegram.org
{ {
'includes': [ 'includes': [
'settings_win.gypi', 'settings_win.gypi',
'settings_mac.gypi', 'settings_mac.gypi',
], 'settings_linux.gypi',
],
'variables': { 'variables': {
'variables': { 'variables': {
'variables': { 'variables': {
@ -58,7 +59,7 @@
'build_mac%': '<(build_mac)', 'build_mac%': '<(build_mac)',
'build_linux%': '<(build_linux)', 'build_linux%': '<(build_linux)',
'official_build_target%': '<!(python <(DEPTH)/official.py --read-target)', 'official_build_target%': '<!(python <(DEPTH)/official.py --read-target)',
}, },
'build_os%': '<(build_os)', 'build_os%': '<(build_os)',
'build_win%': '<(build_win)', 'build_win%': '<(build_win)',

View File

@ -23,14 +23,13 @@
'variables': { 'variables': {
'variables': { 'variables': {
'qt_libs': [ 'qt_libs': [
'Qt5Core',
'Qt5Gui',
'Qt5Widgets',
'qtharfbuzzng',
'Qt5Network',
'Qt5PlatformSupport',
'Qt5PrintSupport',
'qwebp', 'qwebp',
'Qt5PrintSupport',
'Qt5PlatformSupport',
'Qt5Network',
'Qt5Widgets',
'Qt5Gui',
'qtharfbuzzng',
], ],
'conditions': [ 'conditions': [
[ 'build_macold', { [ 'build_macold', {
@ -48,8 +47,11 @@
'qt_lib_release_postfix': '<(ld_lib_postfix)', 'qt_lib_release_postfix': '<(ld_lib_postfix)',
'qt_libs': [ 'qt_libs': [
'<@(qt_libs)', '<@(qt_libs)',
'Qt5Core',
'qtmain', 'qtmain',
'qwindows', 'qwindows',
'qtfreetype',
'qtpcre',
], ],
}], }],
[ 'build_mac', { [ 'build_mac', {
@ -58,20 +60,54 @@
'qt_lib_release_postfix': '<(ld_lib_postfix)', 'qt_lib_release_postfix': '<(ld_lib_postfix)',
'qt_libs': [ 'qt_libs': [
'<@(qt_libs)', '<@(qt_libs)',
'Qt5Core',
'qgenericbearer', 'qgenericbearer',
'qcocoa', 'qcocoa',
], ],
}], }],
[ 'build_macold', { [ 'build_macold', {
'qt_loc_unix': '/usr/local/Qt-<(qt_version)' 'qt_loc_unix': '/usr/local/Qt-<(qt_version)'
}, { }],
[ 'build_mac and not build_macold', {
'qt_loc_unix': '/usr/local/tdesktop/Qt-<(qt_version)', 'qt_loc_unix': '/usr/local/tdesktop/Qt-<(qt_version)',
'qt_libs': [ 'qt_libs': [
'<@(qt_libs)', '<@(qt_libs)',
'qtfreetype', 'Qt5Core',
'qtpcre', 'qtfreetype',
'qtpcre',
], ],
}] }],
[ 'build_linux', {
'qt_loc_unix': '/usr/local/tdesktop/Qt-<(qt_version)',
'qt_lib_prefix': 'lib',
'qt_lib_debug_postfix': '.a',
'qt_lib_release_postfix': '.a',
'qt_libs': [
'qxcb',
'Qt5XcbQpa',
'qconnmanbearer',
'qgenericbearer',
'qnmbearer',
'<@(qt_libs)',
'Qt5DBus',
'Qt5Core',
'qtpcre',
'ssl',
'crypto',
'Xi',
'Xext',
'SM',
'ICE',
'fontconfig',
'expat',
'freetype',
'xcb',
'xcb-shm',
'xcb-xfixes',
'xcb-render',
'xcb-static',
],
}],
], ],
}, },
'qt_version%': '<(qt_version)', 'qt_version%': '<(qt_version)',
@ -143,6 +179,10 @@
'include_dirs': [ 'include_dirs': [
'<(qt_loc)/include', '<(qt_loc)/include',
'<(qt_loc)/include/QtCore',
'<(qt_loc)/include/QtGui',
'<(qt_loc)/include/QtCore/<(qt_version)',
'<(qt_loc)/include/QtGui/<(qt_version)',
'<(qt_loc)/include/QtCore/<(qt_version)/QtCore', '<(qt_loc)/include/QtCore/<(qt_version)/QtCore',
'<(qt_loc)/include/QtGui/<(qt_version)/QtGui', '<(qt_loc)/include/QtGui/<(qt_version)/QtGui',
], ],
@ -152,6 +192,7 @@
'<(qt_loc)/plugins/bearer', '<(qt_loc)/plugins/bearer',
'<(qt_loc)/plugins/platforms', '<(qt_loc)/plugins/platforms',
'<(qt_loc)/plugins/imageformats', '<(qt_loc)/plugins/imageformats',
'<(qt_loc)/plugins/platforminputcontexts',
], ],
'defines': [ 'defines': [
'QT_WIDGETS_LIB', 'QT_WIDGETS_LIB',
@ -159,6 +200,33 @@
'QT_GUI_LIB', 'QT_GUI_LIB',
'QT_CORE_LIB', 'QT_CORE_LIB',
], ],
'conditions': [
[ 'build_linux', {
'library_dirs': [
'<(qt_loc)/plugins/platforms/xcb/xcb-static',
],
'libraries': [
'/usr/local/lib/libxkbcommon.a',
'<@(qt_libs_release)',
'X11',
'X11-xcb',
'dbus-1',
'dl',
'gthread-2.0',
'glib-2.0',
'pthread',
],
'include_dirs': [
'<(qt_loc)/mkspecs/linux-g++',
],
'ldflags': [
'-static-libstdc++',
'-pthread',
'-g',
'-rdynamic',
],
}],
],
'rules': [{ 'rules': [{
'rule_name': 'qt_moc', 'rule_name': 'qt_moc',
@ -179,23 +247,5 @@
], ],
'message': 'Moc-ing <(RULE_INPUT_ROOT).h..', 'message': 'Moc-ing <(RULE_INPUT_ROOT).h..',
'process_outputs_as_sources': 1, 'process_outputs_as_sources': 1,
}, {
'rule_name': 'qt_rcc',
'extension': 'qrc',
'inputs': [
'<(SHARED_INTERMEDIATE_DIR)/update_dependent_qrc.timestamp',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
'<(qt_loc)/bin/rcc<(exe_ext)',
'-name', '<(RULE_INPUT_ROOT)',
'-no-compress',
'<(RULE_INPUT_PATH)',
'-o', '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'message': 'Rcc-ing <(RULE_INPUT_ROOT).qrc..',
'process_outputs_as_sources': 1,
}], }],
} }

40
Telegram/gyp/qt_rcc.gypi Normal file
View File

@ -0,0 +1,40 @@
# 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
{
'rules': [{
'rule_name': 'qt_rcc',
'extension': 'qrc',
'inputs': [
'<(SHARED_INTERMEDIATE_DIR)/update_dependent_qrc.timestamp',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
'<(qt_loc)/bin/rcc<(exe_ext)',
'-name', '<(RULE_INPUT_ROOT)',
'-no-compress',
'<(RULE_INPUT_PATH)',
'-o', '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'message': 'Rcc-ing <(RULE_INPUT_ROOT).qrc..',
'process_outputs_as_sources': 1,
}],
}

View File

@ -4,12 +4,24 @@ pushd `dirname $0` > /dev/null
FullScriptPath=`pwd` FullScriptPath=`pwd`
popd > /dev/null popd > /dev/null
MySystem=`uname -s`
cd $FullScriptPath cd $FullScriptPath
#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=ninja
#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja if [ "$MySystem" == "Linux" ]; then
#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode ../../../Libraries/gyp/gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=cmake
# use patched gyp with Xcode project generator cd ../../out/Debug
../../../Libraries/gyp/gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode ../../../Libraries/cmake-3.6.2/bin/cmake .
cd ../Release
../../../Libraries/cmake-3.6.2/bin/cmake .
cd ../../Telegram/gyp
else
#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=ninja
#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja
#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode
# use patched gyp with Xcode project generator
../../../Libraries/gyp/gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode
fi
cd ../.. cd ../..
cd $FullExecPath cd $FullExecPath

View File

@ -0,0 +1,79 @@
# 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_linux', {
'variables': {
'linux_common_flags': [
'-pipe',
'-g',
'-Wall',
'-W',
'-fPIC',
'-Wno-unused-result',
'-Wno-unused-variable',
'-Wno-unused-parameter',
'-Wno-unused-function',
'-Wno-switch',
'-Wno-comment',
'-Wno-unused-but-set-variable',
'-Wno-missing-field-initializers',
],
},
'conditions': [
[ '"<!(uname -p)" == "x86_64"', {
'defines': [
'Q_OS_LINUX64',
],
'conditions': [
[ '"<(official_build_target)" != "" and "<(official_build_target)" != "linux"', {
'sources': [ '__Wrong_Official_Build_Target__' ],
}],
],
}, {
'defines': [
'Q_OS_LINUX32',
],
'conditions': [
[ '"<(official_build_target)" != "" and "<(official_build_target)" != "linux32"', {
'sources': [ '__Wrong_Official_Build_Target_<(official_build_target)_' ],
}],
],
}],
],
'defines': [
'_REENTRANT',
'QT_STATICPLUGIN',
'QT_PLUGIN',
],
'cflags': [
'<@(linux_common_flags)',
],
'cflags_cc': [
'<@(linux_common_flags)',
'-std=gnu++1y',
],
'configurations': {
'Debug': {
},
},
}],
],
}

View File

@ -73,13 +73,18 @@
'CLANG_CXX_LANGUAGE_STANDARD': 'c++14', 'CLANG_CXX_LANGUAGE_STANDARD': 'c++14',
}, },
'configurations': { 'configurations': {
'Debug': { 'Debug': {
'xcode_settings': { 'xcode_settings': {
'ENABLE_TESTABILITY': 'YES', 'ENABLE_TESTABILITY': 'YES',
'ONLY_ACTIVE_ARCH': 'YES', 'ONLY_ACTIVE_ARCH': 'YES',
}, },
}, },
}, },
'conditions': [
[ '"<(official_build_target)" != "" and "<(official_build_target)" != "mac" and "<(official_build_target)" != "mac32" and "<(official_build_target)" != "macstore"', {
'sources': [ '__Wrong_Official_Build_Target__' ],
}],
],
}], }],
[ 'build_macold', { [ 'build_macold', {
'xcode_settings': { 'xcode_settings': {

View File

@ -101,6 +101,11 @@
}, },
}, },
}, },
'conditions': [
[ '"<(official_build_target)" != "" and "<(official_build_target)" != "win"', {
'sources': [ '__Wrong_Official_Build_Target__' ],
}],
],
}], }],
], ],
} }

View File

@ -19,6 +19,15 @@
{ {
'conditions': [[ 'build_linux', { 'conditions': [[ 'build_linux', {
'variables': {
'pkgconfig_libs': [
# In order to work libxkbcommon must be linked statically,
# PKGCONFIG links it like "-L/usr/local/lib -lxkbcommon"
# which makes a dynamic link which leads to segfault in
# QApplication() -> createPlatformIntegration -> QXcbIntegrationPlugin::create
#'xkbcommon',
],
},
'include_dirs': [ 'include_dirs': [
'/usr/local/include', '/usr/local/include',
'<(libs_loc)/openssl-xcode/include' '<(libs_loc)/openssl-xcode/include'
@ -26,11 +35,52 @@
'library_dirs': [ 'library_dirs': [
'/usr/local/lib', '/usr/local/lib',
'<(libs_loc)/libexif-0.6.20/libexif/.libs', '<(libs_loc)/libexif-0.6.20/libexif/.libs',
'<(libs_loc)/breakpad/src/client/linux',
], ],
'libraries': [ 'libraries': [
'-lssl', 'breakpad_client',
'-lcrypto', 'composeplatforminputcontextplugin',
'-llzma', 'ibusplatforminputcontextplugin',
'fcitxplatforminputcontextplugin',
'liblzma.a',
'libopenal.a',
'libavformat.a',
'libavcodec.a',
'libswresample.a',
'libswscale.a',
'libavutil.a',
'libopus.a',
'libva-x11.a',
'libva-drm.a',
'libva.a',
'libz.a',
# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
], ],
'cflags_cc': [
'<!(pkg-config 2> /dev/null --cflags appindicator-0.1)',
'<!(pkg-config 2> /dev/null --cflags gtk+-2.0)',
'<!(pkg-config 2> /dev/null --cflags glib-2.0)',
'<!(pkg-config 2> /dev/null --cflags dee-1.0)',
],
'configurations': {
'Release': {
'cflags': [
'-Ofast',
'-flto',
'-fno-strict-aliasing',
],
'cflags_cc': [
'-Ofast',
'-flto',
'-fno-strict-aliasing',
],
'ldflags': [
'-Ofast',
'-flto',
],
},
},
'cmake_precompiled_header': '<(src_loc)/stdafx.h',
'cmake_precompiled_header_script': 'PrecompiledHeader.cmake',
}]], }]],
} }

View File

@ -84,6 +84,13 @@
'LzmaLib', 'LzmaLib',
], ],
}], }],
[ 'build_linux', {
'libraries': [
'ssl',
'crypto',
'lzma',
],
}],
], ],
'xcode_settings': { 'xcode_settings': {
'OTHER_LDFLAGS': [ 'OTHER_LDFLAGS': [