Skip to content

Commit e6f4ead

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 03e9084 commit e6f4ead

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Telegram/CMakeLists.txt

+11-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ if (WIN32)
4848
endif()
4949

5050
set_target_properties(Telegram PROPERTIES AUTOMOC ON)
51-
target_prepare_qrc(Telegram)
51+
if (LINUX)
52+
# Do not repeat app name in path of a resource archive.
53+
target_prepare_qrc(Telegram tresources.rcc)
54+
else()
55+
target_prepare_qrc(Telegram)
56+
endif()
5257

5358
target_link_libraries(Telegram
5459
PRIVATE
@@ -1657,7 +1662,11 @@ if (LINUX AND DESKTOP_APP_USE_PACKAGED)
16571662
include(GNUInstallDirs)
16581663
configure_file("../lib/xdg/telegramdesktop.metainfo.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml" @ONLY)
16591664
generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml")
1660-
install(TARGETS Telegram RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}")
1665+
install(TARGETS Telegram
1666+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
1667+
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}"
1668+
RESOURCE DESTINATION "${CMAKE_INSTALL_DATADIR}/TelegramDesktop"
1669+
)
16611670
install(FILES "Resources/art/icon16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "telegram.png")
16621671
install(FILES "Resources/art/icon32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "telegram.png")
16631672
install(FILES "Resources/art/icon48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "telegram.png")

Telegram/SourceFiles/platform/linux/launcher_linux.cpp

+2
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"
@@ -64,6 +65,7 @@ int Launcher::exec() {
6465

6566
void Launcher::initHook() {
6667
QApplication::setAttribute(Qt::AA_DisableSessionManager, true);
68+
base::RegisterResourceArchive(u"tresources.rcc"_q);
6769
}
6870

6971
bool Launcher::launchUpdater(UpdaterLaunch action) {

Telegram/SourceFiles/platform/mac/launcher_mac.mm

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
void Launcher::initHook() {
2727
// macOS Retina display support is working fine, others are not.
2828
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, false);
29-
30-
base::RegisterBundledResources(u"Telegram.rcc"_q);
29+
base::RegisterResourceArchive(u"Telegram.rcc"_q);
3130
}
3231

3332
bool Launcher::launchUpdater(UpdaterLaunch action) {

0 commit comments

Comments
 (0)