summaryrefslogtreecommitdiff
path: root/indra/cmake/WebRTC.cmake
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-09-16 16:38:28 +0800
committerErik Kundiman <erik@megapahit.org>2024-09-16 16:38:28 +0800
commit16ecc9d734341618299327c7699168274341a864 (patch)
tree1fcfc018867ca6f96b4e52321cfdae8ad8272278 /indra/cmake/WebRTC.cmake
parentb282315fa1429a5b9872cfa773745f7ad65c1e19 (diff)
WebRTC on Fedora & openSUSE without breaking CEF
Thanks to the Linux x86-64 WebRTC binary from Zenichi Amano (crow-misia). https://megapahit.com/show_bug.cgi?id=64 Haven't been tested on openSUSE, but it should work.
Diffstat (limited to 'indra/cmake/WebRTC.cmake')
-rw-r--r--indra/cmake/WebRTC.cmake34
1 files changed, 21 insertions, 13 deletions
diff --git a/indra/cmake/WebRTC.cmake b/indra/cmake/WebRTC.cmake
index 92d9d135c6..be51957794 100644
--- a/indra/cmake/WebRTC.cmake
+++ b/indra/cmake/WebRTC.cmake
@@ -6,17 +6,23 @@ 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 (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+if (CMAKE_OSX_ARCHITECTURES MATCHES arm64 OR (${LINUX_DISTRO} MATCHES fedora) OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed))
+ 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 (NOT EXISTS ${CMAKE_BINARY_DIR}/libwebrtc-macos-arm64.tar.xz)
+ if (LINUX)
+ set(WEBRTC_PLATFORM linux-x64)
+ else (LINUX)
+ set(WEBRTC_PLATFORM macos-arm64)
+ endif (LINUX)
+ 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-macos-arm64.tar.xz
- ${CMAKE_BINARY_DIR}/libwebrtc-macos-arm64.tar.xz
+ 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-macos-arm64.tar.xz)
+ endif (NOT EXISTS ${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz)
file(ARCHIVE_EXTRACT
- INPUT ${CMAKE_BINARY_DIR}/libwebrtc-macos-arm64.tar.xz
+ INPUT ${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz
DESTINATION ${LIBS_PREBUILT_DIR}
)
file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/include/webrtc)
@@ -57,17 +63,19 @@ if (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
${LIBS_PREBUILT_DIR}/lib/libwebrtc.a
${LIBS_PREBUILT_DIR}/lib/release/libwebrtc.a
)
- file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/lib/release/WebRTC.framework)
- file(RENAME
- ${LIBS_PREBUILT_DIR}/Frameworks/WebRTC.xcframework/macos-arm64/WebRTC.framework
- ${LIBS_PREBUILT_DIR}/lib/release/WebRTC.framework
- )
- file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/Frameworks)
+ 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)
elseif (NOT CMAKE_SYSTEM_NAME MATCHES FreeBSD)
use_prebuilt_binary(webrtc)
-endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64 OR (${LINUX_DISTRO} MATCHES fedora) OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed))
if (WINDOWS)
target_link_libraries( ll::webrtc INTERFACE webrtc.lib )