Skip to content

Commit d99218f

Browse files
committed
Packed resources
Dynamically load packed resources from a separate file. This reduces amount of main memory required for linking stage.
1 parent 64b5269 commit d99218f

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

Telegram/CMakeLists.txt

+11-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ if (WIN32)
5151
endif()
5252

5353
set_target_properties(Telegram PROPERTIES AUTOMOC ON)
54-
target_prepare_qrc(Telegram)
54+
if (LINUX)
55+
# Do not repeat app name in path of a resource archive.
56+
target_prepare_qrc(Telegram tresources.rcc)
57+
else()
58+
target_prepare_qrc(Telegram)
59+
endif()
5560

5661
target_link_libraries(Telegram
5762
PRIVATE
@@ -1536,7 +1541,11 @@ if (LINUX AND DESKTOP_APP_USE_PACKAGED)
15361541
include(GNUInstallDirs)
15371542
configure_file("../lib/xdg/telegramdesktop.metainfo.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml" @ONLY)
15381543
generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml")
1539-
install(TARGETS Telegram RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}")
1544+
install(TARGETS Telegram
1545+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
1546+
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}"
1547+
RESOURCE DESTINATION "${CMAKE_INSTALL_DATADIR}/TelegramDesktop"
1548+
)
15401549
install(FILES "Resources/art/icon16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "telegram.png")
15411550
install(FILES "Resources/art/icon32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "telegram.png")
15421551
install(FILES "Resources/art/icon48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "telegram.png")

Telegram/SourceFiles/main/main_session.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,11 @@ rpl::producer<bool> Session::termsLockValue() const {
293293
}
294294

295295
QString Session::createInternalLink(const QString &query) const {
296-
return createInternalLink({ .text = query }).text;
296+
return createInternalLink(TextWithEntities{ .text = query }).text;
297297
}
298298

299299
QString Session::createInternalLinkFull(const QString &query) const {
300-
return createInternalLinkFull({ .text = query }).text;
300+
return createInternalLinkFull(TextWithEntities{ .text = query }).text;
301301
}
302302

303303
TextWithEntities Session::createInternalLink(

Telegram/SourceFiles/platform/linux/launcher_linux.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
77
*/
88
#include "platform/linux/launcher_linux.h"
99

10+
#include "base/base_file_utilities.h"
1011
#include "core/crash_reports.h"
1112
#include "core/update_checker.h"
1213
#include "webview/platform/linux/webview_linux_webkit2gtk.h"
@@ -82,6 +83,8 @@ void Launcher::initHook() {
8283

8384
return qsl(QT_STRINGIFY(TDESKTOP_LAUNCHER_BASENAME) ".desktop");
8485
}());
86+
87+
base::RegisterResourceArchive(u"tresources.rcc"_q);
8588
}
8689

8790
bool Launcher::launchUpdater(UpdaterLaunch action) {

Telegram/SourceFiles/platform/mac/launcher_mac.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// macOS Retina display support is working fine, others are not.
2828
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, false);
2929

30-
base::RegisterBundledResources(u"Telegram.rcc"_q);
30+
base::RegisterResourceArchive(u"Telegram.rcc"_q);
3131
}
3232

3333
bool Launcher::launchUpdater(UpdaterLaunch action) {

0 commit comments

Comments
 (0)