-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
81 lines (71 loc) · 2.42 KB
/
CMakeLists.txt
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# PytgVoIP - Telegram VoIP Library for Python
# Copyright (C) 2020 bakatrouble <https://github.com/bakatrouble>
#
# This file is part of PytgVoIP.
#
# PytgVoIP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PytgVoIP is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PytgVoIP. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.13)
project(pylibtgvoip)
set(CMAKE_CXX_STANDARD 14)
cmake_policy(SET CMP0028 NEW)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src")
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
if(APPLE)
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl/)
endif()
add_definitions(
-DTGVOIP_USE_CALLBACK_AUDIO_IO
-DWITHOUT_ALSA
-DWITHOUT_PULSE
)
add_subdirectory(3rdparty/pybind11)
include_directories(${TGVOIP_INCLUDE_DIR})
if(WIN32)
get_filename_component(libs_loc .. REALPATH)
else()
set(DESKTOP_APP_USE_PACKAGED TRUE)
endif()
include(cmake/nice_target_sources.cmake)
include(cmake/target_link_frameworks.cmake)
include(cmake/target_link_static_libraries.cmake)
include(cmake/init_target.cmake)
include(cmake/options.cmake)
add_subdirectory(cmake/external/openssl)
add_subdirectory(cmake/external/opus)
get_filename_component(third_party_loc 3rdparty REALPATH)
include(src/libtgvoip.cmake)
nice_target_sources(lib_tgvoip ${tgvoip_loc}
PRIVATE
audio/AudioIOCallback.cpp
audio/AudioIOCallback.h
)
list(APPEND SOURCES
src/_tgvoip.cpp
src/_tgvoip_module.cpp
)
pybind11_add_module(_tgvoip ${SOURCES})
target_link_libraries(_tgvoip PRIVATE lib_tgvoip)
if ((CMAKE_CXX_COMPILER_ID STREQUAL GNU) AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9))
target_compile_options(_tgvoip PRIVATE
-Wno-error=deprecated-copy
)
endif()
if (WIN32)
target_compile_options(lib_tgvoip PRIVATE /wd4477 /wd4267)
endif()
# macOS and its weird paths
target_include_directories(lib_tgvoip PRIVATE /usr/local/include)
target_link_directories(_tgvoip PRIVATE /usr/local/lib)