blob: eec4e2ce7a1a55b167c249cfe6effa8779ce135d (
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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# -*- cmake -*-
include(Linking)
include(Prebuilt)
include_guard()
add_library( ll::webrtc INTERFACE IMPORTED )
target_include_directories( ll::webrtc SYSTEM INTERFACE "${LIBS_PREBUILT_DIR}/include/webrtc" "${LIBS_PREBUILT_DIR}/include/webrtc/third_party/abseil-cpp")
if (${LINUX_DISTRO} MATCHES debian OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
use_prebuilt_binary(webrtc)
elseif (NOT (WINDOWS OR CMAKE_SYSTEM_NAME MATCHES FreeBSD))
target_compile_definitions(ll::webrtc INTERFACE CM_WEBRTC=1)
if (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/webrtc_installed OR NOT ${webrtc_installed} EQUAL 0)
if (DARWIN)
set(WEBRTC_PLATFORM macos-arm64)
else (DARWIN)
set(WEBRTC_PLATFORM linux-x64)
endif (DARWIN)
if (NOT EXISTS ${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz)
file(DOWNLOAD
https://github.com/crow-misia/libwebrtc-bin/releases/download/114.5735.6.1/libwebrtc-${WEBRTC_PLATFORM}.tar.xz
${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz
SHOW_PROGRESS
)
endif (NOT EXISTS ${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz)
file(ARCHIVE_EXTRACT
INPUT ${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz
DESTINATION ${LIBS_PREBUILT_DIR}
)
file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/include/webrtc)
file(MAKE_DIRECTORY ${LIBS_PREBUILT_DIR}/include/webrtc)
foreach(directory
api
audio
base
build
buildtools
call
common_audio
common_video
examples
logging
media
modules
net
p2p
pc
rtc_base
rtc_tools
sdk
stats
system_wrappers
test
testing
third_party
tools
video
)
file(RENAME
${LIBS_PREBUILT_DIR}/include/${directory}
${LIBS_PREBUILT_DIR}/include/webrtc/${directory}
)
endforeach()
file(RENAME
${LIBS_PREBUILT_DIR}/lib/libwebrtc.a
${LIBS_PREBUILT_DIR}/lib/release/libwebrtc.a
)
if (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/lib/release/WebRTC.framework)
file(RENAME
${LIBS_PREBUILT_DIR}/Frameworks/WebRTC.xcframework/${WEBRTC_PLATFORM}/WebRTC.framework
${LIBS_PREBUILT_DIR}/lib/release/WebRTC.framework
)
file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/Frameworks)
endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
file(WRITE ${PREBUILD_TRACKING_DIR}/webrtc_installed "0")
endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/webrtc_installed OR NOT ${webrtc_installed} EQUAL 0)
endif (${LINUX_DISTRO} MATCHES debian OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
if (WINDOWS)
target_link_libraries( ll::webrtc INTERFACE webrtc.lib )
elseif (DARWIN)
FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio)
FIND_LIBRARY(COREGRAPHICS_LIBRARY CoreGraphics)
FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY AudioToolbox)
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation)
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
target_link_libraries( ll::webrtc INTERFACE
libwebrtc.a
${COREAUDIO_LIBRARY}
${AUDIOTOOLBOX_LIBRARY}
${COREGRAPHICS_LIBRARY}
${COREFOUNDATION_LIBRARY}
${COCOA_LIBRARY}
)
elseif (LINUX)
target_link_libraries( ll::webrtc INTERFACE libwebrtc.a X11 )
endif (WINDOWS)
|