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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -83,6 +83,9 @@ declare_args() {
# Set this to false to skip building tools. # Set this to false to skip building tools.
rtc_build_tools = true 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. # Disable these to not build components which can be externally provided.
rtc_build_json = true rtc_build_json = true
rtc_build_libsrtp = true rtc_build_libsrtp = true
@ -201,7 +204,7 @@ rtc_libvpx_dir = "//third_party/libvpx"
rtc_opus_dir = "//third_party/opus" rtc_opus_dir = "//third_party/opus"
# Desktop capturer is supported only on Windows, OSX and Linux. # 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 # Templates