moz.build (3847B)
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- 2 # vim: set filetype=python: 3 # This Source Code Form is subject to the terms of the Mozilla Public 4 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 SOURCES += [ 8 'alpha_processing.c', 9 'cost.c', 10 'dec.c', 11 'dec_clip_tables.c', 12 'enc.c', 13 'filters.c', 14 'lossless.c', 15 'lossless_enc.c', 16 'rescaler.c', 17 'ssim.c', 18 'upsampling.c', 19 'yuv.c', 20 ] 21 22 LOCAL_INCLUDES += [ 23 '/media/libwebp', 24 ] 25 26 # Note the defines in this file for cpu instruction sets are mostly overridden 27 # and enabled by what src/dsp/cpu.h does. So just removing the defines here may do 28 # nothing. 29 30 if CONFIG['TARGET_CPU'] == 'arm' and CONFIG['BUILD_ARM_NEON']: 31 SOURCES += [ 32 'alpha_processing_neon.c', 33 'cost_neon.c', 34 'dec_neon.c', 35 'enc_neon.c', 36 'filters_neon.c', 37 'lossless_enc_neon.c', 38 'lossless_neon.c', 39 'rescaler_neon.c', 40 'upsampling_neon.c', 41 'yuv_neon.c', 42 ] 43 DEFINES['WEBP_HAVE_NEON'] = 1; 44 for f in SOURCES: 45 if f.endswith('neon.c'): 46 SOURCES[f].flags += CONFIG['NEON_FLAGS'] 47 elif CONFIG['TARGET_CPU'] == 'aarch64': 48 SOURCES += [ 49 'alpha_processing_neon.c', 50 'cost_neon.c', 51 'dec_neon.c', 52 'enc_neon.c', 53 'filters_neon.c', 54 'lossless_enc_neon.c', 55 'lossless_neon.c', 56 'rescaler_neon.c', 57 'upsampling_neon.c', 58 'yuv_neon.c', 59 ] 60 DEFINES['WEBP_HAVE_NEON'] = 1; 61 elif CONFIG['INTEL_ARCHITECTURE']: 62 SOURCES += [ 63 'alpha_processing_sse2.c', 64 'alpha_processing_sse41.c', 65 'cost_sse2.c', 66 'dec_sse2.c', 67 'dec_sse41.c', 68 'enc_sse2.c', 69 'enc_sse41.c', 70 'filters_sse2.c', 71 'lossless_enc_sse2.c', 72 'lossless_enc_sse41.c', 73 'lossless_sse2.c', 74 'lossless_sse41.c', 75 'rescaler_sse2.c', 76 'ssim_sse2.c', 77 'upsampling_sse2.c', 78 'upsampling_sse41.c', 79 'yuv_sse2.c', 80 'yuv_sse41.c', 81 ] 82 DEFINES['WEBP_HAVE_SSE2'] = 1; 83 DEFINES['WEBP_HAVE_SSE41'] = 1; 84 # The avx intrinsics that libwebp uses are only available in gcc 11 or newer. 85 if CONFIG["CC_TYPE"] != "gcc" or int(CONFIG["CC_VERSION"].split(".")[0]) >= 11: 86 # disable avx2 until this bug is fixed 87 # https://bugzilla.mozilla.org/show_bug.cgi?id=1980010 88 # https://issues.chromium.org/u/1/issues/435213378 89 # DEFINES['WEBP_HAVE_AVX2'] = 1; 90 SOURCES += [ 91 'lossless_avx2.c', 92 'lossless_enc_avx2.c', 93 ] 94 for f in SOURCES: 95 if f.endswith('sse2.c'): 96 SOURCES[f].flags += CONFIG['SSE2_FLAGS'] 97 elif f.endswith('sse41.c'): 98 SOURCES[f].flags += ['-msse4.1'] 99 elif f.endswith('avx2.c'): 100 SOURCES[f].flags += ['-mavx2'] 101 elif CONFIG['TARGET_CPU'].startswith('mips'): 102 SOURCES += [ 103 'alpha_processing_mips_dsp_r2.c', 104 'cost_mips32.c', 105 'cost_mips_dsp_r2.c', 106 'dec_mips32.c', 107 'dec_mips_dsp_r2.c', 108 'enc_mips32.c', 109 'enc_mips_dsp_r2.c', 110 'filters_mips_dsp_r2.c', 111 'lossless_enc_mips32.c', 112 'lossless_enc_mips_dsp_r2.c', 113 'lossless_mips_dsp_r2.c', 114 'lossless_msa.c', 115 'rescaler_mips32.c', 116 'rescaler_mips_dsp_r2.c', 117 'rescaler_msa.c', 118 'upsampling_mips_dsp_r2.c', 119 'upsampling_msa.c', 120 'yuv_mips32.c', 121 'yuv_mips_dsp_r2.c', 122 ] 123 124 if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): 125 CFLAGS += ['-Wno-unreachable-code'] 126 127 # Add libFuzzer configuration directives 128 include('/tools/fuzzing/libfuzzer-config.mozbuild') 129 130 FINAL_LIBRARY = 'xul' 131 132 # We allow warnings for third-party code that can be updated from upstream. 133 AllowCompilerWarnings()