diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn index 3ecbf0ff94..25ca37f2b8 100644 --- a/modules/audio_device/BUILD.gn +++ b/modules/audio_device/BUILD.gn @@ -120,6 +120,7 @@ rtc_source_set("windows_core_audio_utility") { "../../rtc_base:platform_thread_types", "../../rtc_base:rtc_base_approved", "../../rtc_base:stringutils", + "../../rtc_base/win:windows_version", ] libs = [ "oleaut32.lib" ] @@ -164,6 +165,8 @@ rtc_source_set("audio_device_module_from_input_and_output") { "../../rtc_base:safe_conversions", "../../rtc_base:stringutils", "../../rtc_base:timeutils", + "../../rtc_base/win:scoped_com_initializer", + "../../rtc_base/win:windows_version", ] absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] } @@ -344,7 +347,10 @@ rtc_library("audio_device_impl") { "msdmo.lib", "oleaut32.lib", ] - deps += [ "../../rtc_base:win32" ] + deps += [ + "../../rtc_base:win32", + "../../rtc_base/win:scoped_com_initializer", + ] } configs += [ ":audio_device_warnings_config" ] } @@ -438,6 +444,8 @@ if (rtc_include_tests && !build_with_chromium) { deps += [ ":audio_device_module_from_input_and_output", ":windows_core_audio_utility", + "../../rtc_base/win:scoped_com_initializer", + "../../rtc_base/win:windows_version", ] } if (is_android) { diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index 78966bb16f..94f0c8e5d8 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn @@ -82,6 +82,10 @@ if (rtc_include_tests) { "window_finder_unittest.cc", ] public_configs = [ ":x11_config" ] + + if (is_win) { + deps += [ "../../rtc_base/win:windows_version" ] + } } } @@ -106,18 +110,6 @@ if (rtc_include_tests) { "test_utils.h", "test_utils_unittest.cc", ] - if (is_win) { - sources += [ - "win/cursor_unittest.cc", - "win/cursor_unittest_resources.h", - "win/cursor_unittest_resources.rc", - "win/screen_capture_utils_unittest.cc", - "win/screen_capturer_win_directx_unittest.cc", - "win/test_support/test_window.cc", - "win/test_support/test_window.h", - "win/window_capture_utils_unittest.cc", - ] - } deps = [ ":desktop_capture", ":desktop_capture_mock", @@ -135,6 +127,24 @@ if (rtc_include_tests) { "../../system_wrappers", "../../test:test_support", ] + + if (is_win) { + sources += [ + "win/cursor_unittest.cc", + "win/cursor_unittest_resources.h", + "win/cursor_unittest_resources.rc", + "win/screen_capture_utils_unittest.cc", + "win/screen_capturer_win_directx_unittest.cc", + "win/test_support/test_window.cc", + "win/test_support/test_window.h", + "win/window_capture_utils_unittest.cc", + ] + deps += [ + "../../rtc_base/win:scoped_com_initializer", + "../../rtc_base/win:windows_version", + ] + } + if (rtc_desktop_capture_supported) { sources += [ "screen_capturer_helper_unittest.cc", @@ -561,6 +571,9 @@ rtc_library("desktop_capture_generic") { ] deps += [ "../../rtc_base:win32", + "../../rtc_base/win:create_direct3d_device", + "../../rtc_base/win:get_activation_factory", + "../../rtc_base/win:windows_version", ] } @@ -637,6 +650,8 @@ rtc_library("desktop_capture_generic") { "win/wgc_desktop_frame.cc", "win/wgc_desktop_frame.h", ] + + deps += [ "../../rtc_base/win:hstring" ] } } diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 94d2298d89..1e1ca474aa 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -80,33 +80,6 @@ rtc_source_set("callback_list") { # the old concept of rtc_base and rtc_base_approved. rtc_source_set("rtc_base_approved") { visibility = [ "*" ] - - if (is_win) { - sources = [ - "win/get_activation_factory.cc", - "win/get_activation_factory.h", - "win/hstring.cc", - "win/hstring.h", - "win/scoped_com_initializer.cc", - "win/scoped_com_initializer.h", - "win/windows_version.cc", - "win/windows_version.h", - ] - deps = [ - ":checks", - ":logging", - ":stringutils", - ] - data_deps = [ "//build/win:runtime_libs" ] - } - - # These files add a dependency on the Win10 SDK v10.0.10240. - if (rtc_enable_win_wgc) { - sources += [ - "win/create_direct3d_device.cc", - "win/create_direct3d_device.h", - ] - } } rtc_source_set("buffer") { @@ -851,8 +824,8 @@ rtc_library("net_helpers") { } if (is_win) { deps += [ - ":rtc_base_approved", ":win32", + "win:windows_version", ] } absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] @@ -1581,9 +1554,6 @@ if (rtc_include_tests) { "virtual_socket_unittest.cc", "zero_memory_unittest.cc", ] - if (is_win) { - sources += [ "win/windows_version_unittest.cc" ] - } deps = [ ":atomicops", ":bit_buffer", @@ -1658,6 +1628,10 @@ if (rtc_include_tests) { "//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/types:optional", ] + + if (is_win) { + deps += [ "win:windows_version_unittest" ] + } } rtc_library("rtc_task_queue_unittests") { diff --git a/rtc_base/win/BUILD.gn b/rtc_base/win/BUILD.gn new file mode 100644 index 0000000000..cf8bc21950 --- /dev/null +++ b/rtc_base/win/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2021 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("../../webrtc.gni") + +rtc_library("create_direct3d_device") { + sources = [ + "create_direct3d_device.cc", + "create_direct3d_device.h", + ] + data_deps = [ "//build/win:runtime_libs" ] +} + +rtc_library("get_activation_factory") { + sources = [ + "get_activation_factory.cc", + "get_activation_factory.h", + ] + data_deps = [ "//build/win:runtime_libs" ] + deps = [ ":hstring" ] +} + +rtc_library("hstring") { + sources = [ + "hstring.cc", + "hstring.h", + ] + data_deps = [ "//build/win:runtime_libs" ] +} + +rtc_library("scoped_com_initializer") { + sources = [ + "scoped_com_initializer.cc", + "scoped_com_initializer.h", + ] + data_deps = [ "//build/win:runtime_libs" ] + deps = [ + "..:checks", + "..:logging", + ] +} + +rtc_library("windows_version") { + sources = [ + "windows_version.cc", + "windows_version.h", + ] + data_deps = [ "//build/win:runtime_libs" ] + deps = [ + "..:checks", + "..:stringutils", + ] +} + +rtc_library("windows_version_unittest") { + testonly = true + sources = [ "windows_version_unittest.cc" ] + deps = [ + ":windows_version", + "..:gunit_helpers", + "..:logging", + ] +} diff --git a/video/BUILD.gn b/video/BUILD.gn index 385f37f843..58c9f9ac98 100644 --- a/video/BUILD.gn +++ b/video/BUILD.gn @@ -620,6 +620,9 @@ if (rtc_include_tests) { if (is_mac || is_ios) { deps += [ "../test:video_test_mac" ] } + if (is_win) { + deps += [ "../rtc_base/win:scoped_com_initializer" ] + } } rtc_library("video_full_stack_tests") {