mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Merge cpu_features build targets into //system_wrappers.
Before this CL, functions declared in cpu_features_wrapper.h where not defined in the same build target, causing brittle builds that might fail at link time if the binary was not depending on //system_wrappers (the target with the definitions), violating [1]. This CL moves everything into //system_wrappers and also moves cpu_features_wrapper.h definitions from C to C++ (in order to be able to add the definitions to a C++ build target like //system_wrappers). [1] - https://webrtc.googlesource.com/src/+/refs/heads/master/style-guide.md#h-cc-pairs Bug: None Change-Id: I5a0009cddb17206b19f2a71eeba722faacc4bcae Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183380 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32039}
This commit is contained in:
parent
7f557b46c4
commit
2b242d8fba
16 changed files with 24 additions and 58 deletions
|
@ -54,7 +54,6 @@ rtc_library("common_audio") {
|
||||||
"../rtc_base/system:arch",
|
"../rtc_base/system:arch",
|
||||||
"../rtc_base/system:file_wrapper",
|
"../rtc_base/system:file_wrapper",
|
||||||
"../system_wrappers",
|
"../system_wrappers",
|
||||||
"../system_wrappers:cpu_features_api",
|
|
||||||
"third_party/ooura:fft_size_256",
|
"third_party/ooura:fft_size_256",
|
||||||
]
|
]
|
||||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||||
|
@ -185,7 +184,6 @@ rtc_library("common_audio_c") {
|
||||||
"../rtc_base:sanitizer",
|
"../rtc_base:sanitizer",
|
||||||
"../rtc_base/system:arch",
|
"../rtc_base/system:arch",
|
||||||
"../system_wrappers",
|
"../system_wrappers",
|
||||||
"../system_wrappers:cpu_features_api",
|
|
||||||
"third_party/ooura:fft_size_256",
|
"third_party/ooura:fft_size_256",
|
||||||
"third_party/spl_sqrt_floor",
|
"third_party/spl_sqrt_floor",
|
||||||
]
|
]
|
||||||
|
@ -232,7 +230,7 @@ rtc_library("fir_filter_factory") {
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
"../rtc_base:rtc_base_approved",
|
"../rtc_base:rtc_base_approved",
|
||||||
"../rtc_base/system:arch",
|
"../rtc_base/system:arch",
|
||||||
"../system_wrappers:cpu_features_api",
|
"../system_wrappers",
|
||||||
]
|
]
|
||||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||||
deps += [ ":common_audio_sse2" ]
|
deps += [ ":common_audio_sse2" ]
|
||||||
|
@ -383,7 +381,7 @@ if (rtc_include_tests) {
|
||||||
"../rtc_base:rtc_base_approved",
|
"../rtc_base:rtc_base_approved",
|
||||||
"../rtc_base:rtc_base_tests_utils",
|
"../rtc_base:rtc_base_tests_utils",
|
||||||
"../rtc_base/system:arch",
|
"../rtc_base/system:arch",
|
||||||
"../system_wrappers:cpu_features_api",
|
"../system_wrappers",
|
||||||
"../test:fileutils",
|
"../test:fileutils",
|
||||||
"../test:rtc_expect_death",
|
"../test:rtc_expect_death",
|
||||||
"../test:test_main",
|
"../test:test_main",
|
||||||
|
|
2
common_audio/third_party/ooura/BUILD.gn
vendored
2
common_audio/third_party/ooura/BUILD.gn
vendored
|
@ -16,7 +16,7 @@ rtc_library("fft_size_128") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"../../../rtc_base/system:arch",
|
"../../../rtc_base/system:arch",
|
||||||
"../../../system_wrappers:cpu_features_api",
|
"../../../system_wrappers",
|
||||||
]
|
]
|
||||||
cflags = []
|
cflags = []
|
||||||
|
|
||||||
|
|
|
@ -609,7 +609,7 @@ rtc_library("isac_fix_c") {
|
||||||
"../../rtc_base:compile_assert_c",
|
"../../rtc_base:compile_assert_c",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base:sanitizer",
|
"../../rtc_base:sanitizer",
|
||||||
"../../system_wrappers:cpu_features_api",
|
"../../system_wrappers",
|
||||||
"../third_party/fft",
|
"../third_party/fft",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2067,7 +2067,6 @@ if (rtc_include_tests) {
|
||||||
"../../rtc_base/synchronization:mutex",
|
"../../rtc_base/synchronization:mutex",
|
||||||
"../../rtc_base/system:arch",
|
"../../rtc_base/system:arch",
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
"../../system_wrappers:cpu_features_api",
|
|
||||||
"../../test:audio_codec_mocks",
|
"../../test:audio_codec_mocks",
|
||||||
"../../test:field_trial",
|
"../../test:field_trial",
|
||||||
"../../test:fileutils",
|
"../../test:fileutils",
|
||||||
|
|
|
@ -189,7 +189,7 @@ rtc_library("audio_processing") {
|
||||||
"../../rtc_base:sanitizer",
|
"../../rtc_base:sanitizer",
|
||||||
"../../rtc_base/synchronization:mutex",
|
"../../rtc_base/synchronization:mutex",
|
||||||
"../../rtc_base/system:rtc_export",
|
"../../rtc_base/system:rtc_export",
|
||||||
"../../system_wrappers:cpu_features_api",
|
"../../system_wrappers",
|
||||||
"../../system_wrappers:field_trial",
|
"../../system_wrappers:field_trial",
|
||||||
"../../system_wrappers:metrics",
|
"../../system_wrappers:metrics",
|
||||||
"aec3",
|
"aec3",
|
||||||
|
@ -375,7 +375,6 @@ if (rtc_include_tests) {
|
||||||
"../../rtc_base/system:arch",
|
"../../rtc_base/system:arch",
|
||||||
"../../rtc_base/system:file_wrapper",
|
"../../rtc_base/system:file_wrapper",
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
"../../system_wrappers:cpu_features_api",
|
|
||||||
"../../test:fileutils",
|
"../../test:fileutils",
|
||||||
"../../test:rtc_expect_death",
|
"../../test:rtc_expect_death",
|
||||||
"../../test:test_support",
|
"../../test:test_support",
|
||||||
|
|
|
@ -142,7 +142,7 @@ rtc_library("aec3") {
|
||||||
"../../../rtc_base:safe_minmax",
|
"../../../rtc_base:safe_minmax",
|
||||||
"../../../rtc_base/experiments:field_trial_parser",
|
"../../../rtc_base/experiments:field_trial_parser",
|
||||||
"../../../rtc_base/system:arch",
|
"../../../rtc_base/system:arch",
|
||||||
"../../../system_wrappers:cpu_features_api",
|
"../../../system_wrappers",
|
||||||
"../../../system_wrappers:field_trial",
|
"../../../system_wrappers:field_trial",
|
||||||
"../../../system_wrappers:metrics",
|
"../../../system_wrappers:metrics",
|
||||||
"../utility:cascaded_biquad_filter",
|
"../utility:cascaded_biquad_filter",
|
||||||
|
@ -308,7 +308,7 @@ if (rtc_include_tests) {
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
"../../../rtc_base:safe_minmax",
|
"../../../rtc_base:safe_minmax",
|
||||||
"../../../rtc_base/system:arch",
|
"../../../rtc_base/system:arch",
|
||||||
"../../../system_wrappers:cpu_features_api",
|
"../../../system_wrappers",
|
||||||
"../../../test:field_trial",
|
"../../../test:field_trial",
|
||||||
"../../../test:test_support",
|
"../../../test:test_support",
|
||||||
"../utility:cascaded_biquad_filter",
|
"../utility:cascaded_biquad_filter",
|
||||||
|
|
|
@ -21,7 +21,7 @@ rtc_library("aecm_core") {
|
||||||
"../../../rtc_base:checks",
|
"../../../rtc_base:checks",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
"../../../rtc_base:sanitizer",
|
"../../../rtc_base:sanitizer",
|
||||||
"../../../system_wrappers:cpu_features_api",
|
"../../../system_wrappers",
|
||||||
"../utility:legacy_delay_estimator",
|
"../utility:legacy_delay_estimator",
|
||||||
]
|
]
|
||||||
cflags = []
|
cflags = []
|
||||||
|
|
|
@ -78,7 +78,7 @@ rtc_library("legacy_agc") {
|
||||||
"../../../common_audio/third_party/ooura:fft_size_256",
|
"../../../common_audio/third_party/ooura:fft_size_256",
|
||||||
"../../../rtc_base:checks",
|
"../../../rtc_base:checks",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
"../../../system_wrappers:cpu_features_api",
|
"../../../system_wrappers",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (rtc_build_with_neon) {
|
if (rtc_build_with_neon) {
|
||||||
|
|
|
@ -153,7 +153,7 @@ rtc_library("noise_level_estimator") {
|
||||||
"../../../common_audio/third_party/ooura:fft_size_128",
|
"../../../common_audio/third_party/ooura:fft_size_128",
|
||||||
"../../../rtc_base:checks",
|
"../../../rtc_base:checks",
|
||||||
"../../../rtc_base:macromagic",
|
"../../../rtc_base:macromagic",
|
||||||
"../../../system_wrappers:cpu_features_api",
|
"../../../system_wrappers",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs += [ "..:apm_debug_dump" ]
|
configs += [ "..:apm_debug_dump" ]
|
||||||
|
|
|
@ -48,7 +48,7 @@ rtc_library("rnn_vad") {
|
||||||
"../../../../rtc_base:checks",
|
"../../../../rtc_base:checks",
|
||||||
"../../../../rtc_base:rtc_base_approved",
|
"../../../../rtc_base:rtc_base_approved",
|
||||||
"../../../../rtc_base/system:arch",
|
"../../../../rtc_base/system:arch",
|
||||||
"../../../../system_wrappers:cpu_features_api",
|
"../../../../system_wrappers",
|
||||||
"../../utility:pffft_wrapper",
|
"../../utility:pffft_wrapper",
|
||||||
"//third_party/rnnoise:rnn_vad",
|
"//third_party/rnnoise:rnn_vad",
|
||||||
]
|
]
|
||||||
|
@ -67,7 +67,7 @@ if (rtc_include_tests) {
|
||||||
"../../../../api:scoped_refptr",
|
"../../../../api:scoped_refptr",
|
||||||
"../../../../rtc_base:checks",
|
"../../../../rtc_base:checks",
|
||||||
"../../../../rtc_base/system:arch",
|
"../../../../rtc_base/system:arch",
|
||||||
"../../../../system_wrappers:cpu_features_api",
|
"../../../../system_wrappers",
|
||||||
"../../../../test:fileutils",
|
"../../../../test:fileutils",
|
||||||
"../../../../test:test_support",
|
"../../../../test:test_support",
|
||||||
]
|
]
|
||||||
|
|
|
@ -60,7 +60,7 @@ rtc_static_library("ns") {
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
"../../../rtc_base:safe_minmax",
|
"../../../rtc_base:safe_minmax",
|
||||||
"../../../rtc_base/system:arch",
|
"../../../rtc_base/system:arch",
|
||||||
"../../../system_wrappers:cpu_features_api",
|
"../../../system_wrappers",
|
||||||
"../../../system_wrappers:field_trial",
|
"../../../system_wrappers:field_trial",
|
||||||
"../../../system_wrappers:metrics",
|
"../../../system_wrappers:metrics",
|
||||||
"../utility:cascaded_biquad_filter",
|
"../utility:cascaded_biquad_filter",
|
||||||
|
@ -87,7 +87,7 @@ if (rtc_include_tests) {
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
"../../../rtc_base:safe_minmax",
|
"../../../rtc_base:safe_minmax",
|
||||||
"../../../rtc_base/system:arch",
|
"../../../rtc_base/system:arch",
|
||||||
"../../../system_wrappers:cpu_features_api",
|
"../../../system_wrappers",
|
||||||
"../../../test:test_support",
|
"../../../test:test_support",
|
||||||
"../utility:cascaded_biquad_filter",
|
"../utility:cascaded_biquad_filter",
|
||||||
]
|
]
|
||||||
|
|
|
@ -115,7 +115,7 @@ if (rtc_include_tests) {
|
||||||
":primitives",
|
":primitives",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../system_wrappers:cpu_features_api",
|
"../../system_wrappers",
|
||||||
"../../test:test_support",
|
"../../test:test_support",
|
||||||
]
|
]
|
||||||
if (rtc_desktop_capture_supported) {
|
if (rtc_desktop_capture_supported) {
|
||||||
|
@ -486,7 +486,6 @@ rtc_library("desktop_capture_generic") {
|
||||||
"../../rtc_base/system:arch",
|
"../../rtc_base/system:arch",
|
||||||
"../../rtc_base/system:rtc_export",
|
"../../rtc_base/system:rtc_export",
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
"../../system_wrappers:cpu_features_api",
|
|
||||||
"../../system_wrappers:metrics",
|
"../../system_wrappers:metrics",
|
||||||
]
|
]
|
||||||
absl_deps = [
|
absl_deps = [
|
||||||
|
|
|
@ -37,7 +37,7 @@ rtc_library("video_processing") {
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base/system:arch",
|
"../../rtc_base/system:arch",
|
||||||
"../../system_wrappers:cpu_features_api",
|
"../../system_wrappers",
|
||||||
"//third_party/libyuv",
|
"//third_party/libyuv",
|
||||||
]
|
]
|
||||||
if (build_video_processing_sse2) {
|
if (build_video_processing_sse2) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ rtc_library("system_wrappers") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
sources = [
|
sources = [
|
||||||
"include/clock.h",
|
"include/clock.h",
|
||||||
|
"include/cpu_features_wrapper.h",
|
||||||
"include/cpu_info.h",
|
"include/cpu_info.h",
|
||||||
"include/ntp_time.h",
|
"include/ntp_time.h",
|
||||||
"include/rtp_to_ntp_estimator.h",
|
"include/rtp_to_ntp_estimator.h",
|
||||||
|
@ -30,7 +31,6 @@ rtc_library("system_wrappers") {
|
||||||
defines = []
|
defines = []
|
||||||
libs = []
|
libs = []
|
||||||
deps = [
|
deps = [
|
||||||
":cpu_features_api",
|
|
||||||
"../api:array_view",
|
"../api:array_view",
|
||||||
"../api/units:timestamp",
|
"../api/units:timestamp",
|
||||||
"../modules:module_api_public",
|
"../modules:module_api_public",
|
||||||
|
@ -50,7 +50,8 @@ rtc_library("system_wrappers") {
|
||||||
"/nsprpub/pr/include",
|
"/nsprpub/pr/include",
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
deps += [ ":cpu_features_android" ]
|
sources += [ "source/cpu_features_android.cc" ]
|
||||||
|
deps += [ "//third_party/android_sdk:cpu_features" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
libs += [ "log" ]
|
libs += [ "log" ]
|
||||||
|
@ -58,7 +59,7 @@ rtc_library("system_wrappers") {
|
||||||
|
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
if (!build_with_chromium) {
|
if (!build_with_chromium) {
|
||||||
deps += [ ":cpu_features_linux" ]
|
sources += [ "source/cpu_features_linux.cc" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
libs += [ "rt" ]
|
libs += [ "rt" ]
|
||||||
|
@ -78,10 +79,6 @@ rtc_library("system_wrappers") {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_source_set("cpu_features_api") {
|
|
||||||
sources = [ "include/cpu_features_wrapper.h" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
rtc_library("field_trial") {
|
rtc_library("field_trial") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
public = [ "include/field_trial.h" ]
|
public = [ "include/field_trial.h" ]
|
||||||
|
@ -111,24 +108,6 @@ rtc_library("metrics") {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_android && !build_with_mozilla) {
|
|
||||||
rtc_library("cpu_features_android") {
|
|
||||||
sources = [ "source/cpu_features_android.c" ]
|
|
||||||
|
|
||||||
deps = [ "//third_party/android_sdk:cpu_features" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_linux) {
|
|
||||||
rtc_library("cpu_features_linux") {
|
|
||||||
sources = [ "source/cpu_features_linux.c" ]
|
|
||||||
deps = [
|
|
||||||
":cpu_features_api",
|
|
||||||
"../rtc_base/system:arch",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rtc_include_tests) {
|
if (rtc_include_tests) {
|
||||||
rtc_test("system_wrappers_unittests") {
|
rtc_test("system_wrappers_unittests") {
|
||||||
testonly = true
|
testonly = true
|
||||||
|
|
|
@ -13,10 +13,6 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// List of features in x86.
|
// List of features in x86.
|
||||||
typedef enum { kSSE2, kSSE3, kAVX2 } CPUFeature;
|
typedef enum { kSSE2, kSSE3, kAVX2 } CPUFeature;
|
||||||
|
|
||||||
|
@ -41,8 +37,4 @@ extern WebRtc_CPUInfo WebRtc_GetCPUInfoNoASM;
|
||||||
// values in the above enum definition as a bitmask.
|
// values in the above enum definition as a bitmask.
|
||||||
extern uint64_t WebRtc_GetCPUFeaturesARM(void);
|
extern uint64_t WebRtc_GetCPUFeaturesARM(void);
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
|
#endif // SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <features.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <features.h>
|
|
||||||
|
|
||||||
#ifdef __GLIBC_PREREQ
|
#ifdef __GLIBC_PREREQ
|
||||||
#define WEBRTC_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
|
#define WEBRTC_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
|
||||||
|
@ -21,10 +21,10 @@
|
||||||
#if WEBRTC_GLIBC_PREREQ(2, 16)
|
#if WEBRTC_GLIBC_PREREQ(2, 16)
|
||||||
#include <sys/auxv.h>
|
#include <sys/auxv.h>
|
||||||
#else
|
#else
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <link.h>
|
#include <link.h>
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rtc_base/system/arch.h"
|
#include "rtc_base/system/arch.h"
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
uint64_t WebRtc_GetCPUFeaturesARM(void) {
|
uint64_t WebRtc_GetCPUFeaturesARM(void) {
|
||||||
uint64_t result = 0;
|
uint64_t result = 0;
|
||||||
int architecture = 0;
|
int architecture = 0;
|
||||||
unsigned long hwcap = 0;
|
uint64_t hwcap = 0;
|
||||||
const char* platform = NULL;
|
const char* platform = NULL;
|
||||||
#if WEBRTC_GLIBC_PREREQ(2, 16)
|
#if WEBRTC_GLIBC_PREREQ(2, 16)
|
||||||
hwcap = getauxval(AT_HWCAP);
|
hwcap = getauxval(AT_HWCAP);
|
Loading…
Reference in a new issue