meson: Convert the 'neon' option into a feature

Easier to express things, now that runtime is a no-op.
This commit is contained in:
Arun Raghavan 2024-12-30 16:10:39 -05:00
parent d63a2c9714
commit 54a632f018
5 changed files with 9 additions and 29 deletions

View File

@ -135,9 +135,7 @@ if host_machine.cpu_family() == 'arm'
have_neon = true have_neon = true
endif endif
endif endif
if cc.compiles('''#ifndef __aarch64__ if host_machine.cpu_family() == 'aarch64'
#error no aarch64 arch
#endif''')
have_arm64 = true have_arm64 = true
have_neon = true have_neon = true
arch_cflags += ['-DWEBRTC_ARCH_ARM64'] arch_cflags += ['-DWEBRTC_ARCH_ARM64']
@ -165,23 +163,9 @@ if ['x86', 'x86_64'].contains(host_machine.cpu_family())
endif endif
endif endif
neon_opt = get_option('neon') neon_opt = get_option('neon').require(have_neon)
if neon_opt == 'auto'
if have_arm64 if neon_opt.enabled()
neon_opt = 'yes'
elif have_neon
neon_opt = 'runtime'
else
neon_opt = 'no'
endif
endif
if neon_opt != 'no' and not have_neon
error('Compiler or architecture does not support NEON')
endif
if neon_opt == 'runtime'
warning('webrtc cannot check NEON support at runtime, will build without NEON')
endif
if neon_opt == 'yes'
arch_cflags += ['-DWEBRTC_HAS_NEON'] arch_cflags += ['-DWEBRTC_HAS_NEON']
if not have_arm64 if not have_arm64
arch_cflags += ['-mfpu=neon'] arch_cflags += ['-mfpu=neon']

View File

@ -1,8 +1,8 @@
option('gnustl', type: 'feature', option('gnustl', type: 'feature',
value: 'auto', value: 'auto',
description: 'Use gnustl for a c++ library implementation (only used on Android)') description: 'Use gnustl for a c++ library implementation (only used on Android)')
option('neon', type: 'combo', option('neon', type: 'feature',
choices: ['auto', 'yes', 'runtime', 'no'], value: 'auto',
description: 'Enable NEON optimisations') description: 'Enable NEON optimisations')
option('inline-sse', type: 'boolean', option('inline-sse', type: 'boolean',
value: true, value: true,

View File

@ -112,7 +112,7 @@ if have_armv7
] ]
endif endif
if neon_opt == 'yes' if neon_opt.enabled()
common_audio_sources += [ common_audio_sources += [
'fir_filter_neon.cc', 'fir_filter_neon.cc',
'resampler/sinc_resampler_neon.cc', 'resampler/sinc_resampler_neon.cc',

View File

@ -180,7 +180,7 @@ else
] ]
endif endif
if neon_opt == 'yes' if neon_opt.enabled()
webrtc_audio_processing_sources += [ webrtc_audio_processing_sources += [
'aecm/aecm_core_neon.cc', 'aecm/aecm_core_neon.cc',
] ]

View File

@ -4,11 +4,7 @@ pffft_sources = [
pffft_cflags = [ '-D_GNU_SOURCE' ] pffft_cflags = [ '-D_GNU_SOURCE' ]
if neon_opt == 'runtime' if not have_inline_sse or (have_arm and not neon_opt.enabled()) or (have_mips and host_machine.endian() == 'little') or have_mips64
warning('pffft cannot check NEON support at runtime, will build without NEON')
endif
if not have_inline_sse or (have_arm and neon_opt != 'yes') or (have_mips and host_machine.endian() == 'little') or have_mips64
pffft_cflags += [ '-DPFFFT_SIMD_DISABLE' ] pffft_cflags += [ '-DPFFFT_SIMD_DISABLE' ]
endif endif