From db7854c4d2134f2d835865f24759c4c6be3be897 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 17 Nov 2023 22:23:59 +0000 Subject: [PATCH] math/cmake: use new macro add_local_sources_ifdef() This makes the code shorter and will help with #8260 Zero functional change. Do not use it when Zephyr use is not conditional. Signed-off-by: Marc Herbert --- src/math/CMakeLists.txt | 38 +++++++++----------------------- src/math/auditory/CMakeLists.txt | 8 ++----- src/math/fft/CMakeLists.txt | 8 ++----- 3 files changed, 15 insertions(+), 39 deletions(-) diff --git a/src/math/CMakeLists.txt b/src/math/CMakeLists.txt index 899810544864..afbc4718fa59 100644 --- a/src/math/CMakeLists.txt +++ b/src/math/CMakeLists.txt @@ -11,49 +11,33 @@ if(CONFIG_CORDIC_FIXED) add_local_sources(sof trig.c) endif() -if(CONFIG_SQRT_FIXED) - add_local_sources(sof sqrt_int16.c) -endif() +add_local_sources_ifdef(CONFIG_SQRT_FIXED sof sqrt_int16.c) -if(CONFIG_MATH_EXP) - add_local_sources(sof exp_fcn.c exp_fcn_hifi.c) -endif() +add_local_sources_ifdef(CONFIG_MATH_EXP sof exp_fcn.c exp_fcn_hifi.c) if(CONFIG_MATH_DECIBELS) add_local_sources(sof decibels.c) endif() -if(CONFIG_NATURAL_LOGARITHM_FIXED) - add_local_sources(sof log_e.c) -endif() +add_local_sources_ifdef(CONFIG_NATURAL_LOGARITHM_FIXED sof log_e.c) -if(CONFIG_COMMON_LOGARITHM_FIXED) - add_local_sources(sof log_10.c) -endif() +add_local_sources_ifdef(CONFIG_COMMON_LOGARITHM_FIXED sof log_10.c) -if(CONFIG_POWER_FIXED) - add_local_sources(sof power.c) -endif() +add_local_sources_ifdef(CONFIG_POWER_FIXED sof power.c) -if(CONFIG_BINARY_LOGARITHM_FIXED) - add_local_sources(sof base2log.c) -endif() +add_local_sources_ifdef(CONFIG_BINARY_LOGARITHM_FIXED sof base2log.c) -if(CONFIG_MATH_FIR) - add_local_sources(sof fir_generic.c fir_hifi2ep.c fir_hifi3.c) -endif() +add_local_sources_ifdef(CONFIG_MATH_FIR sof fir_generic.c fir_hifi2ep.c fir_hifi3.c) if(CONFIG_MATH_FFT) add_subdirectory(fft) endif() -if(CONFIG_MATH_IIR_DF2T) - add_local_sources(sof iir_df2t_generic.c iir_df2t_hifi3.c iir_df2t.c) -endif() +add_local_sources_ifdef(CONFIG_MATH_IIR_DF2T sof + iir_df2t_generic.c iir_df2t_hifi3.c iir_df2t.c) -if(CONFIG_MATH_IIR_DF1) - add_local_sources(sof iir_df1_generic.c iir_df1_hifi3.c iir_df1.c) -endif() +add_local_sources_ifdef(CONFIG_MATH_IIR_DF1 sof + iir_df1_generic.c iir_df1_hifi3.c iir_df1.c) if(CONFIG_MATH_WINDOW) add_local_sources(sof window.c) diff --git a/src/math/auditory/CMakeLists.txt b/src/math/auditory/CMakeLists.txt index c94aed430040..2983e1eb4483 100644 --- a/src/math/auditory/CMakeLists.txt +++ b/src/math/auditory/CMakeLists.txt @@ -2,10 +2,6 @@ add_local_sources(sof auditory.c) -if(CONFIG_MATH_16BIT_MEL_FILTERBANK) - add_local_sources(sof mel_filterbank_16.c) -endif() +add_local_sources_ifdef(CONFIG_MATH_16BIT_MEL_FILTERBANK sof mel_filterbank_16.c) -if(CONFIG_MATH_32BIT_MEL_FILTERBANK) - add_local_sources(sof mel_filterbank_32.c) -endif() +add_local_sources_ifdef(CONFIG_MATH_32BIT_MEL_FILTERBANK sof mel_filterbank_32.c) diff --git a/src/math/fft/CMakeLists.txt b/src/math/fft/CMakeLists.txt index e196f54fa0e9..8d422b93c5b1 100644 --- a/src/math/fft/CMakeLists.txt +++ b/src/math/fft/CMakeLists.txt @@ -2,10 +2,6 @@ add_local_sources(sof fft_common.c) -if(CONFIG_MATH_16BIT_FFT) - add_local_sources(sof fft_16.c fft_16_hifi3.c) -endif() +add_local_sources_ifdef(CONFIG_MATH_16BIT_FFT sof fft_16.c fft_16_hifi3.c) -if(CONFIG_MATH_32BIT_FFT) - add_local_sources(sof fft_32.c fft_32_hifi3.c) -endif() +add_local_sources_ifdef(CONFIG_MATH_32BIT_FFT sof fft_32.c fft_32_hifi3.c)