Skip to content

Commit b986736

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 4b03fd0 commit b986736

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
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
@@ -1528,7 +1533,11 @@ if (LINUX AND DESKTOP_APP_USE_PACKAGED)
15281533
include(GNUInstallDirs)
15291534
configure_file("../lib/xdg/telegramdesktop.metainfo.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml" @ONLY)
15301535
generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml")
1531-
install(TARGETS Telegram RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}")
1536+
install(TARGETS Telegram
1537+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
1538+
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}"
1539+
RESOURCE DESTINATION "${CMAKE_INSTALL_DATADIR}/TelegramDesktop"
1540+
)
15321541
install(FILES "Resources/art/icon16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "telegram.png")
15331542
install(FILES "Resources/art/icon32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "telegram.png")
15341543
install(FILES "Resources/art/icon48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "telegram.png")

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)