Fix packaged conditions in lib_ffmpeg and Packer

This commit is contained in:
Ilya Fedin 2025-06-01 06:29:08 +00:00 committed by John Preston
parent ecf1fa2bbd
commit 7e418a16ae
5 changed files with 17 additions and 9 deletions

View file

@ -1989,6 +1989,10 @@ if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_wins
desktop-app::external_openssl
)
if (DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(Packer PRIVATE PACKER_USE_PACKAGED)
endif()
set_target_properties(Packer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder})
endif()
elseif (build_winstore)

View file

@ -283,7 +283,7 @@ int main(int argc, char *argv[])
cout << "Compression start, size: " << resultSize << "\n";
QByteArray compressed, resultCheck;
#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win
#if defined Q_OS_WIN && !defined PACKER_USE_PACKAGED // use Lzma SDK for win
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size

View file

@ -27,7 +27,7 @@ extern "C" {
#include <openssl/evp.h>
} // extern "C"
#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win
#if defined Q_OS_WIN && !defined PACKER_USE_PACKAGED // use Lzma SDK for win
#include <LzmaLib.h>
#else
#include <lzma.h>

View file

@ -10,10 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/algorithm.h"
#include "logs.h"
#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
#ifdef LIB_FFMPEG_USE_IMPLIB
#include "base/platform/linux/base_linux_library.h"
#include <deque>
#endif // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
#endif // LIB_FFMPEG_USE_IMPLIB
#include <QImage>
@ -91,7 +91,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
#endif // LIB_FFMPEG_USE_QT_PRIVATE_API
}
#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
#ifdef LIB_FFMPEG_USE_IMPLIB
[[nodiscard]] auto CheckHwLibs() {
auto list = std::deque{
AV_PIX_FMT_CUDA,
@ -117,7 +117,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
}
return list;
}
#endif // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
#endif // LIB_FFMPEG_USE_IMPLIB
[[nodiscard]] bool InitHw(AVCodecContext *context, AVHWDeviceType type) {
AVCodecContext *parent = static_cast<AVCodecContext*>(context->opaque);
@ -160,9 +160,9 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
}
return false;
};
#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC
#ifdef LIB_FFMPEG_USE_IMPLIB
static const auto list = CheckHwLibs();
#else // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC
#else // LIB_FFMPEG_USE_IMPLIB
const auto list = std::array{
#ifdef Q_OS_WIN
AV_PIX_FMT_D3D11,
@ -176,7 +176,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
AV_PIX_FMT_CUDA,
#endif // Q_OS_WIN || Q_OS_MAC
};
#endif // TDESKTOP_USE_PACKAGED || Q_OS_WIN || Q_OS_MAC
#endif // LIB_FFMPEG_USE_IMPLIB
for (const auto format : list) {
if (!has(format)) {
continue;

View file

@ -29,6 +29,10 @@ PUBLIC
desktop-app::external_ffmpeg
)
if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(lib_ffmpeg PRIVATE LIB_FFMPEG_USE_IMPLIB)
endif()
if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_definitions(lib_ffmpeg PRIVATE LIB_FFMPEG_USE_QT_PRIVATE_API)
endif()