GN: BUILD.gn for system_wrappers
Also cleaned up some unneeded stuff from webrtc/base/BUILD.gn
BUG=3441
TEST=
Successful compilation of WebRTC as standalone:
gn gen out/Default --args="build_with_chromium=false" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false is_clang=true clang_use_chrome_plugins=false" && ninja -C out/Default
I built successfully from a Chromium checkout (with
https://codereview.chromium.org/321313006/ applied) using:
gn gen out/Default && ninja -C out/Default webrtc
R=brettw@chromium.org
TBR=niklas.enbom@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/20739004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6515 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/BUILD.gn b/BUILD.gn
index a86c8a7..1182643 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -170,5 +170,6 @@
static_library("webrtc") {
deps = [
"base:webrtc_base",
+ "system_wrappers",
]
}
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 4118090..f8fb0bd 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -122,10 +122,7 @@
cflags = []
cflags_cc = []
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [
- "..:common_inherited_config",
"..:common_config",
":webrtc_base_config",
]
diff --git a/build/webrtc.gni b/build/webrtc.gni
index e269a26..409ae1d 100644
--- a/build/webrtc.gni
+++ b/build/webrtc.gni
@@ -28,6 +28,10 @@
# Selects fixed-point code where possible.
prefer_fixed_point = false
+ # Enable data logging. Produces text files with data logged within engines
+ # which can be easily parsed for offline processing.
+ enable_data_logging = false
+
build_libjpeg = true
# Enables the use of protocol buffers for debug recordings.
enable_protobuf = true
diff --git a/system_wrappers/BUILD.gn b/system_wrappers/BUILD.gn
new file mode 100644
index 0000000..4c6c605
--- /dev/null
+++ b/system_wrappers/BUILD.gn
@@ -0,0 +1,213 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../build/webrtc.gni")
+
+config("system_wrappers_inherited_config") {
+ include_dirs = [
+ "interface",
+ ]
+}
+
+static_library("system_wrappers") {
+ sources = [
+ "interface/aligned_malloc.h",
+ "interface/atomic32.h",
+ "interface/clock.h",
+ "interface/compile_assert.h",
+ "interface/condition_variable_wrapper.h",
+ "interface/cpu_info.h",
+ "interface/cpu_features_wrapper.h",
+ "interface/critical_section_wrapper.h",
+ "interface/data_log.h",
+ "interface/data_log_c.h",
+ "interface/data_log_impl.h",
+ "interface/event_tracer.h",
+ "interface/event_wrapper.h",
+ "interface/field_trial.h",
+ "interface/file_wrapper.h",
+ "interface/fix_interlocked_exchange_pointer_win.h",
+ "interface/logging.h",
+ "interface/ref_count.h",
+ "interface/rtp_to_ntp.h",
+ "interface/rw_lock_wrapper.h",
+ "interface/scoped_ptr.h",
+ "interface/scoped_refptr.h",
+ "interface/scoped_vector.h",
+ "interface/sleep.h",
+ "interface/sort.h",
+ "interface/static_instance.h",
+ "interface/stl_util.h",
+ "interface/stringize_macros.h",
+ "interface/thread_annotations.h",
+ "interface/thread_wrapper.h",
+ "interface/tick_util.h",
+ "interface/timestamp_extrapolator.h",
+ "interface/trace.h",
+ "interface/trace_event.h",
+ "interface/utf_util_win.h",
+ "source/aligned_malloc.cc",
+ "source/atomic32_mac.cc",
+ "source/atomic32_win.cc",
+ "source/clock.cc",
+ "source/condition_variable.cc",
+ "source/condition_variable_posix.cc",
+ "source/condition_variable_posix.h",
+ "source/condition_variable_event_win.cc",
+ "source/condition_variable_event_win.h",
+ "source/condition_variable_native_win.cc",
+ "source/condition_variable_native_win.h",
+ "source/cpu_info.cc",
+ "source/cpu_features.cc",
+ "source/critical_section.cc",
+ "source/critical_section_posix.cc",
+ "source/critical_section_posix.h",
+ "source/critical_section_win.cc",
+ "source/critical_section_win.h",
+ "source/data_log_c.cc",
+ "source/event.cc",
+ "source/event_posix.cc",
+ "source/event_posix.h",
+ "source/event_tracer.cc",
+ "source/event_win.cc",
+ "source/event_win.h",
+ "source/file_impl.cc",
+ "source/file_impl.h",
+ "source/logging.cc",
+ "source/rtp_to_ntp.cc",
+ "source/rw_lock.cc",
+ "source/rw_lock_generic.cc",
+ "source/rw_lock_generic.h",
+ "source/rw_lock_posix.cc",
+ "source/rw_lock_posix.h",
+ "source/rw_lock_win.cc",
+ "source/rw_lock_win.h",
+ "source/set_thread_name_win.h",
+ "source/sleep.cc",
+ "source/sort.cc",
+ "source/tick_util.cc",
+ "source/thread.cc",
+ "source/thread_posix.cc",
+ "source/thread_posix.h",
+ "source/thread_win.cc",
+ "source/thread_win.h",
+ "source/timestamp_extrapolator.cc",
+ "source/trace_impl.cc",
+ "source/trace_impl.h",
+ "source/trace_posix.cc",
+ "source/trace_posix.h",
+ "source/trace_win.cc",
+ "source/trace_win.h",
+ ]
+
+ configs += [ "..:common_config" ]
+
+ direct_dependent_configs = [
+ "..:common_inherited_config",
+ ":system_wrappers_inherited_config",
+ ]
+
+ if (enable_data_logging) {
+ sources += [ "source/data_log.cc" ]
+ } else {
+ sources += [ "source/data_log_no_op.cc" ]
+ }
+
+ defines = []
+ libs = []
+
+ if (is_android) {
+ sources += [
+ "interface/logcat_trace_context.h",
+ "source/logcat_trace_context.cc",
+ ]
+
+ defines += [
+ "WEBRTC_THREAD_RR",
+ # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
+ # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
+ # remove it after I verify that CLOCK_MONOTONIC is fully functional
+ # with condition and event functions in system_wrappers.
+ "WEBRTC_CLOCK_TYPE_REALTIME",
+ ]
+
+ deps = [ "cpu_features_android" ]
+
+ libs += [ "log" ]
+ }
+
+ if (is_linux) {
+ defines += [
+ "WEBRTC_THREAD_RR",
+ # TODO(andrew): can we select this automatically?
+ # Define this if the Linux system does not support CLOCK_MONOTONIC.
+ #"WEBRTC_CLOCK_TYPE_REALTIME",
+ ]
+
+ libs += [ "rt" ]
+ }
+
+ if (!is_mac && !is_ios) {
+ sources += [
+ "source/atomic32_posix.cc",
+ ]
+ }
+
+ if (is_ios || is_mac) {
+ defines += [
+ "WEBRTC_THREAD_RR",
+ "WEBRTC_CLOCK_TYPE_REALTIME",
+ ]
+ }
+
+ if (is_ios) {
+ sources += [
+ "source/atomic32_mac.cc",
+ ]
+ }
+
+ if (is_win) {
+ libs += [ "winmm.lib" ]
+
+ cflags = [
+ "/wd4267", # size_t to int truncation.
+ "/wd4334", # Ignore warning on shift operator promotion.
+ ]
+ }
+
+ include_dirs = [
+ "source/spreadsortlib",
+ ]
+
+ deps = [
+ "../base:webrtc_base",
+ ]
+}
+
+source_set("field_trial_default") {
+ sources = [
+ "source/field_trial_default.cc",
+ ]
+ deps = [
+ ":system_wrappers",
+ ]
+}
+
+if (is_android) {
+ source_set("cpu_features_android") {
+ sources = [
+ "source/cpu_features_android.c",
+ ]
+
+ if (is_android_webview_build) {
+ libs += [ "cpufeatures.a" ]
+ } else {
+ deps = [ "//third_party/android_tools:cpu_features" ]
+ }
+ }
+}