Bug 1298418 - use clang modules with ffvpx's libavutil and clang-cl; r?mshal draft
authorNathan Froyd <froydnj@mozilla.com>
Wed, 30 Nov 2016 16:01:55 -0500
changeset 446049 8c71cfe5cdd6e1885dfa2b72a8c418f1293bbcac
parent 446048 5fa474b334377dae32967f386f39dbe29e2c70d1
child 446050 f1fd5e11dffbd1b355366ce720456786c22a4911
push id37685
push userbmo:nfroyd@mozilla.com
push dateWed, 30 Nov 2016 21:04:43 +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',
+    ]