Bug 1298418 - use clang modules with ffvpx's libavutil and clang-cl; r=mshal
authorNathan Froyd <froydnj@mozilla.com>
Wed, 30 Nov 2016 16:01:55 -0500
changeset 325051 a63ed01b4c5632a96dc0a626400b5251235c5c5f
parent 325050 6368fb6d8a0918a8c9702eec952c75766965fdf9
child 325052 437aab812660f23db1cb6cc9f321c56856da48f7
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersmshal
bugs1298418
milestone53.0a1
Bug 1298418 - use clang modules with ffvpx's libavutil and clang-cl; r=mshal clang-cl's <intrin.h> is not completely compatible with MSVC's <intrin.h> by default, as clang-cl's version does not include all the Intel intrinsic headers by default. clang-cl does this to make <intrin.h> as small as possible, as this was shown to have significant wins for compile time. Compiling with modules, however, includes all the Intel intrinsic headers by default, so while upstream decides on a general solution, we need to compile with modules locally. MozReview-Commit-ID: BC1uureeQrx
media/ffvpx/ffvpxcommon.mozbuild
--- a/media/ffvpx/ffvpxcommon.mozbuild
+++ b/media/ffvpx/ffvpxcommon.mozbuild
@@ -82,8 +82,23 @@ elif CONFIG['_MSC_VER']:
 DEFINES['HAVE_AV_CONFIG_H'] = True
 
 if CONFIG['MOZ_DEBUG']:
     # Enable all assertions in debug builds.
     DEFINES['ASSERT_LEVEL'] = 2
 elif not CONFIG['RELEASE_OR_BETA']:
     # Enable fast assertions in opt builds of Nightly and Aurora.
     DEFINES['ASSERT_LEVEL'] = 1
+
+# clang-cl's <intrin.h> doesn't work the same as MSVC's.  For details, see:
+#
+# http://lists.llvm.org/pipermail/cfe-dev/2016-September/050943.html
+#
+# As a temporary workaround while upstream decides how to address this,
+# we enable modules to make <intrin.h> more MSVC-compatible.
+if CONFIG['CLANG_CL']:
+    CFLAGS += [
+        '-Xclang',
+        '-fmodules',
+        '-Xclang',
+        '-fmodules-cache-path=' + TOPOBJDIR + '/media/ffpvx',
+        '-fbuiltin-module-map',
+    ]