summaryrefslogtreecommitdiff
path: root/indra/cmake/WebRTC.cmake
blob: 1c32607766ffe05998c0e7345e7514ac1d028a4e (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
# -*- cmake -*-

include(FetchContent)

if (WINDOWS)
    if( ADDRESS_SIZE EQUAL 32 )
        FetchContent_Declare(
              webrtc
              URL "https://webrtc-build-releases.s3.us-west-2.amazonaws.com/webrtc.windows_x86.tar.bz2"
              URL_HASH "MD5=0d55e58efceed3fb48085a5f0c58881c"
              FIND_PACKAGE_ARGS NAMES webrtc
              DOWNLOAD_EXTRACT_TIMESTAMP TRUE
              DOWNLOAD_DIR "${LIBS_PREBUILT_DIR}/webrtc/"
            )
    else ( ADDRESS_SIZE EQUAL 32 )
        FetchContent_Declare(
              webrtc
              URL "https://webrtc-build-releases.s3.us-west-2.amazonaws.com/webrtc.windows_x86_64.tar.bz2"
              URL_HASH "MD5=dfb692562770dc8c877ebfe4302e2881"
              FIND_PACKAGE_ARGS NAMES webrtc
              DOWNLOAD_EXTRACT_TIMESTAMP TRUE
              DOWNLOAD_DIR "${LIBS_PREBUILT_DIR}/webrtc/"
            )
    endif ( ADDRESS_SIZE EQUAL 32 )
elseif (DARWIN)
    FetchContent_Declare(
      webrtc
      URL "https://webrtc-build-releases.s3.us-west-2.amazonaws.com/webrtc.macos_x86_64.tar.bz2"
      URL_HASH "MD5=cfbcac7da897a862f9791ea29330b814"
      FIND_PACKAGE_ARGS NAMES webrtc
      DOWNLOAD_EXTRACT_TIMESTAMP TRUE
      DOWNLOAD_DIR "${LIBS_PREBUILT_DIR}/webrtc/"
    )
endif (WINDOWS)

FetchContent_MakeAvailable(webrtc)

set(WEBRTC_PATH ${webrtc_SOURCE_DIR})

add_library( ll::webrtc INTERFACE IMPORTED )

if (WINDOWS)
    target_link_libraries( ll::webrtc INTERFACE "${WEBRTC_PATH}/lib/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
        "${WEBRTC_PATH}/lib/libwebrtc.a"
        ${COREAUDIO_LIBRARY}
        ${AUDIOTOOLBOX_LIBRARY}
        ${COREGRAPHICS_LIBRARY}
        ${COREFOUNDATION_LIBRARY}
        ${COCOA_LIBRARY}
    )
elseif (LINUX)
    target_link_libraries( ll::webrtc INTERFACE "${WEBRTC_PATH}/lib/libwebrtc.a" )
endif (WINDOWS)

message("PATH: ${WEBRTC_PATH}/include")
    
target_include_directories( ll::webrtc INTERFACE "${WEBRTC_PATH}/include" "${WEBRTC_PATH}/include/third_party/abseil-cpp")