aboutsummaryrefslogtreecommitdiffstats
path: root/testing/telegram-desktop/ThirdParty-libtgvoip.cmake
blob: 1b006d0dee50ba0629dea4b2f1c16274ac2463cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
project(tgvoip)

option(ENABLE_PULSEAUDIO "Enable pulseaudio" OFF)

add_subdirectory("${PROJECT_SOURCE_DIR}/webrtc_dsp")

find_package(PkgConfig REQUIRED)
pkg_check_modules(OPUS REQUIRED opus)

file(GLOB TGVOIP_SOURCE_FILES
	*.cpp
	audio/*.cpp
	os/linux/*.cpp
	os/posix/*.cpp
	video/*.cpp
)
set(TGVOIP_COMPILE_DEFINITIONS TGVOIP_USE_DESKTOP_DSP WEBRTC_NS_FLOAT WEBRTC_POSIX WEBRTC_LINUX)

if(ENABLE_PULSEAUDIO)
	pkg_check_modules(LIBPULSE REQUIRED libpulse)
else()
	file(GLOB PULSEAUDIO_SOURCE_FILES
		os/linux/*Pulse.cpp
		os/linux/*Pulse.h
	)
	list(REMOVE_ITEM TGVOIP_SOURCE_FILES ${PULSEAUDIO_SOURCE_FILES})
	list(APPEND TGVOIP_COMPILE_DEFINITIONS WITHOUT_PULSE)
endif()

add_library(${PROJECT_NAME} STATIC ${TGVOIP_SOURCE_FILES} $<TARGET_OBJECTS:webrtc>)

target_compile_definitions(${PROJECT_NAME} PUBLIC ${TGVOIP_COMPILE_DEFINITIONS})
target_include_directories(${PROJECT_NAME} PUBLIC
	"${OPUS_INCLUDE_DIRS}"
	"${CMAKE_CURRENT_LIST_DIR}/webrtc_dsp"
)
target_link_libraries(${PROJECT_NAME} dl ${OPUS_LIBRARIES})