mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-09 00:27:09 +00:00
Make packaged build working
This commit is contained in:
parent
00e601296c
commit
6fdd1389e6
@ -27,12 +27,12 @@ include(cmake/generate_numbers.cmake)
|
||||
get_filename_component(src_loc SourceFiles REALPATH)
|
||||
get_filename_component(res_loc Resources REALPATH)
|
||||
|
||||
include(cmake/telegram_options.cmake)
|
||||
include(cmake/lib_export.cmake)
|
||||
include(cmake/lib_ffmpeg.cmake)
|
||||
include(cmake/lib_mtproto.cmake)
|
||||
include(cmake/lib_scheme.cmake)
|
||||
include(cmake/lib_tgvoip.cmake)
|
||||
include(cmake/telegram_options.cmake)
|
||||
|
||||
set(style_files
|
||||
boxes/boxes.style
|
||||
@ -65,6 +65,17 @@ generate_numbers(Telegram ${res_loc}/numbers.txt)
|
||||
|
||||
set_target_properties(Telegram PROPERTIES AUTOMOC ON AUTORCC ON)
|
||||
|
||||
if (DESKTOP_APP_USE_PACKAGED)
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
find_package(Threads)
|
||||
|
||||
target_link_libraries(Telegram
|
||||
PRIVATE
|
||||
${CMAKE_DL_LIBS}
|
||||
Threads::Threads
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(Telegram
|
||||
PRIVATE
|
||||
tdesktop::lib_mtproto
|
||||
@ -83,15 +94,15 @@ PRIVATE
|
||||
desktop-app::external_zlib
|
||||
desktop-app::external_qt
|
||||
desktop-app::external_qr_code_generator
|
||||
desktop-app::external_crash_reports
|
||||
desktop-app::external_auto_updates
|
||||
tdesktop::lib_tgvoip
|
||||
desktop-app::external_openssl
|
||||
desktop-app::external_opus
|
||||
desktop-app::external_openal
|
||||
)
|
||||
|
||||
if (NOT DESKTOP_APP_DISABLE_CRASH_REPORTS)
|
||||
target_link_libraries(Telegram PRIVATE desktop-app::external_crash_reports)
|
||||
if (NOT DESKTOP_APP_USE_PACKAGED)
|
||||
target_link_libraries(Telegram PRIVATE desktop-app::external_opus)
|
||||
endif()
|
||||
|
||||
target_precompile_headers(Telegram PRIVATE ${src_loc}/stdafx.h)
|
||||
@ -936,11 +947,16 @@ PRIVATE
|
||||
mainwindow.h
|
||||
observer_peer.cpp
|
||||
observer_peer.h
|
||||
qt_static_plugins.cpp
|
||||
settings.cpp
|
||||
settings.h
|
||||
)
|
||||
|
||||
if (DESKTOP_APP_USE_PACKAGED)
|
||||
nice_target_sources(Telegram ${src_loc} PRIVATE qt_functions.cpp)
|
||||
else()
|
||||
nice_target_sources(Telegram ${src_loc} PRIVATE qt_static_plugins.cpp)
|
||||
endif()
|
||||
|
||||
nice_target_sources(Telegram ${res_loc}
|
||||
PRIVATE
|
||||
qrc/emoji_1.qrc
|
||||
@ -1018,10 +1034,15 @@ elseif (LINUX)
|
||||
if (NOT TDESKTOP_DISABLE_GTK_INTEGRATION)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(GTK2 REQUIRED gtk+-2.0)
|
||||
target_include_directories(Telegram PRIVATE ${GTK2_INCLUDE_DIRS})
|
||||
pkg_search_module(GTK REQUIRED gtk+-2.0 gtk+-3.0)
|
||||
target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
|
||||
target_compile_options(Telegram PRIVATE -Wno-register)
|
||||
|
||||
if (DESKTOP_APP_USE_PACKAGED)
|
||||
find_library(X11_LIBRARY X11)
|
||||
target_link_libraries(Telegram PRIVATE ${X11_LIBRARY})
|
||||
endif()
|
||||
|
||||
set(appindicator_packages
|
||||
ayatana-appindicator3-0.1
|
||||
ayatana-appindicator-0.1
|
||||
@ -1094,23 +1115,26 @@ set(entitlement_sources
|
||||
target_sources(Telegram PRIVATE ${entitlement_sources})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Telegram PREFIX Resources FILES ${entitlement_sources})
|
||||
|
||||
target_include_directories(Telegram
|
||||
PRIVATE
|
||||
${src_loc}
|
||||
${third_party_loc}/minizip
|
||||
)
|
||||
target_include_directories(Telegram PRIVATE ${src_loc})
|
||||
|
||||
if (NOT DESKTOP_APP_USE_PACKAGED)
|
||||
target_include_directories(Telegram PRIVATE ${third_party_loc}/minizip)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(Telegram
|
||||
PRIVATE
|
||||
TDESKTOP_API_ID=${TDESKTOP_API_ID}
|
||||
TDESKTOP_API_HASH=${TDESKTOP_API_HASH}
|
||||
AL_LIBTYPE_STATIC
|
||||
AL_ALEXT_PROTOTYPES
|
||||
)
|
||||
|
||||
if ((${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)") OR ((${CMAKE_GENERATOR} MATCHES "(Ninja)") AND NOT ${CMAKE_EXECUTABLE_SUFFIX} STREQUAL ""))
|
||||
if (NOT DESKTOP_APP_USE_PACKAGED)
|
||||
target_compile_definitions(Telegram PRIVATE AL_LIBTYPE_STATIC)
|
||||
endif()
|
||||
|
||||
if (${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)")
|
||||
set(output_folder ${CMAKE_BINARY_DIR})
|
||||
elseif((${CMAKE_GENERATOR} MATCHES "(Unix Makefiles|Ninja)") AND DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
|
||||
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
|
||||
set(output_folder ${CMAKE_BINARY_DIR}/bin)
|
||||
else()
|
||||
set(output_folder ${CMAKE_BINARY_DIR}/$<IF:$<CONFIG:Debug>,Debug,Release>)
|
||||
@ -1118,7 +1142,7 @@ endif()
|
||||
|
||||
set_target_properties(Telegram PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder})
|
||||
|
||||
if (NOT build_macstore AND NOT build_winstore)
|
||||
if ((NOT disable_autoupdate OR NOT LINUX) AND NOT build_macstore AND NOT build_winstore)
|
||||
add_executable(Updater WIN32)
|
||||
init_target(Updater)
|
||||
|
||||
|
99
Telegram/SourceFiles/qt_functions.cpp
Normal file
99
Telegram/SourceFiles/qt_functions.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file contains some parts of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
// For QTextItemInt declaraion
|
||||
#include <private/qtextengine_p.h>
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||
/* TODO: find a dynamic library with these symbols. */
|
||||
|
||||
/* Debian maintainer: this function is taken from qfiledialog.cpp */
|
||||
/*
|
||||
Makes a list of filters from ;;-separated text.
|
||||
Used by the mac and windows implementations
|
||||
*/
|
||||
QStringList qt_make_filter_list(const QString &filter)
|
||||
{
|
||||
QString f(filter);
|
||||
|
||||
if (f.isEmpty())
|
||||
return QStringList();
|
||||
|
||||
QString sep(QLatin1String(";;"));
|
||||
int i = f.indexOf(sep, 0);
|
||||
if (i == -1) {
|
||||
if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
|
||||
sep = QLatin1Char('\n');
|
||||
i = f.indexOf(sep, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return f.split(sep);
|
||||
}
|
||||
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||
|
||||
/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */
|
||||
QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
|
||||
: flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
|
||||
num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe)
|
||||
{
|
||||
}
|
||||
|
||||
/* Debian maintainer: this method is also taken from qtextengine.cpp */
|
||||
// Fix up flags and underlineStyle with given info
|
||||
void QTextItemInt::initWithScriptItem(const QScriptItem &si)
|
||||
{
|
||||
// explicitly initialize flags so that initFontAttributes can be called
|
||||
// multiple times on the same TextItem
|
||||
flags = 0;
|
||||
if (si.analysis.bidiLevel %2)
|
||||
flags |= QTextItem::RightToLeft;
|
||||
ascent = si.ascent;
|
||||
descent = si.descent;
|
||||
|
||||
if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
|
||||
underlineStyle = charFormat.underlineStyle();
|
||||
} else if (charFormat.boolProperty(QTextFormat::FontUnderline)
|
||||
|| f->d->underline) {
|
||||
underlineStyle = QTextCharFormat::SingleUnderline;
|
||||
}
|
||||
|
||||
// compat
|
||||
if (underlineStyle == QTextCharFormat::SingleUnderline)
|
||||
flags |= QTextItem::Underline;
|
||||
|
||||
if (f->d->overline || charFormat.fontOverline())
|
||||
flags |= QTextItem::Overline;
|
||||
if (f->d->strikeOut || charFormat.fontStrikeOut())
|
||||
flags |= QTextItem::StrikeOut;
|
||||
}
|
@ -5,6 +5,8 @@
|
||||
# https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
function(generate_scheme target_name script scheme_files)
|
||||
find_package(Python REQUIRED)
|
||||
|
||||
set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen)
|
||||
file(MAKE_DIRECTORY ${gen_dst})
|
||||
|
||||
@ -22,7 +24,7 @@ function(generate_scheme target_name script scheme_files)
|
||||
BYPRODUCTS
|
||||
${gen_files}
|
||||
COMMAND
|
||||
python
|
||||
${Python_EXECUTABLE}
|
||||
${script}
|
||||
-o${gen_dst}/scheme
|
||||
${scheme_files}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@ option(TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME "Disable automatic 'tg://' URL sc
|
||||
option(TDESKTOP_DISABLE_NETWORK_PROXY "Disable all code for working through Socks5 or MTProxy." OFF)
|
||||
option(TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION "Disable automatic '.desktop' file generation (Linux only)." OFF)
|
||||
option(TDESKTOP_DISABLE_GTK_INTEGRATION "Disable all code for GTK integration (Linux only)." OFF)
|
||||
option(TDESKTOP_USE_PACKAGED_TGVOIP "Find libtgvoip using CMake instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
|
||||
option(TDESKTOP_API_TEST "Use test API credentials." OFF)
|
||||
set(TDESKTOP_API_ID "0" CACHE STRING "Provide 'api_id' for the Telegram API access.")
|
||||
set(TDESKTOP_API_HASH "" CACHE STRING "Provide 'api_hash' for the Telegram API access.")
|
||||
|
2
cmake
2
cmake
@ -1 +1 @@
|
||||
Subproject commit 7081bc283b988361ae8be2c37e09e0d97c40b7db
|
||||
Subproject commit 204c3fec5c9f5cd72c493c3d4fc76bb8acb628b9
|
Loading…
Reference in New Issue
Block a user