gecko-dev/media/ffvpx/ffvpxcommon.mozbuild
Nathan Froyd 6c5fe582cc 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

--HG--
extra : rebase_source : f1127e909d0f9d3de99959933bcbc54af21fc6e2
2016-11-30 16:01:55 -05:00

105 lines
4.1 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Add assembler flags and includes
ASFLAGS += CONFIG['FFVPX_ASFLAGS']
ASFLAGS += ['-I%s/media/ffvpx' % TOPSRCDIR]
if CONFIG['FFVPX_ASFLAGS']:
USE_YASM = True
if CONFIG['OS_ARCH'] == 'WINNT':
# Fix inline symbols and math defines for windows.
DEFINES['_USE_MATH_DEFINES'] = True
DEFINES['inline'] = "__inline"
# 32-bit windows need to prefix symbols with an underscore.
if CONFIG['CPU_ARCH'] == 'x86':
ASFLAGS += ['-DPREFIX']
ASFLAGS += ['-Pconfig_win32.asm']
else:
ASFLAGS += ['-Pconfig_win64.asm']
elif CONFIG['OS_ARCH'] == 'Darwin':
# 32/64-bit macosx assemblers need to prefix symbols with an underscore.
ASFLAGS += [
'-Pconfig_darwin64.asm',
'-DPREFIX'
]
else:
# Default to unix, similar to how ASFLAGS setup works in configure.in
ASFLAGS += ['-Pconfig_unix64.asm']
LOCAL_INCLUDES += ['/media/ffvpx']
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
CFLAGS += [
'-Wno-parentheses',
'-Wno-pointer-sign',
'-Wno-sign-compare',
'-Wno-switch',
'-Wno-type-limits',
'-Wno-unused-function',
'-Wno-deprecated-declarations',
]
if CONFIG['CLANG_CXX']:
CFLAGS += [
'-Wno-incompatible-pointer-types-discards-qualifiers',
'-Wno-logical-op-parentheses',
]
# Force visibility of cpu and av_log symbols.
CFLAGS += ['-include', 'libavutil_visibility.h']
elif CONFIG['_MSC_VER']:
CFLAGS += [
'-wd4090', # 'return' : different 'const' qualifiers
'-wd4018', # '>' : signed/unsigned mismatch
'-wd4305', # 'initializing' : truncation from '__int64' to 'double'
'-wd4554', # '>>' : check operator precedence for possible error
'-wd4307', # '+' : integral constant overflow'
'-wd4028', # formal parameter 1 different from declaration
'-wd4056', # overflow in floating-point constant arithmetic
'-wd4756', # overflow in constant arithmetic
'-wd4005', #'WIN32_LEAN_AND_MEAN' : macro redefinition
'-wd4054', # 'type cast' : from function pointer 'FARPROC' to data pointer 'void *'
'-wd4189', # local variable is initialized but not referenced
'-wd4133', # 'function' : incompatible types - from 'AVSampleFormat *' to 'int *'
'-wd4221', # nonstandard extension used
'-wd4206', # nonstandard extension used
'-wd4702', # unreachable code
'-wd4101', # unreferenced local variable
'-wd4245', # conversion from 'int' to 'uint32_t', signed/unsigned mismatch
'-wd4703', # potentially uninitialized local pointer
'-wd4293', # '<<' : shift count negative or too big, undefined behavior
# from FFmpeg configure
'-wd4244', '-wd4127', '-wd4018', '-wd4389', '-wd4146', '-wd4701',
'-wd4057', '-wd4204', '-wd4706', '-wd4305', '-wd4152', '-wd4324',
'-we4013', '-wd4100', '-wd4214', '-wd4307', '-wd4273', '-wd4554',
]
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',
]