2019-11-21 11:56:17 +00:00
|
|
|
# This file is part of Telegram Desktop,
|
|
|
|
# the official desktop application for the Telegram messaging service.
|
|
|
|
#
|
|
|
|
# For license and copyright information please follow this link:
|
|
|
|
# https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
|
2020-08-07 09:01:06 +00:00
|
|
|
add_library(lib_tgvoip INTERFACE IMPORTED GLOBAL)
|
|
|
|
add_library(tdesktop::lib_tgvoip ALIAS lib_tgvoip)
|
2019-11-08 12:02:15 +00:00
|
|
|
|
2020-08-07 09:01:06 +00:00
|
|
|
if (DESKTOP_APP_USE_PACKAGED)
|
2020-01-03 04:41:48 +00:00
|
|
|
find_package(PkgConfig REQUIRED)
|
2020-08-07 09:01:06 +00:00
|
|
|
pkg_check_modules(TGVOIP IMPORTED_TARGET tgvoip)
|
2019-12-06 11:10:44 +00:00
|
|
|
|
2020-08-07 09:01:06 +00:00
|
|
|
if (TGVOIP_FOUND)
|
|
|
|
target_link_libraries(lib_tgvoip INTERFACE PkgConfig::TGVOIP)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT TGVOIP_FOUND)
|
|
|
|
add_library(lib_tgvoip_bundled STATIC)
|
2020-08-11 09:59:48 +00:00
|
|
|
|
2020-08-20 12:45:54 +00:00
|
|
|
if (WIN32)
|
|
|
|
init_target(lib_tgvoip_bundled cxx_std_17) # Small amount of patches required here.
|
|
|
|
elseif (LINUX)
|
2020-08-07 09:01:06 +00:00
|
|
|
init_target(lib_tgvoip_bundled) # All C++20 on Linux, because otherwise ODR violation.
|
2020-08-11 09:59:48 +00:00
|
|
|
else()
|
2020-08-20 12:45:54 +00:00
|
|
|
init_target(lib_tgvoip_bundled cxx_std_14) # Can't use std::optional::value on macOS.
|
2020-08-11 09:59:48 +00:00
|
|
|
endif()
|
|
|
|
|
2021-03-20 03:09:03 +00:00
|
|
|
option(LIBTGVOIP_DISABLE_ALSA "Disable libtgvoip's ALSA backend (Linux only)." OFF)
|
|
|
|
option(LIBTGVOIP_DISABLE_PULSEAUDIO "Disable libtgvoip's PulseAudio backend (Linux only)." OFF)
|
|
|
|
|
2020-01-03 04:41:48 +00:00
|
|
|
set(tgvoip_loc ${third_party_loc}/libtgvoip)
|
2019-11-08 12:02:15 +00:00
|
|
|
|
2020-08-07 09:01:06 +00:00
|
|
|
nice_target_sources(lib_tgvoip_bundled ${tgvoip_loc}
|
2020-01-03 04:41:48 +00:00
|
|
|
PRIVATE
|
|
|
|
BlockingQueue.cpp
|
|
|
|
BlockingQueue.h
|
|
|
|
Buffers.cpp
|
|
|
|
Buffers.h
|
|
|
|
CongestionControl.cpp
|
|
|
|
CongestionControl.h
|
|
|
|
EchoCanceller.cpp
|
|
|
|
EchoCanceller.h
|
|
|
|
JitterBuffer.cpp
|
|
|
|
JitterBuffer.h
|
|
|
|
logging.cpp
|
|
|
|
logging.h
|
|
|
|
MediaStreamItf.cpp
|
|
|
|
MediaStreamItf.h
|
|
|
|
OpusDecoder.cpp
|
|
|
|
OpusDecoder.h
|
|
|
|
OpusEncoder.cpp
|
|
|
|
OpusEncoder.h
|
|
|
|
threading.h
|
|
|
|
VoIPController.cpp
|
|
|
|
VoIPGroupController.cpp
|
|
|
|
VoIPController.h
|
|
|
|
PrivateDefines.h
|
|
|
|
VoIPServerConfig.cpp
|
|
|
|
VoIPServerConfig.h
|
|
|
|
audio/AudioInput.cpp
|
|
|
|
audio/AudioInput.h
|
|
|
|
audio/AudioOutput.cpp
|
|
|
|
audio/AudioOutput.h
|
|
|
|
audio/Resampler.cpp
|
|
|
|
audio/Resampler.h
|
|
|
|
NetworkSocket.cpp
|
|
|
|
NetworkSocket.h
|
|
|
|
PacketReassembler.cpp
|
|
|
|
PacketReassembler.h
|
|
|
|
MessageThread.cpp
|
|
|
|
MessageThread.h
|
|
|
|
audio/AudioIO.cpp
|
|
|
|
audio/AudioIO.h
|
|
|
|
video/ScreamCongestionController.cpp
|
|
|
|
video/ScreamCongestionController.h
|
|
|
|
video/VideoSource.cpp
|
|
|
|
video/VideoSource.h
|
|
|
|
video/VideoRenderer.cpp
|
|
|
|
video/VideoRenderer.h
|
|
|
|
json11.cpp
|
|
|
|
json11.hpp
|
2019-11-08 12:02:15 +00:00
|
|
|
|
2020-01-03 04:41:48 +00:00
|
|
|
# Windows
|
|
|
|
os/windows/NetworkSocketWinsock.cpp
|
|
|
|
os/windows/NetworkSocketWinsock.h
|
|
|
|
os/windows/AudioInputWave.cpp
|
|
|
|
os/windows/AudioInputWave.h
|
|
|
|
os/windows/AudioOutputWave.cpp
|
|
|
|
os/windows/AudioOutputWave.h
|
|
|
|
os/windows/AudioOutputWASAPI.cpp
|
|
|
|
os/windows/AudioOutputWASAPI.h
|
|
|
|
os/windows/AudioInputWASAPI.cpp
|
|
|
|
os/windows/AudioInputWASAPI.h
|
2020-05-09 18:07:18 +00:00
|
|
|
os/windows/MinGWSupport.h
|
2020-01-03 04:41:48 +00:00
|
|
|
os/windows/WindowsSpecific.cpp
|
|
|
|
os/windows/WindowsSpecific.h
|
2019-11-08 12:02:15 +00:00
|
|
|
|
2020-01-03 04:41:48 +00:00
|
|
|
# macOS
|
|
|
|
os/darwin/AudioInputAudioUnit.cpp
|
|
|
|
os/darwin/AudioInputAudioUnit.h
|
|
|
|
os/darwin/AudioOutputAudioUnit.cpp
|
|
|
|
os/darwin/AudioOutputAudioUnit.h
|
|
|
|
os/darwin/AudioInputAudioUnitOSX.cpp
|
|
|
|
os/darwin/AudioInputAudioUnitOSX.h
|
|
|
|
os/darwin/AudioOutputAudioUnitOSX.cpp
|
|
|
|
os/darwin/AudioOutputAudioUnitOSX.h
|
|
|
|
os/darwin/AudioUnitIO.cpp
|
|
|
|
os/darwin/AudioUnitIO.h
|
|
|
|
os/darwin/DarwinSpecific.mm
|
|
|
|
os/darwin/DarwinSpecific.h
|
2019-11-08 12:02:15 +00:00
|
|
|
|
2020-01-03 04:41:48 +00:00
|
|
|
# Linux
|
|
|
|
os/linux/AudioInputALSA.cpp
|
|
|
|
os/linux/AudioInputALSA.h
|
|
|
|
os/linux/AudioOutputALSA.cpp
|
|
|
|
os/linux/AudioOutputALSA.h
|
|
|
|
os/linux/AudioOutputPulse.cpp
|
|
|
|
os/linux/AudioOutputPulse.h
|
|
|
|
os/linux/AudioInputPulse.cpp
|
|
|
|
os/linux/AudioInputPulse.h
|
|
|
|
os/linux/AudioPulse.cpp
|
|
|
|
os/linux/AudioPulse.h
|
2019-11-08 12:02:15 +00:00
|
|
|
|
2020-01-03 04:41:48 +00:00
|
|
|
# POSIX
|
|
|
|
os/posix/NetworkSocketPosix.cpp
|
|
|
|
os/posix/NetworkSocketPosix.h
|
2020-05-09 18:07:18 +00:00
|
|
|
)
|
2019-11-08 12:02:15 +00:00
|
|
|
|
2020-08-07 09:01:06 +00:00
|
|
|
target_compile_definitions(lib_tgvoip_bundled
|
2020-08-11 13:31:27 +00:00
|
|
|
PRIVATE
|
2020-01-03 04:41:48 +00:00
|
|
|
TGVOIP_USE_DESKTOP_DSP
|
2019-11-21 11:56:17 +00:00
|
|
|
)
|
2020-01-03 04:41:48 +00:00
|
|
|
|
|
|
|
if (WIN32)
|
2020-05-09 18:07:18 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
2020-08-07 09:01:06 +00:00
|
|
|
target_compile_options(lib_tgvoip_bundled
|
2020-05-09 18:07:18 +00:00
|
|
|
PRIVATE
|
|
|
|
/wd4005
|
|
|
|
/wd4244 # conversion from 'int' to 'float', possible loss of data (several in webrtc)
|
|
|
|
/wd5055 # operator '>' deprecated between enumerations and floating-point types
|
|
|
|
)
|
|
|
|
else()
|
2020-08-07 09:01:06 +00:00
|
|
|
target_compile_definitions(lib_tgvoip_bundled
|
2020-05-09 18:07:18 +00:00
|
|
|
PUBLIC
|
|
|
|
# Doesn't build with mingw for now
|
|
|
|
TGVOIP_NO_DSP
|
|
|
|
)
|
|
|
|
endif()
|
2020-01-03 04:41:48 +00:00
|
|
|
elseif (APPLE)
|
2020-08-07 09:01:06 +00:00
|
|
|
target_compile_definitions(lib_tgvoip_bundled
|
2020-01-03 04:41:48 +00:00
|
|
|
PUBLIC
|
|
|
|
TARGET_OS_OSX
|
|
|
|
TARGET_OSX
|
|
|
|
)
|
|
|
|
if (build_macstore)
|
2020-08-07 09:01:06 +00:00
|
|
|
target_compile_definitions(lib_tgvoip_bundled
|
2020-01-03 04:41:48 +00:00
|
|
|
PUBLIC
|
|
|
|
TGVOIP_NO_OSX_PRIVATE_API
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
else()
|
2021-07-13 17:51:07 +00:00
|
|
|
add_library(lib_tgvoip_bundled_options INTERFACE)
|
|
|
|
target_compile_options(lib_tgvoip_bundled_options
|
|
|
|
INTERFACE
|
|
|
|
-Wno-unused-variable
|
2020-01-03 04:41:48 +00:00
|
|
|
-Wno-unknown-pragmas
|
|
|
|
-Wno-error=sequence-point
|
|
|
|
-Wno-error=unused-result
|
|
|
|
)
|
2021-08-11 02:27:26 +00:00
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")
|
2021-07-13 17:51:07 +00:00
|
|
|
target_compile_options(lib_tgvoip_bundled_options INTERFACE -msse2)
|
2020-01-03 04:41:48 +00:00
|
|
|
endif()
|
2021-07-13 17:51:07 +00:00
|
|
|
target_link_libraries(lib_tgvoip_bundled
|
|
|
|
PRIVATE
|
|
|
|
lib_tgvoip_bundled_options
|
|
|
|
)
|
2019-11-21 11:56:17 +00:00
|
|
|
endif()
|
2020-01-03 04:41:48 +00:00
|
|
|
|
2020-08-07 09:01:06 +00:00
|
|
|
target_include_directories(lib_tgvoip_bundled
|
2019-12-03 16:11:03 +00:00
|
|
|
PUBLIC
|
2020-01-03 04:41:48 +00:00
|
|
|
${tgvoip_loc}
|
2019-11-21 11:56:17 +00:00
|
|
|
)
|
2020-08-07 09:01:06 +00:00
|
|
|
target_link_libraries(lib_tgvoip_bundled
|
2020-01-03 04:41:48 +00:00
|
|
|
PRIVATE
|
2021-02-03 12:23:23 +00:00
|
|
|
desktop-app::external_webrtc
|
2020-05-18 14:24:20 +00:00
|
|
|
desktop-app::external_opus
|
2020-01-03 04:41:48 +00:00
|
|
|
)
|
2020-05-02 05:57:37 +00:00
|
|
|
|
|
|
|
if (LINUX)
|
2021-03-20 03:09:03 +00:00
|
|
|
if (NOT LIBTGVOIP_DISABLE_ALSA)
|
|
|
|
find_package(ALSA REQUIRED)
|
2021-07-13 22:16:16 +00:00
|
|
|
target_include_directories(lib_tgvoip_bundled SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS})
|
2021-03-20 03:09:03 +00:00
|
|
|
else()
|
|
|
|
remove_target_sources(lib_tgvoip_bundled ${tgvoip_loc}
|
|
|
|
os/linux/AudioInputALSA.cpp
|
|
|
|
os/linux/AudioInputALSA.h
|
|
|
|
os/linux/AudioOutputALSA.cpp
|
|
|
|
os/linux/AudioOutputALSA.h
|
|
|
|
)
|
2020-06-27 19:56:05 +00:00
|
|
|
|
2021-03-20 03:09:03 +00:00
|
|
|
target_compile_definitions(lib_tgvoip_bundled PRIVATE WITHOUT_ALSA)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT LIBTGVOIP_DISABLE_PULSEAUDIO)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(PULSE REQUIRED libpulse)
|
2021-07-13 22:16:16 +00:00
|
|
|
target_include_directories(lib_tgvoip_bundled SYSTEM PRIVATE ${PULSE_INCLUDE_DIRS})
|
2021-03-20 03:09:03 +00:00
|
|
|
else()
|
|
|
|
remove_target_sources(lib_tgvoip_bundled ${tgvoip_loc}
|
|
|
|
os/linux/AudioOutputPulse.cpp
|
|
|
|
os/linux/AudioOutputPulse.h
|
|
|
|
os/linux/AudioInputPulse.cpp
|
|
|
|
os/linux/AudioInputPulse.h
|
|
|
|
os/linux/AudioPulse.cpp
|
|
|
|
os/linux/AudioPulse.h
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(lib_tgvoip_bundled PRIVATE WITHOUT_PULSE)
|
|
|
|
endif()
|
2020-06-27 19:56:05 +00:00
|
|
|
|
2020-08-07 09:01:06 +00:00
|
|
|
target_link_libraries(lib_tgvoip_bundled
|
2020-05-02 05:57:37 +00:00
|
|
|
PRIVATE
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
pthread
|
|
|
|
)
|
|
|
|
endif()
|
2020-08-07 09:01:06 +00:00
|
|
|
|
|
|
|
target_link_libraries(lib_tgvoip
|
|
|
|
INTERFACE
|
|
|
|
lib_tgvoip_bundled
|
|
|
|
)
|
2019-12-09 06:36:37 +00:00
|
|
|
endif()
|