From 73aed233b25fe792ffcc4cdfe906cc09a98db7ec Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Wed, 30 Oct 2024 03:18:15 +0300 Subject: [PATCH] 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 --- meson.build | 5 +---- webrtc/common_audio/meson.build | 2 +- webrtc/modules/audio_processing/meson.build | 2 +- webrtc/third_party/pffft/meson.build | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 073c1ed..37f7e3d 100644 --- a/meson.build +++ b/meson.build @@ -180,11 +180,8 @@ if neon_opt != 'no' and not have_neon endif if neon_opt == 'runtime' warning('webrtc cannot check NEON support at runtime, will build without NEON') - have_neon = false -elif neon_opt == 'no' - have_neon = false endif -if have_neon +if neon_opt == 'yes' arch_cflags += ['-DWEBRTC_HAS_NEON'] if not have_arm64 arch_cflags += ['-mfpu=neon'] diff --git a/webrtc/common_audio/meson.build b/webrtc/common_audio/meson.build index 2d13205..051e9f3 100644 --- a/webrtc/common_audio/meson.build +++ b/webrtc/common_audio/meson.build @@ -112,7 +112,7 @@ if have_armv7 ] endif -if have_neon +if neon_opt == 'yes' common_audio_sources += [ 'fir_filter_neon.cc', 'resampler/sinc_resampler_neon.cc', diff --git a/webrtc/modules/audio_processing/meson.build b/webrtc/modules/audio_processing/meson.build index b319b0b..e8b04b9 100644 --- a/webrtc/modules/audio_processing/meson.build +++ b/webrtc/modules/audio_processing/meson.build @@ -180,7 +180,7 @@ else ] endif -if have_neon +if neon_opt == 'yes' webrtc_audio_processing_sources += [ 'aecm/aecm_core_neon.cc', ] diff --git a/webrtc/third_party/pffft/meson.build b/webrtc/third_party/pffft/meson.build index cf4c9c7..90bc957 100644 --- a/webrtc/third_party/pffft/meson.build +++ b/webrtc/third_party/pffft/meson.build @@ -4,7 +4,7 @@ pffft_sources = [ 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' ] endif