Skip to content

Commit

Permalink
math/cmake: use new macro add_local_sources_ifdef()
Browse files Browse the repository at this point in the history
This makes the code shorter and will help with thesofproject#8260

Zero functional change.

Do not use it when Zephyr use is not conditional.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb committed Nov 18, 2023
1 parent 8991d7f commit db7854c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 39 deletions.
38 changes: 11 additions & 27 deletions src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 2 additions & 6 deletions src/math/auditory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 2 additions & 6 deletions src/math/fft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit db7854c

Please sign in to comment.