Bug 1393119 - Fix windows gn build draft
authorDan Minor <dminor@mozilla.com>
Wed, 18 Oct 2017 12:45:40 -0400
changeset 693658 ff6e8e20564c4a30dc82021fb4e2c9325f220c2a
parent 693657 13d234492279d71627a1278f8f4141c4df044686
child 693659 46fda04b29995387564fe05c2130152f55fa5c71
push id87887
push userbmo:dminor@mozilla.com
push dateMon, 06 Nov 2017 19:01:19 +0000
bugs1393119
milestone58.0a1
Bug 1393119 - Fix windows gn build MozReview-Commit-ID: GBlbAbmoa6J
build/gn.mozbuild
media/webrtc/trunk/build/toolchain/win/BUILD.gn
media/webrtc/trunk/build/win/BUILD.gn
media/webrtc/trunk/moz.build
media/webrtc/trunk/webrtc/base/BUILD.gn
media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn
media/webrtc/trunk/webrtc/modules/desktop_capture/win/cursor.cc
media/webrtc/trunk/webrtc/modules/video_capture/BUILD.gn
--- a/build/gn.mozbuild
+++ b/build/gn.mozbuild
@@ -24,14 +24,14 @@ flavors = {
     'FreeBSD': 'freebsd',
     'NetBSD': 'netbsd',
     'OpenBSD': 'openbsd',
 }
 gn_vars['target_os'] = flavors.get(os)
 
 arches = {
     'x86_64': 'x64',
-    'x86': 'ia32',
+    'x86': 'x86',
     'aarch64': 'arm64',
 }
 
 gn_vars['host_cpu'] = arches.get(CONFIG['HOST_CPU_ARCH'], CONFIG['HOST_CPU_ARCH'])
 gn_vars['target_cpu'] = arches.get(CONFIG['CPU_ARCH'], CONFIG['CPU_ARCH'])
