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
--- 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',
+ ]