Make building with X11 libraries optional.

Desktop capturing on Linux will be disabled in this case, but everything
can be built without any X11 development libraries installed.

BUG=webrtc:5716,webrtc:8319

Change-Id: I01bd6a4b02816b407be19476e22ff073d264b496
Reviewed-on: https://webrtc-review.googlesource.com/32360
Reviewed-by: Henrik Andreassson (OOO until Jan 2) <henrika@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Joachim Bauch <jbauch@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21462}
This commit is contained in:
Joachim Bauch 2017-12-20 21:25:47 +01:00 committed by Commit Bot
parent 6213929de5
commit 75f18fca8e
8 changed files with 29 additions and 16 deletions

View file

@ -17,7 +17,6 @@ group("modules") {
"audio_processing",
"bitrate_controller",
"congestion_controller",
"desktop_capture",
"media_file",
"pacing",
"remote_bitrate_estimator",
@ -26,6 +25,10 @@ group("modules") {
"video_coding",
"video_processing",
]
if (rtc_desktop_capture_supported) {
deps += [ "desktop_capture" ]
}
}
rtc_source_set("module_api_public") {
@ -83,13 +86,16 @@ if (rtc_include_tests) {
"../test:test_main",
"../test:video_test_common",
"audio_coding:audio_coding_modules_tests",
"desktop_capture:desktop_capture_modules_tests",
"rtp_rtcp:rtp_rtcp_modules_tests",
"video_coding:video_coding_modules_tests",
"//testing/gmock",
"//testing/gtest",
]
if (rtc_desktop_capture_supported) {
deps += [ "desktop_capture:desktop_capture_modules_tests" ]
}
data = modules_tests_resources
if (is_android) {
@ -253,7 +259,6 @@ if (rtc_include_tests) {
"audio_processing:audio_processing_unittests",
"bitrate_controller:bitrate_controller_unittests",
"congestion_controller:congestion_controller_unittests",
"desktop_capture:desktop_capture_unittests",
"media_file:media_file_unittests",
"pacing:pacing_unittests",
"remote_bitrate_estimator:remote_bitrate_estimator_unittests",
@ -264,6 +269,10 @@ if (rtc_include_tests) {
"video_processing:video_processing_unittests",
]
if (rtc_desktop_capture_supported) {
deps += [ "desktop_capture:desktop_capture_unittests" ]
}
data = modules_unittests_resources
if (is_android) {

View file

@ -195,8 +195,9 @@ rtc_source_set("audio_device_generic") {
]
defines += [ "LINUX_ALSA" ]
libs = [ "dl" ]
if (use_x11) {
if (rtc_use_x11) {
libs += [ "X11" ]
defines += [ "WEBRTC_USE_X11" ]
}
if (rtc_include_pulse_audio) {
sources += [

View file

@ -149,7 +149,7 @@ AudioDeviceGeneric::InitStatus AudioDeviceLinuxALSA::Init() {
if (_initialized) {
return InitStatus::OK;
}
#if defined(USE_X11)
#if defined(WEBRTC_USE_X11)
// Get X display handle for typing detection
_XDisplay = XOpenDisplay(NULL);
if (!_XDisplay) {
@ -193,7 +193,7 @@ int32_t AudioDeviceLinuxALSA::Terminate() {
_critSect.Enter();
}
#if defined(USE_X11)
#if defined(WEBRTC_USE_X11)
if (_XDisplay) {
XCloseDisplay(_XDisplay);
_XDisplay = NULL;
@ -1624,7 +1624,7 @@ bool AudioDeviceLinuxALSA::RecThreadProcess() {
}
bool AudioDeviceLinuxALSA::KeyPressed() const {
#if defined(USE_X11)
#if defined(WEBRTC_USE_X11)
char szKey[32];
unsigned int i = 0;
char state = 0;

View file

@ -18,7 +18,7 @@
#include "rtc_base/criticalsection.h"
#include "rtc_base/platform_thread.h"
#if defined(USE_X11)
#if defined(WEBRTC_USE_X11)
#include <X11/Xlib.h>
#endif
#include <alsa/asoundlib.h>
@ -192,7 +192,7 @@ private:
snd_pcm_sframes_t _playoutDelay;
char _oldKeyState[32];
#if defined(USE_X11)
#if defined(WEBRTC_USE_X11)
Display* _XDisplay;
#endif
};

View file

@ -296,7 +296,7 @@ rtc_static_library("desktop_capture_generic") {
"window_finder_win.h",
]
if (use_x11) {
if (rtc_use_x11) {
sources += [
"mouse_cursor_monitor_x11.cc",
"screen_capturer_x11.cc",
@ -317,7 +317,7 @@ rtc_static_library("desktop_capture_generic") {
configs += [ "//build/config/linux:x11" ]
}
if (!is_win && !is_mac && !use_x11) {
if (!is_win && !is_mac && !rtc_use_x11) {
sources += [
"mouse_cursor_monitor_null.cc",
"screen_capturer_null.cc",

View file

@ -717,7 +717,7 @@ rtc_static_library("rtc_base_generic") {
sources += [ "macifaddrs_converter.cc" ]
}
if (use_x11) {
if (rtc_use_x11) {
libs += [
"dl",
"rt",

View file

@ -685,17 +685,17 @@ rtc_source_set("test_renderer_generic") {
"../rtc_base:rtc_base_approved",
"//testing/gtest",
]
if (!(is_linux && use_x11) && !is_mac && !is_win) {
if (!(is_linux && rtc_use_x11) && !is_mac && !is_win) {
sources += [ "null_platform_renderer.cc" ]
}
if ((is_linux && use_x11) || is_mac) {
if ((is_linux && rtc_use_x11) || is_mac) {
sources += [
"gl/gl_renderer.cc",
"gl/gl_renderer.h",
]
}
if (is_linux && use_x11) {
if (is_linux && rtc_use_x11) {
sources += [
"linux/glx_renderer.cc",
"linux/glx_renderer.h",

View file

@ -83,6 +83,9 @@ declare_args() {
# Set this to false to skip building tools.
rtc_build_tools = true
# Set this to false to skip building code that requires X11.
rtc_use_x11 = use_x11
# Disable these to not build components which can be externally provided.
rtc_build_json = true
rtc_build_libsrtp = true
@ -201,7 +204,7 @@ rtc_libvpx_dir = "//third_party/libvpx"
rtc_opus_dir = "//third_party/opus"
# Desktop capturer is supported only on Windows, OSX and Linux.
rtc_desktop_capture_supported = is_win || is_mac || (is_linux && use_x11)
rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11)
###############################################################################
# Templates