--- a/media/webrtc/trunk/build/toolchain/win/BUILD.gn
+++ b/media/webrtc/trunk/build/toolchain/win/BUILD.gn
@@ -31,23 +31,23 @@ if (use_goma) {
 # Copy the VS runtime DLL for the default toolchain to the root build directory
 # so things will run.
 if (current_toolchain == default_toolchain) {
   if (is_debug) {
     configuration_name = "Debug"
   } else {
     configuration_name = "Release"
   }
-  exec_script("../../vs_toolchain.py",
-              [
-                "copy_dlls",
-                rebase_path(root_build_dir),
-                configuration_name,
-                target_cpu,
-              ])
+#  exec_script("../../vs_toolchain.py",
+#              [
+#                "copy_dlls",
+#                rebase_path(root_build_dir),
+#                configuration_name,
+#                target_cpu,
+#              ])
 }
 
 # Parameters:
 #   environment: File name of environment file.
 #
 # You would also define a toolchain_args variable with at least these set:
 #   current_cpu: current_cpu to pass as a build arg
 #   current_os: current_os to pass as a build arg
@@ -326,76 +326,76 @@ if (host_os == "win") {
 } else {
   clang_cl = "clang-cl"
 }
 
 # 32-bit toolchains. Only define these when the target architecture is 32-bit
 # since we don't do any 32-bit cross compiles when targeting 64-bit (the
 # build does generate some 64-bit stuff from 32-bit target builds).
 if (target_cpu == "x86") {
-  x86_toolchain_data = exec_script("setup_toolchain.py",
-                                   [
-                                     visual_studio_path,
-                                     windows_sdk_path,
-                                     visual_studio_runtime_dirs,
-                                     "x86",
-                                   ],
-                                   "scope")
+  #x86_toolchain_data = exec_script("setup_toolchain.py",
+  #                                 [
+  #                                   visual_studio_path,
+  #                                   windows_sdk_path,
+  #                                   visual_studio_runtime_dirs,
+  #                                   "x86",
+  #                                 ],
+  #                                 "scope")
 
   msvc_toolchain("x86") {
     environment = "environment.x86"
-    cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\""
+    cl = "" #"${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\""
     toolchain_args = {
       current_cpu = "x86"
       is_clang = false
     }
   }
 
   msvc_toolchain("clang_x86") {
     environment = "environment.x86"
-    prefix = rebase_path("$clang_base_path/bin", root_build_dir)
-    cl = "${goma_prefix}$prefix/${clang_cl}"
-    sys_include_flags = "${x86_toolchain_data.include_flags_imsvc}"
+    #prefix = "rebase_path("$clang_base_path/bin", root_build_dir)
+    cl = "" #"${goma_prefix}$prefix/${clang_cl}"
+    sys_include_flags = "" #"${x86_toolchain_data.include_flags_imsvc}"
 
     toolchain_args = {
       current_cpu = "x86"
       is_clang = true
     }
   }
 }
 
 # 64-bit toolchains.
-x64_toolchain_data = exec_script("setup_toolchain.py",
-                                 [
-                                   visual_studio_path,
-                                   windows_sdk_path,
-                                   visual_studio_runtime_dirs,
-                                   "x64",
-                                 ],
-                                 "scope")
+#x64_toolchain_data = exec_script("setup_toolchain.py",
+#                                 [
+#                                   visual_studio_path,
+#                                   windows_sdk_path,
+#                                   visual_studio_runtime_dirs,
+#                                   "x64",
+#                                 ],
+#                                 "scope")
 
 template("win_x64_toolchains") {
   msvc_toolchain(target_name) {
     environment = "environment.x64"
-    cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\""
+    cl = "" #"${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\""
 
     toolchain_args = {
       if (defined(invoker.toolchain_args)) {
         forward_variables_from(invoker.toolchain_args, "*")
       }
       is_clang = false
       current_cpu = "x64"
     }
   }
 
   msvc_toolchain("clang_" + target_name) {
     environment = "environment.x64"
-    prefix = rebase_path("$clang_base_path/bin", root_build_dir)
-    cl = "${goma_prefix}$prefix/${clang_cl}"
-    sys_include_flags = "${x64_toolchain_data.include_flags_imsvc}"
+    #prefix = rebase_path("$clang_base_path/bin", root_build_dir)
+    cl = "" #"${goma_prefix}$prefix/${clang_cl}"
+    sys_include_flags = "" #"${x64_toolchain_data.include_flags_imsvc}"
 
     toolchain_args = {
       if (defined(invoker.toolchain_args)) {
         forward_variables_from(invoker.toolchain_args, "*")
       }
       is_clang = true
       current_cpu = "x64"
     }
@@ -423,26 +423,26 @@ win_x64_toolchains("nacl_win64") {
 #
 # NOTE: This is currently broken because it references vc_bin_dir. brettw@
 # changed this around a bit, and I don't know what this should be set to
 # in terms of what setup_toolchain returns for a certain CPU architecture.
 if (target_os == "winrt_81" || target_os == "winrt_81_phone" ||
     target_os == "winrt_10") {
   msvc_toolchain("winrt_x86") {
     environment = "environment.winrt_x86"
-    cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
+    cl = "" #"${goma_prefix}\"${vc_bin_dir}/cl.exe\""
 
     toolchain_args = {
       is_clang = false
       current_cpu = "x86"
     }
   }
 
   msvc_toolchain("winrt_x64") {
     environment = "environment.winrt_x64"
-    cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
+    cl = "" #"${goma_prefix}\"${vc_bin_dir}/cl.exe\""
 
     toolchain_args = {
       is_clang = false
       current_cpu = "x64"
     }
   }
 }
--- a/media/webrtc/trunk/build/win/BUILD.gn
+++ b/media/webrtc/trunk/build/win/BUILD.gn
@@ -10,17 +10,17 @@ windows_manifest("default_exe_manifest")
   sources = [
     as_invoker_manifest,
     common_controls_manifest,
     default_compatibility_manifest,
   ]
   type = "exe"
 }
 
-if (is_win) {
+if (false) {
   action("copy_cdb_to_output") {
     script = "//build/win/copy_cdb_to_output.py"
     inputs = [
       script,
     ]
     outputs = [
       "$root_out_dir/cdb/cdb.exe",
       "$root_out_dir/cdb/dbgeng.dll",
--- a/media/webrtc/trunk/moz.build
+++ b/media/webrtc/trunk/moz.build
@@ -0,0 +1,86 @@
+
+DIRS += [
+    "/media/webrtc/trunk/webrtc/modules/audio_mixer/audio_mixer_impl_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_coding/video_coding_utility_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_conference_mixer/audio_conference_mixer_gn",
+    "/media/webrtc/trunk/webrtc/modules/bitrate_controller/bitrate_controller_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_processing/video_processing_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_mixer/audio_frame_manipulator_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/audio_format_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/pcm16b_c_gn",
+    "/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/audio_network_adaptor_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/webrtc_opus_gn",
+    "/media/webrtc/trunk/webrtc/system_wrappers/field_trial_default_gn",
+    "/media/webrtc/trunk/webrtc/modules/rtp_rtcp/rtp_rtcp_gn",
+    "/media/webrtc/trunk/webrtc/call/call_gn",
+    "/media/webrtc/trunk/webrtc/modules/media_file/media_file_gn",
+    "/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn",
+    "/media/webrtc/trunk/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/g722_c_gn",
+    "/media/webrtc/trunk/webrtc/system_wrappers/system_wrappers_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/audio_decoder_interface_gn",
+    "/media/webrtc/trunk/webrtc/logging/rtc_event_log_impl_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/g711_c_gn",
+    "/media/webrtc/trunk/webrtc/base/gtest_prod_gn",
+    "/media/webrtc/trunk/webrtc/common_audio/common_audio_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/webrtc_opus_c_gn",
+    "/media/webrtc/trunk/webrtc/common_video/common_video_gn",
+    "/media/webrtc/trunk/webrtc/system_wrappers/metrics_default_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/isac_c_gn",
+    "/media/webrtc/trunk/webrtc/api/transport_api_gn",
+    "/media/webrtc/trunk/webrtc/modules/congestion_controller/congestion_controller_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/builtin_audio_decoder_factory_gn",
+    "/media/webrtc/trunk/webrtc/common_audio/common_audio_sse2_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/audio_decoder_factory_interface_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_coding/webrtc_vp9_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_coding/webrtc_i420_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/neteq_gn",
+    "/media/webrtc/trunk/webrtc/modules/utility/utility_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/pcm16b_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/audio_format_conversion_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_coding/video_coding_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/isac_fix_c_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_coding/webrtc_h264_gn",
+    "/media/webrtc/trunk/webrtc/modules/desktop_capture/primitives_gn",
+    "/media/webrtc/trunk/webrtc/logging/rtc_event_log_api_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_coding/webrtc_vp8_gn",
+    "/media/webrtc/trunk/webrtc/api/audio_mixer_api_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/g711_gn",
+    "/media/webrtc/trunk/webrtc/voice_engine/voice_engine_gn",
+    "/media/webrtc/trunk/webrtc/api/call_api_gn",
+    "/media/webrtc/trunk/webrtc/api/video_frame_api_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/audio_encoder_interface_gn",
+    "/media/webrtc/trunk/webrtc/audio/utility/audio_frame_operations_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_c_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_sse2_gn",
+    "/media/webrtc/trunk/webrtc/audio/audio_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/g722_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_capture/video_capture_gn",
+    "/media/webrtc/trunk/webrtc/voice_engine/audio_coder_gn",
+    "/media/webrtc/trunk/webrtc/base/rtc_numerics_gn",
+    "/media/webrtc/trunk/webrtc/voice_engine/file_player_gn",
+    "/media/webrtc/trunk/webrtc/base/rtc_task_queue_gn",
+    "/media/webrtc/trunk/webrtc/media/mozilla_rtc_media_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/isac_common_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_capture/video_capture_internal_impl_gn",
+    "/media/webrtc/trunk/webrtc/modules/pacing/pacing_gn",
+    "/media/webrtc/trunk/webrtc/common_audio/common_audio_c_gn",
+    "/media/webrtc/trunk/webrtc/video/video_gn",
+    "/media/webrtc/trunk/webrtc/call/call_interfaces_gn",
+    "/media/webrtc/trunk/webrtc/voice_engine/level_indicator_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/rent_a_codec_gn",
+    "/media/webrtc/trunk/webrtc/base/rtc_base_approved_gn",
+    "/media/webrtc/trunk/webrtc/webrtc_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/cng_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/isac_fix_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_capture/video_capture_module_gn",
+    "/media/webrtc/trunk/webrtc/modules/video_processing/video_processing_sse2_gn",
+    "/media/webrtc/trunk/webrtc/voice_engine/file_recorder_gn",
+    "/media/webrtc/trunk/webrtc/video_engine/video_engine_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/audio_coding_gn",
+    "/media/webrtc/trunk/webrtc/modules/audio_coding/isac_gn",
+    "/media/webrtc/trunk/webrtc/webrtc_common_gn"
+]
--- a/media/webrtc/trunk/webrtc/base/BUILD.gn
+++ b/media/webrtc/trunk/webrtc/base/BUILD.gn
@@ -189,16 +189,20 @@ rtc_static_library("rtc_base_approved") 
   }
 
   if (is_posix) {
     sources += [ "file_posix.cc" ]
   }
 
   if (is_win) {
     sources += [ "file_win.cc" ]
+
+    if (build_with_mozilla) {
+      sources += [ "win32.cc" ]
+    }
   }
 
   if (build_with_chromium) {
     # Dependency on chromium's logging (in //base).
     deps += [ "//base:base" ]
     sources += [
       "../../webrtc_overrides/webrtc/base/logging.cc",
       "../../webrtc_overrides/webrtc/base/logging.h",
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn
@@ -174,16 +174,19 @@ rtc_static_library("desktop_capture") {
     "window_capturer_mac.mm",
     "window_capturer_win.cc",
   ]
 
   if (build_with_mozilla) {
     sources += [
       "desktop_device_info.cc",
       "desktop_device_info.h",
+      "app_capturer_win.cc",
+      "win/desktop_device_info_win.cc",
+      "win/win_shared.cc",
     ]
   }
 
   if (use_x11) {
     sources += [
       "mouse_cursor_monitor_x11.cc",
       "screen_capturer_x11.cc",
       "window_capturer_x11.cc",
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/win/cursor.cc
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/win/cursor.cc
@@ -37,18 +37,16 @@ namespace {
 #define RGBA(r, g, b, a) \
     ((((r) << 24) & 0xff000000) | \
     (((g) << 16) & 0xff0000) | \
     (((b) << 8) & 0xff00) | \
     ((a) & 0xff))
 
 #endif  // !defined(WEBRTC_ARCH_LITTLE_ENDIAN)
 
-const int kBytesPerPixel = DesktopFrame::kBytesPerPixel;
-
 // Pixel colors used when generating cursor outlines.
 const uint32_t kPixelRgbaBlack = RGBA(0, 0, 0, 0xff);
 const uint32_t kPixelRgbaWhite = RGBA(0xff, 0xff, 0xff, 0xff);
 const uint32_t kPixelRgbaTransparent = RGBA(0, 0, 0, 0);
 
 const uint32_t kPixelRgbWhite = RGB(0xff, 0xff, 0xff);
 
 // Expands the cursor shape to add a white outline for visibility against
@@ -71,17 +69,17 @@ void AddCursorOutline(int width, int hei
       data++;
     }
   }
 }
 
 // Premultiplies RGB components of the pixel data in the given image by
 // the corresponding alpha components.
 void AlphaMul(uint32_t* data, int width, int height) {
-  static_assert(sizeof(uint32_t) == kBytesPerPixel,
+  static_assert(sizeof(uint32_t) == DesktopFrame::kBytesPerPixel,
                 "size of uint32 should be the number of bytes per pixel");
 
   for (uint32_t* data_end = data + width * height; data != data_end; ++data) {
     RGBQUAD* from = reinterpret_cast<RGBQUAD*>(data);
     RGBQUAD* to = reinterpret_cast<RGBQUAD*>(data);
     to->rgbBlue =
         (static_cast<uint16_t>(from->rgbBlue) * from->rgbReserved) / 0xff;
     to->rgbGreen =
@@ -139,17 +137,17 @@ MouseCursor* CreateMouseCursorFromHCurso
 
   // Get pixel data from |scoped_mask| converting it to 32bpp along the way.
   // GetDIBits() sets the alpha component of every pixel to 0.
   BITMAPV5HEADER bmi = {0};
   bmi.bV5Size = sizeof(bmi);
   bmi.bV5Width = width;
   bmi.bV5Height = -height;  // request a top-down bitmap.
   bmi.bV5Planes = 1;
-  bmi.bV5BitCount = kBytesPerPixel * 8;
+  bmi.bV5BitCount = DesktopFrame::kBytesPerPixel * 8;
   bmi.bV5Compression = BI_RGB;
   bmi.bV5AlphaMask = 0xff000000;
   bmi.bV5CSType = LCS_WINDOWS_COLOR_SPACE;
   bmi.bV5Intent = LCS_GM_BUSINESS;
   if (!GetDIBits(dc,
                  scoped_mask,
                  0,
                  height,
--- a/media/webrtc/trunk/webrtc/modules/video_capture/BUILD.gn
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/BUILD.gn
@@ -119,17 +119,26 @@ if (!build_with_chromium) {
         "windows/video_capture_ds.h",
         "windows/video_capture_factory_windows.cc",
         "windows/video_capture_mf.cc",
         "windows/video_capture_mf.h",
       ]
 
       libs = [ "Strmiids.lib" ]
 
-      deps += [ "//third_party/winsdk_samples" ]
+      if (!build_with_mozilla) {
+        deps += [ "//third_party/winsdk_samples" ]
+      } else {
+        sources += [
+          "windows/BasePin.cpp",
+          "windows/BaseFilter.cpp",
+          "windows/BaseInputPin.cpp",
+          "windows/MediaType.cpp",
+        ]
+      }
     }
     if (is_ios || is_mac) {
       sources = [
         "objc/device_info.h",
         "objc/device_info.mm",
         "objc/device_info_objc.h",
         "objc/device_info_objc.mm",
         "objc/rtc_video_capture_objc.h",