meson: Use neon_opt to control building neon files

Using the have_neon boolean to enable NEON code means we have to either
fully enable it or fully disable it. When using -Dneon=runtime, ideally
only the parts that support runtime checks would be built for NEON, and
those that don't would be built without NEON. Though, there are no
longer any runtime checks for NEON anywhere, so it's equivalent to 'no'
with a warning.

In general, we should use have_* variables to indicate compiler support,
and *_opt options to choose if and how we want to utilize that. Use
neon_opt to control NEON compilation and avoid modifying have_neon which
now would fully refer to compiler support.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
This commit is contained in:
Alper Nebi Yasak 2024-10-30 03:18:15 +03:00 committed by Arun Raghavan
parent 2493b6e659
commit 73aed233b2
4 changed files with 4 additions and 7 deletions

View File

@ -180,11 +180,8 @@ if neon_opt != 'no' and not have_neon
endif endif
if neon_opt == 'runtime' if neon_opt == 'runtime'
warning('webrtc cannot check NEON support at runtime, will build without NEON') warning('webrtc cannot check NEON support at runtime, will build without NEON')
have_neon = false
elif neon_opt == 'no'
have_neon = false
endif endif
if have_neon 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

@ -112,7 +112,7 @@ if have_armv7
] ]
endif endif
if have_neon if neon_opt == 'yes'
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 have_neon if neon_opt == 'yes'
webrtc_audio_processing_sources += [ webrtc_audio_processing_sources += [
'aecm/aecm_core_neon.cc', 'aecm/aecm_core_neon.cc',
] ]

View File

@ -4,7 +4,7 @@ pffft_sources = [
pffft_cflags = [ '-D_GNU_SOURCE' ] pffft_cflags = [ '-D_GNU_SOURCE' ]
if not have_inline_sse or (have_arm and not have_neon) or (have_mips and host_machine.endian() == 'little') or have_mips64 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