Add support for DESKTOP_APP_USE_PACKAGED on macOS

This commit is contained in:
Ilya Fedin 2020-04-01 02:04:33 +04:00 committed by John Preston
parent b19dcf0653
commit fa4236e9ea
5 changed files with 37 additions and 20 deletions

View File

@ -796,7 +796,6 @@ PRIVATE
platform/mac/file_utilities_mac.h
platform/mac/launcher_mac.mm
platform/mac/launcher_mac.h
platform/mac/mac_iconv_helper.c
platform/mac/main_window_mac.mm
platform/mac/main_window_mac.h
platform/mac/notifications_manager_mac.mm
@ -1034,6 +1033,8 @@ PRIVATE
if (DESKTOP_APP_USE_PACKAGED)
nice_target_sources(Telegram ${src_loc} PRIVATE qt_functions.cpp)
else()
nice_target_sources(Telegram ${src_loc} PRIVATE platform/mac/mac_iconv_helper.c)
endif()
nice_target_sources(Telegram ${res_loc}
@ -1069,11 +1070,11 @@ if (WIN32)
# $<IF:${release},"Appending compatibility manifest.","Finalizing build.">
# )
elseif (APPLE)
target_link_libraries(Telegram
PRIVATE
desktop-app::external_sp_media_key_tap
desktop-app::external_iconv
)
target_link_libraries(Telegram PRIVATE desktop-app::external_sp_media_key_tap)
if (NOT DESKTOP_APP_USE_PACKAGED)
target_link_libraries(Telegram PRIVATE desktop-app::external_iconv)
endif()
set(icons_path ${CMAKE_CURRENT_SOURCE_DIR}/Telegram/Images.xcassets)
set_target_properties(Telegram PROPERTIES RESOURCE ${icons_path})

View File

@ -21,9 +21,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#include <al.h>
#include <alc.h>
#ifndef TDESKTOP_DISABLE_OPENAL_EFFECTS
#include <alext.h>
#endif // !TDESKTOP_DISABLE_OPENAL_EFFECTS
#include <numeric>
@ -82,7 +84,13 @@ bool PlaybackErrorHappened() {
void EnumeratePlaybackDevices() {
auto deviceNames = QStringList();
auto devices = alcGetString(nullptr, ALC_ALL_DEVICES_SPECIFIER);
auto devices = [&] {
if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATE_ALL_EXT")) {
return alcGetString(nullptr, alcGetEnumValue(nullptr, "ALC_ALL_DEVICES_SPECIFIER"));
} else {
return alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
}
}();
Assert(devices != nullptr);
while (*devices != 0) {
auto deviceName8Bit = QByteArray(devices);
@ -92,7 +100,14 @@ void EnumeratePlaybackDevices() {
}
LOG(("Audio Playback Devices: %1").arg(deviceNames.join(';')));
if (auto device = alcGetString(nullptr, ALC_DEFAULT_ALL_DEVICES_SPECIFIER)) {
auto device = [&] {
if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATE_ALL_EXT")) {
return alcGetString(nullptr, alcGetEnumValue(nullptr, "ALC_DEFAULT_ALL_DEVICES_SPECIFIER"));
} else {
return alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER);
}
}();
if (device) {
LOG(("Audio Playback Default Device: %1").arg(QString::fromUtf8(device)));
} else {
LOG(("Audio Playback Default Device: (null)"));
@ -1498,8 +1513,11 @@ bool audioDeviceIsConnected() {
if (!AudioDevice) {
return false;
}
auto isConnected = ALint(0);
alcGetIntegerv(AudioDevice, ALC_CONNECTED, 1, &isConnected);
// always connected in the basic OpenAL, disconnect status is an extension
auto isConnected = ALint(1);
if (alcIsExtensionPresent(nullptr, "ALC_EXT_disconnect")) {
alcGetIntegerv(AudioDevice, alcGetEnumValue(nullptr, "ALC_CONNECTED"), 1, &isConnected);
}
if (Audio::ContextErrorHappened()) {
return false;
}

View File

@ -9,9 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/audio/media_audio_ffmpeg_loader.h"
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#include <al.h>
#include <alc.h>
#include <numeric>

View File

@ -18,7 +18,7 @@ extern "C" {
#include <libswresample/swresample.h>
} // extern "C"
#include <AL/al.h>
#include <al.h>
namespace Media {

View File

@ -11,9 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/audio/media_audio.h"
#include "core/application.h"
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#include <al.h>
#include <alc.h>
namespace Media {
namespace Audio {